@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 4c7629cae9
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 15, 18:30 UTC

[V1][Structured Output] calculate vocab_size eagerly (#14851)

Signed-off-by: Aaron Pham <contact@aarnphm.xyz>

Aaron Pham committed Mar 15, 2025 at 01:09 UTC 4c7629cae94d1a4a8ba91d16946bbc283ecd3413
1 file changed +1 -1
vllm/v1/structured_output/__init__.py
+1 -1
@@ -40,7 +40,7 @@ class StructuredOutputManager:
40 tokenizer_group.ping()
41
42 tokenizer = tokenizer_group.get_lora_tokenizer(None)
43 - self.vocab_size = tokenizer.max_token_id + 1
43 + self.vocab_size = len(tokenizer.get_vocab())
44 if isinstance(tokenizer, MistralTokenizer):
45 # NOTE: ideally, xgrammar should handle this accordingly.
46 # refer to https://github.com/mlc-ai/xgrammar/blob/d77c0a0173ef14779c918e3be7966ba852f7910f/python/xgrammar/tokenizer_info.py#L98