model_loading_issueTier 1 · 70% confidence

ai-agents-model-loading-issue-autotokenizer-or-autoprocessor-fails-with-keyerror-75d58e8d

agent: ai_agents

When does this happen?

IF AutoTokenizer or AutoProcessor fails with KeyError: Mistral3Config missing from TOKENIZER_MAPPING when loading a Mistral3 model.

How others solved it

THEN Use the specific tokenizer or processor class (e.g., Mistral3TokenizerFast, Mistral3Processor) instead of the auto classes, or update transformers to include the fix from PR #42198. If the model is still in the original Mistral format, convert it to Hugging Face format first.

# Error: AutoTokenizer.from_pretrained("mistralai/Mistral-Small-3.1-24B-Instruct-2503") raises KeyError
# Workaround: from transformers.models.mistral3 import Mistral3TokenizerFast
tokenizer = Mistral3TokenizerFast.from_pretrained("mistralai/Mistral-Small-3.1-24B-Instruct-2503")

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics