Lc/fix xtc special tokens server#1176
Open
micuentadecasa wants to merge 2 commits intoml-explore:mainfrom
Open
Lc/fix xtc special tokens server#1176micuentadecasa wants to merge 2 commits intoml-explore:mainfrom
micuentadecasa wants to merge 2 commits intoml-explore:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug Description
_make_samplerinserver.pyconstructsxtc_special_tokensas a nested list[int, [int, ...]]instead of a flatlist of ints. When XTC sampling is triggered (
xtc_probability > 0),apply_xtcpasses this tomask[..., xtc_special_tokens] = Falsewhich crashes:XTC sampling via the server is completely broken — any request with
xtc_probability > 0returns an HTTP 500 on thefirst token.
Root Cause
server.pylines 388-391:tokenizer.encode()returns a list. Wrapping it in[...]alongside an int creates a nested list. Additionally,eos_token_id(singular) only includes one EOS token, missing others on multi-EOS models.Fix
generate.py:2062andchat.py:155xtc_special_tokens=tokenizer.encode("\n") + list(tokenizer.eos_token_ids)This produces a flat list and includes all EOS tokens.
Validation
Before:
After:
6 unit tests in
tests/test_xtc_tokens.py— all passing.