Skip to content

main red: #6386 tokenizer validation rejects test fixtures #6400

Done

Description

@Qubitium

Summary

#6386 ("reject tokenizer-less checkpoints instead of loading an empty tokenizer") added a load-time usability check in gptqmodel/utils/hf.py::load_hf_tokenizer. Main is now red because many tiny test fixtures write a 3-5 token WordLevel vocabulary (only special tokens) — or no tokenizer at all — next to a synthetic model whose vocab_size is 32-1024. GPTQModel.load then raises at fixture setup:

ValueError: The tokenizer in `/tmp/pytest-of-root/.../source` is unusable: it cannot encode ordinary text
(loaded tokenizer: 3 token(s), model `vocab_size=32`) ...
  gptqmodel/utils/hf.py:1475

The product check is correct; the fixtures are wrong.

Measured on clean 1615accf9

cd tests && CUDA_VISIBLE_DEVICES=1 python -m pytest \
    test_hf_bridge_cpu_offload_5022.py test_cpu_offload_tied_both_copies_4943.py -q -rs
-> 21 passed, 16 errors

Widening to every fixture that loads a synthetic checkpoint through GPTQModel.load on the same tree (8 files, CPU):

-> 67 failed, 209 passed, 27 skipped

Affected fixtures

file failure
tests/test_cpu_offload_tied_both_copies_4943.py 16 GPU errors — no tokenizer written at all
tests/test_hf_bridge_cpu_offload_5022.py 3 errors — build_wordlevel_tokenizer(1024) rebuilt as Qwen2 BPE, encodes to []; v1 fixture has a 3-token WordLevel
tests/test_checkpoint_interop_4053.py 13 failures — 3-token WordLevel, vocab_size=32
tests/test_required_qweight.py 18 failures — 3-token WordLevel, vocab_size=32
tests/test_deepseek_v2_local_port.py 14 failures — 4-token WordLevel, vocab_size=43
tests/test_qwen2_vl_local_port.py 16 failures — WordLevel with t4..t59, rebuilt as Qwen2 BPE, encodes to []
tests/test_checkpoint_compat.py 1 failure — Phi-3 fixture, 3-token WordLevel, vocab_size=64
tests/module_tree/test_inkling2_loop_plan.py 1 failure — 5-token all-special WordLevel, vocab_size=64

tests/test_int3_legacy_qzeros_6375.py and tests/test_hf_bridge_legacy_qzeros_marlin_6274.py have the same cause but are handled by #6392 / #6391 and are intentionally not touched here.

Expected fix

Fixtures only: write a real byte-level tokenizer (tests/tiny_tokenizer.py, or an explicit vocab where a fixture pins token ids) instead of weakening tokenizer_is_usable. No product change.

Activity

  1. added a commit that references this issue on Nov 29, 2026
    97ef567
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions