RUNLOCALAIv38
->Will it run?Best GPUCompareTroubleshootStartLearnPulseModelsHardwareToolsBench
Run check
RUNLOCALAI

Independently operated catalog for local-AI hardware and software. Hand-written verdicts. Source-cited claims. Reproducible commands when we have them.

OP·Eruo Fredoline
DIR
  • Models
  • Hardware
  • Tools
  • Benchmarks
TOOLS
  • Will it run?
  • Compare hardware
  • Cost vs cloud
  • Choose my GPU
  • Prompting kits
  • Quick answers
REF
  • All buyer guides
  • Learn local AI
  • Methodology
  • Glossary
  • Errors KB
  • Trust
EDITOR
  • About
  • Author
  • How we make money
  • Editorial policy
  • Contact
LEGAL
  • Privacy
  • Terms
  • Sitemap
MAIL · MONTHLY DIGEST
Get monthly local AI changes
Monthly recap. No spam.
DISCLOSURE

Some links on this site are affiliate links (Amazon Associates and other first-class retailers). When you buy through them, we earn a small commission at no extra cost to you. Affiliate links do not influence our verdicts — there are cards we rate highly that we don't have affiliate relationships with, and cards that sell well that we refuse to recommend. Read more →

© 2026 runlocalai.coIndependently operated
RUNLOCALAI · v38
Errors / Tokenizer mismatches / OSError: Can't load tokenizer for ... / no file named tokenizer.json
Tokenizer mismatches

OSError: Can't load tokenizer for ... / no file named tokenizer.json

OSError: Can't load tokenizer for '...'. If you were trying to load it from 'https://huggingface.co/models'
By Eruo Fredoline · Last verified May 8, 2026

Cause

AutoTokenizer.from_pretrained couldn't find the tokenizer files in the local cache or on Hugging Face. Common causes: the directory you passed contains weights but no tokenizer files, the download was interrupted, or you're pointing at a fine-tune that didn't ship its own tokenizer (and you need the base model's).

Solution

1. List what's in your model directory:

ls /path/to/model
# Need at minimum: tokenizer.json (or tokenizer.model + tokenizer_config.json)

Files typically required:

  • tokenizer.json (fast tokenizer) OR tokenizer.model (SentencePiece)
  • tokenizer_config.json
  • special_tokens_map.json
  • For chat models: a chat_template field in tokenizer_config.json

2. Re-download with explicit allow-list to make sure tokenizer files come through:

hf download <org>/<model> \
  --include "tokenizer*" "*.json" "*.model" \
  --local-dir /path/to/model

3. If the fine-tune doesn't include its own tokenizer, point at the base:

tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.1-8B-Instruct")  # base
model = AutoModelForCausalLM.from_pretrained("/path/to/finetune")  # weights

4. For GGUF inference, you don't need separate tokenizer files — the tokenizer is embedded in the GGUF. If you're seeing this error from a GGUF flow, you're using the wrong loader. Use llama-cpp-python, not AutoTokenizer.

Related errors

  • Model loaded but tokenizer vocab size mismatch
  • TypeError: 'NoneType' object is not subscriptable in tokenizer
  • Quantized model produces garbage / never stops generating
  • GGUF model outputs garbage — tokenizer / chat-template mismatch
  • Model produces gibberish or repeats one token forever

Did this fix it?

If your case was different, email Contact support with what you saw and we'll update the page. If it worked but took different commands on your platform, we want to know that too.