Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/transformers/models/auto/tokenization_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,8 @@ def from_pretrained(
and tokenizer_config_class is not None
and config_model_type is not None
and config_model_type != ""
and TOKENIZER_MAPPING_NAMES.get(config_model_type, "").replace("Fast", "")
and TOKENIZER_MAPPING_NAMES.get(config_model_type) is not None
and TOKENIZER_MAPPING_NAMES.get(config_model_type).replace("Fast", "")
!= tokenizer_config_class.replace("Fast", "")
):
# new model, but we ignore it unless the model type is the same
Expand Down
2 changes: 1 addition & 1 deletion tests/models/aria/test_processing_aria.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def test_process_interleaved_images_prompts_no_image_splitting(self):
# Pad the first input to match the second input
pad_len = len(expected_input_ids_2) - len(expected_input_ids_1)

expected_attention_mask = [ [1] * len(expected_input_ids_1) + [0] * pad_len, [1] * (len(expected_input_ids_2))]
expected_attention_mask = [ [0] * pad_len + [1] * len(expected_input_ids_1), [1] * (len(expected_input_ids_2))]

self.assertEqual(
inputs["attention_mask"],
Expand Down
6 changes: 0 additions & 6 deletions tests/models/auto/test_tokenization_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,15 +621,9 @@ def test_tokenization_class_priority(self):
tok2 = AutoTokenizer.from_pretrained(tmp_dir)
self.assertTrue(tok2.__class__ == HerbertTokenizer)

tok = AutoTokenizer.from_pretrained("HuggingFaceTB/SmolLM2-135M-Instruct")
self.assertTrue(tok.__class__ == TokenizersBackend)

tok = AutoProcessor.from_pretrained("mistralai/Ministral-3-8B-Instruct-2512-BF16").tokenizer
self.assertTrue(tok.__class__ == TokenizersBackend)

tok = AutoTokenizer.from_pretrained("HuggingFaceTB/SmolLM2-135M-Instruct")
self.assertTrue(tok.__class__ == TokenizersBackend)

def test_custom_tokenizer_with_mismatched_tokenizer_class(self):
nop_tokenizer_code = """
import transformers
Expand Down