Skip to content

fix(deepseek_v41): consume the loader checkpoint-selection hand-off - #6385

Merged
Qubitium merged 1 commit into
mainfrom
fix/6381-deepseek41-tests
Nov 29, 2026
Merged

Qubitium merged 1 commit into
mainfrom
fix/6381-deepseek41-tests

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Fixes #6381

Summary

tests/module_tree/test_deepseek_v41_flash.py was red on origin/main (0dd8e8abf) with 7 failed, 9 errors, 4 passed, 5 skipped. All 16 non-passing nodes raised:

TypeError: Unsupported DeepSeek V4.1 Flash load arguments: _gptqmodel_checkpoint_selection

#6272 (commit 968e74c81) made the public entry points resolve one immutable CheckpointSelection and hand it to the model definition under _gptqmodel_checkpoint_selection. The generic BaseQModel.from_quantized consumes it, but DeepSeekV41FlashQModel is the only definition that overrides from_quantized, and it was not updated: its strict keyword check rejected the internal argument before reading the checkpoint. This was a product regression, not a stale test or a missing checkpoint — the fixture is a self-contained synthetic checkpoint and no /monster/data/model asset is involved.

What Changed

  • gptqmodel/models/definitions/deepseek_v41_flash.py: pop INTERNAL_CHECKPOINT_SELECTION_KWARG and reuse checkpoint_selection.hub_kwargs for the config, shards, and tokenizer reads. Callers that do not supply a hand-off keep the previous get_config_selection_kwargs() path.
  • tests/module_tree/test_deepseek_v41_flash.py: new regression test test_v41_load_reuses_the_public_checkpoint_selection that loads a nested checkpoint through GPTQModel.load(parent, subfolder="nested") and directly through the definition with only the hand-off naming the child. A valid decoy checkpoint at the root carries a different rms_norm_eps, so accepting-and-ignoring the record is caught too.
  • No public API change. No follow-up work is required.

Tests

Red evidence (same test file; 633c2f1e8 is the parent of #6272):

Revision Result
633c2f1e8 (pre-#6272) 20 passed, 5 skipped
0dd8e8abf (HEAD, pre-fix) 7 failed, 9 errors, 4 passed, 5 skipped
  • All 16 pre-fix nodes fail at deepseek_v41_flash.py:98 with the same TypeError; no other exception type appears.
  • New test against the pre-fix definition: FAILED ... TypeError: Unsupported ... _gptqmodel_checkpoint_selection.
  • New test against a pop-but-ignore variant: FAILED ... AssertionError at the model_local_path assertion, proving the record is reused (the root decoy loads otherwise).

Green:

cd tests
CUDA_VISIBLE_DEVICES="" PYTHONPATH=<clone>:<clone>/tests python -m pytest module_tree/test_deepseek_v41_flash.py -q -rs -p no:cacheprovider
# 21 passed, 5 skipped in 5.25s

CUDA_VISIBLE_DEVICES="" PYTHONPATH=<clone>:<clone>/tests python -m pytest test_deepseek_v41_local_port.py -q -rs -p no:cacheprovider
# 11 passed in 5.96s

Full tests/module_tree/ (CPU, same command on base and head):

Run Passed Failed Errors Skipped xfailed Time
base 0dd8e8abf 3418 7 9 812 2 13:28
head 609637b26 3435 0 0 812 2 13:42

The +17 passes are the 16 repaired nodes plus the new regression test. Every failure/error in the base run belonged to this file; no other module_tree/ file regressed.

Ruff:

/root/venv/bin/ruff check gptqmodel/models/definitions/deepseek_v41_flash.py tests/module_tree/test_deepseek_v41_flash.py
# All checks passed!

Skips (5, all pre-existing and CUDA-only):

  • test_v41_cuda_load_runs_packed_projections — NVIDIA CUDA compute capability 8.0 or later is required.
  • test_v41_q4nx_selected_projection_quantization — Q4NX encoding requires NVIDIA CUDA.
  • test_v41_q4nx_native_routing_matches_expert_order[2.5/3.0/3.5-128] — DeepSeek V4.1 Q4NX routing requires NVIDIA SM80+.

CPU did not exercise the CUDA-only paths above; they remain unverified on this host.

Measured Impact

Not applicable: loader-correctness fix, no VRAM/performance/accuracy metric changes.

Model Support / Module Plan

Not applicable: no new MODEL_MAP entry, alias, module-tree path, role/tag, method override, or fusion eligibility change. The existing model-specific module-plan tests ran in the full tests/module_tree/ run above and pass.

Model test node: module_tree/test_deepseek_v41_flash.py::test_v41_module_plan_accounts_for_loaded_decoder_weights — passed (was one of the 9 errors).

AWQ onboarding safety

Not applicable: no model onboarding or AWQ grouping/search/replay/fold change.

Logic Flow Documentation

Not applicable: this is a local fix that restores the hand-off contract introduced by #6272. The public entry point still resolves the selection exactly once; the definition now consumes that record instead of rejecting it. No new decision mechanism, resolution order, or fallback is introduced, so no Mermaid diagram or docs page is required.

Review Requirements

  • Reviewed this PR.
  • Checked that the code matches existing project structure, APIs, and conventions.
  • Avoided unnecessary monkeypatching and used the project's normal extension points where possible.
  • Minimized and compacted the impacted code surface.
  • Considered and eliminated potential regressions.

Kernel Accuracy Requirements

Not applicable: no kernel, dispatch, pack/load/fusion, or linear-bias change.

Notes

  • The issue was filed from the same diagnosis as this PR (#6381).
  • DeepSeekV41FlashQModel.from_pretrained forwards to from_quantized, so both public entry points are covered by the same pop; the from_pretrained path was also smoke-tested locally (passed).

#6272 moved checkpoint selection into one immutable record passed to model
definitions under `_gptqmodel_checkpoint_selection`. DeepSeekV41FlashQModel is
the only definition that overrides from_quantized, and it treated the internal
kwarg as an unsupported user argument, so every V4.1 load raised TypeError
(7 failed + 9 errors in tests/module_tree/test_deepseek_v41_flash.py).

Pop the hand-off and reuse its hub_kwargs for the checkpoint, config, and
tokenizer reads. Add a regression test that loads a nested checkpoint through
GPTQModel.load and directly through the definition; a valid decoy checkpoint at
the root proves the handed-off record is reused, not merely accepted.

Fixes #6381
@Qubitium
Qubitium marked this pull request as ready for review November 29, 2026 12:52
@Qubitium
Qubitium merged commit 390a032 into main Nov 29, 2026
6 checks passed
@Qubitium
Qubitium deleted the fix/6381-deepseek41-tests branch November 29, 2026 12:52
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.

[BUG] DeepSeek V4.1 Flash rejects the loader checkpoint-selection hand-off: all 16 model-loading module_tree nodes red

1 participant