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 / TypeError: 'NoneType' object is not subscriptable in tokenizer
Tokenizer mismatches

TypeError: 'NoneType' object is not subscriptable in tokenizer

TypeError: 'NoneType' object is not subscriptable
By Eruo Fredoline · Last verified May 8, 2026

Cause

AutoTokenizer.from_pretrained returned None for some attribute the caller dereferenced — almost always because the tokenizer files weren't actually downloaded, or because a custom tokenizer class wasn't registered.

Common scenarios: download interrupted before tokenizer.json finished, gated model where only the README came through, or a model that requires trust_remote_code=True because its tokenizer ships as a Python file in the repo.

Solution

1. Confirm the tokenizer files are present:

ls -la ~/.cache/huggingface/hub/models--<org>--<model>/snapshots/*/
# Should include: tokenizer.json, tokenizer_config.json, special_tokens_map.json

If tokenizer.json is missing or zero bytes, re-download:

hf download <org>/<model> --resume-download

2. Pass trust_remote_code=True for models that ship custom tokenizer code (Yi, some Qwen variants, DeepSeek-VL):

from transformers import AutoTokenizer
tok = AutoTokenizer.from_pretrained(name, trust_remote_code=True)

3. Use the right loader for the right format. A GGUF file's tokenizer is embedded in the file — don't try to load it via HuggingFace AutoTokenizer; use llama-cpp-python or the model's own loader.

4. Check for permissions / gated access:

hf auth whoami  # confirm you're logged in

Llama and Gemma require accepting the license on HF before tokenizer files become accessible.

Related errors

  • Model loaded but tokenizer vocab size mismatch
  • Quantized model produces garbage / never stops generating
  • OSError: Can't load tokenizer for ... / no file named tokenizer.json
  • 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.