"docs/vscode:/vscode.git/clone" did not exist on "0523449c9c78b958b548eefc3fdbdd026ae37aba"
Unverified Commit 4c7629ca authored by Aaron Pham's avatar Aaron Pham Committed by GitHub
Browse files

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


Signed-off-by: default avatarAaron Pham <contact@aarnphm.xyz>
parent e0fdfa16
...@@ -40,7 +40,7 @@ class StructuredOutputManager: ...@@ -40,7 +40,7 @@ class StructuredOutputManager:
tokenizer_group.ping() tokenizer_group.ping()
tokenizer = tokenizer_group.get_lora_tokenizer(None) tokenizer = tokenizer_group.get_lora_tokenizer(None)
self.vocab_size = tokenizer.max_token_id + 1 self.vocab_size = len(tokenizer.get_vocab())
if isinstance(tokenizer, MistralTokenizer): if isinstance(tokenizer, MistralTokenizer):
# NOTE: ideally, xgrammar should handle this accordingly. # NOTE: ideally, xgrammar should handle this accordingly.
# refer to https://github.com/mlc-ai/xgrammar/blob/d77c0a0173ef14779c918e3be7966ba852f7910f/python/xgrammar/tokenizer_info.py#L98 # refer to https://github.com/mlc-ai/xgrammar/blob/d77c0a0173ef14779c918e3be7966ba852f7910f/python/xgrammar/tokenizer_info.py#L98
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment