From 8d16fdb71c155e81d87a557e74fb2eb9c8776d30 Mon Sep 17 00:00:00 2001 From: gufengc Date: Tue, 18 Nov 2025 22:08:43 +0800 Subject: [PATCH] fix(tokenizer): fix tokenizer bug --- src/parallax/server/executor.py | 1 + src/parallax/sglang/model_runner.py | 1 + src/parallax/utils/tokenizer_utils.py | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/parallax/server/executor.py b/src/parallax/server/executor.py index d2cda590..08dda6f6 100644 --- a/src/parallax/server/executor.py +++ b/src/parallax/server/executor.py @@ -858,6 +858,7 @@ def _handle_raw_request(self, raw_request: Dict): prompt = self.tokenizer.apply_chat_template( messages, raw_request.get("tools") or None, + tokenize=True, add_generation_prompt=True, **chat_template_kwargs, ) diff --git a/src/parallax/sglang/model_runner.py b/src/parallax/sglang/model_runner.py index d1624a13..818e251d 100755 --- a/src/parallax/sglang/model_runner.py +++ b/src/parallax/sglang/model_runner.py @@ -217,6 +217,7 @@ def form_sgl_server_args( mem_fraction_static=0.85, moe_runner_backend=moe_runner_backend, tp_size=tp_size, + trust_remote_code=True, ) return sgl_server_args diff --git a/src/parallax/utils/tokenizer_utils.py b/src/parallax/utils/tokenizer_utils.py index 63bee300..e2ea3216 100755 --- a/src/parallax/utils/tokenizer_utils.py +++ b/src/parallax/utils/tokenizer_utils.py @@ -75,7 +75,7 @@ def load_detokenizer(model_path, tokenizer): Note, to use a fast streaming tokenizer, pass a local file path rather than a Hugging Face repo ID. """ - detokenizer_class = NaiveStreamingDetokenizer + detokenizer_class = ParallaxNaiveStreamingDetokenizer tokenmap = None tokenizer_file = model_path / "tokenizer.json"