Skip to content

[TEST] #6386 tokenizer usability guard rejects fixture tokenizers in 19 more test files (116 nodes) #6404

Done

Description

@Qubitium

Fresh sweep of main = 1615accf9. #6386's new tokenizer-usability guard rejects the synthetic tokenizers used by CPU fixtures. The two files already being repaired (test_hf_bridge_cpu_offload_5022.py, test_cpu_offload_tied_both_copies_4943.py) are excluded here, as is test_int3_legacy_qzeros_6375.py (covered by #6392).

Root cause

load_hf_tokenizer() (gptqmodel/utils/hf.py) now raises when the loaded tokenizer cannot encode ordinary text, or when a checkpoint ships no tokenizer files:

ValueError: The tokenizer in `<tmp>/...` is unusable: it cannot encode ordinary text (loaded tokenizer: N token(s), model `vocab_size=N`).
ValueError: Tokenizer files are missing from `<tmp>/...`: expected `tokenizer.json`, `tokenizer_config.json`, or `vocab.json` ...

Many fixtures build a WordLevel/special-tokens-only tokenizer (3-13 tokens) or write no tokenizer at all. The shared helper tests/tiny_tokenizer.py (write_tiny_tokenizer) already produces a byte-level BPE that satisfies the guard; these files were not migrated.

Affected files (117 nodes, 20 files, all on CPU)

nodes file
20 test_qwen2_vl_local_port.py
18 test_required_qweight.py
15 test_checkpoint_interop_4053.py
12 test_deepseek_v2_local_port.py
10 test_measure_model.py
8 test_local_processor_loading.py
6 test_gptaq_foem_first_capture_5831.py
5 test_gptq_processor_hessian_release_5026.py
3 test_compile_load_race_5209.py
3 test_fp8.py
3 test_gptaq_shuffle_pairing_4869.py
3 test_hf_bridge_legacy_qzeros_marlin_6274.py
2 test_awq_vl_rotary_resolution.py
2 test_fail_closed_checkpoint_5218.py
2 test_processor_finalize_4747.py
1 test_awq_falcon_h1_parallel_branch_4741.py
1 test_checkpoint_compat.py
1 test_construction_global_state_5421.py
1 test_gsq_per_linear_inference_mode_4690.py
1 test_transformers_unpatched.py

A handful also surface as AssertionError: Regex pattern did not match because the guard fires before the missing-qweight validation they assert on (test_required_qweight.py, test_checkpoint_interop_4053.py).

Repro

cd tests
CUDA_VISIBLE_DEVICES="" PYTHONPATH=<clone>:<clone>/tests /root/venv/bin/python -m pytest \
  "test_required_qweight.py::test_complete_or_derived_checkpoint_weights_load[None-False-gptq]" \
  "test_local_processor_loading.py::test_public_load_selects_definition_owned_processor[-False-False]" \
  -q --tb=line -p no:cacheprovider
# ValueError: The tokenizer in ... is unusable: it cannot encode ordinary text

Suggested fix

Migrate each fixture to tests.tiny_tokenizer.write_tiny_tokenizer(path, vocab_size=...) (already used by test_afmoe_local_port.py, module_tree/test_deepseek_v3_local_port.py, ...), or pass an explicit tokenizer to GPTQModel.load().

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