transformers
12c8a3cd - Restore TokenizersBackend dispatch for MODELS_WITH_INCORRECT_HUB_TOKENIZER_CLASS

Commit
222 days ago
Restore TokenizersBackend dispatch for MODELS_WITH_INCORRECT_HUB_TOKENIZER_CLASS Fixes #45488. Commit cd5bcad reordered AutoTokenizer.from_pretrained dispatch to prefer the specialized class named in tokenizer_config.json over TokenizersBackend. This silently broke the deliberate override for models in MODELS_WITH_INCORRECT_HUB_TOKENIZER_CLASS — notably the DeepSeek V3/R1 family — whose tokenizer_class field (LlamaTokenizerFast) was added to that set precisely because LlamaTokenizerFast.__init__ overwrites the ByteLevel pre-tokenizer declared in tokenizer.json with Metaspace, dropping all spaces from encode/decode round-trips. When the model_type is pinned to 'TokenizersBackend' in TOKENIZER_MAPPING_NAMES, skip the named-class branch and use TokenizersBackend directly. NLLB and other models whose mapping points to a real specialized class (the case cd5bcad targeted) are unaffected.
Author
Parents
Loading