[Model] Engine based plamo3 parser (#56575)

Signed-off-by: Shinichi Hemmi <shemmi@preferred.jp>
This commit is contained in:
Shinichi Hemmi
2026-09-29 05:17:42 +00:00
committed by GitHub
parent 36768d1bfd
commit 17cc3cd80e
14 changed files with 1311 additions and 5 deletions
@@ -38,6 +38,10 @@ class XgrammarBackend(StructuredOutputBackend):
self.disable_any_whitespace = (
self.vllm_config.structured_outputs_config.disable_any_whitespace
)
model_config = self.vllm_config.model_config
is_plamo3 = (
model_config is not None and model_config.hf_config.model_type == "plamo3"
)
if is_mistral_tokenizer(self.tokenizer):
# NOTE: ideally, xgrammar should handle this accordingly.
@@ -57,6 +61,10 @@ class XgrammarBackend(StructuredOutputBackend):
stop_token_ids=stop_token_ids,
add_prefix_space=True,
)
elif is_plamo3 and callable(
init_xgrammar := getattr(self.tokenizer, "init_xgrammar", None)
):
tokenizer_info, _ = init_xgrammar()
else:
tokenizer_info = xgr.TokenizerInfo.from_huggingface(
self.tokenizer,