Skip to content

test(fixtures): ship a usable tokenizer in the DiffusionGemma tied-decoder reload fixture (#6386) - #6433

Merged
Qubitium merged 1 commit into
mainfrom
test/fixtures-usable-tokenizers
Nov 29, 2026
Merged

Qubitium merged 1 commit into
mainfrom
test/fixtures-usable-tokenizers

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Summary

#6386 makes GPTQModel.load reject a checkpoint that has no usable tokenizer. tests/models/test_diffusion_gemma.py::test_quantized_checkpoint_reloads_with_tied_decoder saves its tiny DiffusionGemma source with save_pretrained and no tokenizer, so on current main (a4471c53b) it fails during fixture setup, before the #5514/#5716 tied-decoder reload path runs:

ValueError: Tokenizer files are missing from `<tmp>/source`: expected `tokenizer.json`, `tokenizer_config.json`, or `vocab.json` ... (loaded tokenizer: 5 token(s), model `vocab_size=64`)

The other rejected fixtures from the same sweep (5831, 4869, 5026, 4747, 4741, 5209/4204, fp8, 5218, the AWQ VL rotary test) are already covered by the open draft #6420 (#6404). This PR fixes the one rejected fixture that #6420 does not touch, so the two PRs don't overlap.

What Changed

Tests

  • Unit tests have been executed and passed.
  • New unit test: not applicable. This repairs an existing regression test's fixture. Below is red/green evidence plus a mutation showing the repaired test still detects its target defect.
export PYTHONPATH=<clone> HF_HOME=/root/.cache/huggingface CUDA_VISIBLE_DEVICES=""
N="tests/models/test_diffusion_gemma.py::test_quantized_checkpoint_reloads_with_tied_decoder"
/root/venv/bin/python -P -m pytest -p no:cacheprovider -q $N
# origin/main a4471c53b:  1 failed  (ValueError: Tokenizer files are missing ...)
# this branch:            1 passed in 12.36s

# Scratch mutation (reverted afterwards): `return 0` at the top of
# gptqmodel/models/definitions/diffusion_gemma.py::_sync_decoder_quantized_modules,
# so the decoder no longer shares the quantized encoder projections.
# this branch + mutation: 1 failed
#   AssertionError: assert Linear(in_features=64, out_features=64, bias=False) is TorchCpuAvx512Linear()

bash format/check.sh: All checks passed! (ruff 0.14.2).

Not run: TestDiffusionGemma::test_diffusion_gemma (same file) quantizes the full 26B checkpoint. This change doesn't touch it.

Measured Impact

Not applicable: test-fixture-only change.

Model Support / Module Plan

Model test node IDs and results: not applicable. No model, alias, definition or module plan changes.

AWQ onboarding safety

Not applicable: AWQ is not touched.

Logic Flow Documentation

Not applicable: no control flow or decision mechanism changes. Only a test fixture gains a tokenizer file.

Review Requirements

  • Reviewed this PR.
  • Checked that the code matches existing project structure, APIs, and conventions (reuses tests/tiny_tokenizer.py as test(fixtures): ship usable tokenizers in #6386-rejected fixtures #6407 did).
  • Avoided unnecessary monkeypatching.
  • Minimized and compacted the impacted code surface (4 lines in one test file).
  • Considered and eliminated potential regressions (no other test imports this fixture).

Kernel Accuracy Requirements

Not applicable: no kernel changes.

Notes

Cross-check of #6420 at head 442c6a07a (read-only, CPU plus one GPU for CUDA-gated nodes). On the full list of rejected nodes it gives 47 passed, 1 skipped (free-threaded-only test_model_load_lock_4204 node). The one failure left is this DiffusionGemma node. With #6420's fixtures, scratch mutations of the library under test still turn the capture-reuse tests red:

  • _reusable_initial_capture returning None: 5831 test_initial_capture_runs_once_per_batch[*] and test_reused_capture_matches_double_capture[*] fail with 12 == 6.
  • Dropping the copy.deepcopy: test_reused_capture_matches_double_capture[*] (packed qweight differs) and test_reused_cache_is_a_private_copy fail.
  • Dropping the _model_initial_capture_is_generic gate: test_model_capture_override_disables_reuse fails with 6 == 12.
  • Binding the processors to the raw dataset so each one re-prepares sort="shuffle": all three 4869 nodes fail (order mismatch, layer-0 dXXT 334.26, and RuntimeError: The size of tensor a (144) must match ... (88)).

test_transformers_unpatched.py::test_gptqmodel_leaves_third_party_libraries_unpatched, module_tree/test_inkling2_loop_plan.py::test_inkling2_loop_public_loader_uses_local_code_and_checkpoint_keys and test_hf_bridge_cpu_offload_5022.py (27 nodes, CUDA) already pass on main.

🤖 Generated with Claude Code

…coder reload fixture

#6386 rejects a checkpoint without a usable tokenizer, and
`test_quantized_checkpoint_reloads_with_tied_decoder` saves its tiny
DiffusionGemma source with `save_pretrained` only, so `GPTQModel.load` fails
at fixture setup ("Tokenizer files are missing") before the #5514/#5716
reload path is reached.

Write `tests/tiny_tokenizer.py::write_tiny_tokenizer` next to the model, as
#6407 did. `vocab_size=60` keeps every tokenizer id below the config's
image/boi/eoi ids (60-62); the calibration rows and forward inputs are
pre-tokenized ids 1-56, so the test still feeds exactly the same data.

The remaining files from the same sweep are covered by the open draft #6420
(#6404); this is the one rejected fixture it does not touch.

No product code changes; the #6386 check is exercised as-is.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Qubitium
Qubitium marked this pull request as ready for review November 29, 2026 20:10
@Qubitium
Qubitium merged commit 33ed7a6 into main Nov 29, 2026
6 checks passed
@Qubitium
Qubitium deleted the test/fixtures-usable-tokenizers branch November 29, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant