Repository navigation
Conversation
This branch has not been deployed
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.
Summary
Transformers 5.10.4 rebuilds Wan's UMT5 tokenizer with
unk_id=2, but Wan reserves ID 2 for<s>and uses ID 3 for<unk>. As a result, unsupported Unicode characters could be interpreted as beginning-of-sequence tokens and produce incorrect prompt conditioning.Before:
𝄞 music→[273, 2, 10129, 1](2is<s>)After:
𝄞 music→[273, 3, 10129, 1](3is<unk>)This change:
tokenizer.jsondirectly instead of rebuilding its Unigram pipeline throughT5Tokenizer.unk_id=3, EOS behavior, and user-defined pieces.Related Issues / Discussions
Closes #9984
QA Instructions
Reproduction:
𝄞 music.<unk>ID 3 rather than<s>ID 2.Focused regression tests:
Result:
The warnings came from an unavailable SQLAlchemy warning filter in the minimal test environment and a Python 3.14 protobuf deprecation; neither is related to this change.
Static checks:
Results:
git diff --check: passed.tokenizer.jsonversus the reconstructed SentencePiece-only path: 2,030 Unicode, unknown-token, special-token, and user-defined-token cases compared with zero mismatches.Review
Material findings resolved:
Regression coverage now exercises the real Wan Diffusers loader route, serialized tokenizer loading, EOS insertion, SentencePiece-only reconstruction, unknown-token IDs, and user-defined-token boundaries.
Remaining limitation: the focused CPU tests validate tokenizer and loader behavior, but a complete Wan GPU generation was not run locally.
Compatibility / Rollout
No persisted-data migration or public API change is required.
Prompts containing previously mis-tokenized Unicode or out-of-vocabulary characters will intentionally produce different conditioning after this fix. Existing tokenizer folders containing either
tokenizer.jsonorspiece.modelremain supported.Rollback only requires reverting this change; no persisted state needs to be restored.
Checklist
Need help on this PR? Tag
@codesmith-botwith what you need.