Repository navigation
fix(deepseek_v41): consume the loader checkpoint-selection hand-off - #6385
Merged
Merged
Conversation
#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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6381
Summary
tests/module_tree/test_deepseek_v41_flash.pywas red onorigin/main(0dd8e8abf) with 7 failed, 9 errors, 4 passed, 5 skipped. All 16 non-passing nodes raised:#6272(commit968e74c81) made the public entry points resolve one immutableCheckpointSelectionand hand it to the model definition under_gptqmodel_checkpoint_selection. The genericBaseQModel.from_quantizedconsumes it, butDeepSeekV41FlashQModelis the only definition that overridesfrom_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/modelasset is involved.What Changed
gptqmodel/models/definitions/deepseek_v41_flash.py: popINTERNAL_CHECKPOINT_SELECTION_KWARGand reusecheckpoint_selection.hub_kwargsfor the config, shards, and tokenizer reads. Callers that do not supply a hand-off keep the previousget_config_selection_kwargs()path.tests/module_tree/test_deepseek_v41_flash.py: new regression testtest_v41_load_reuses_the_public_checkpoint_selectionthat loads a nested checkpoint throughGPTQModel.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 differentrms_norm_eps, so accepting-and-ignoring the record is caught too.Tests
Red evidence (same test file;
633c2f1e8is the parent of#6272):633c2f1e8(pre-#6272)0dd8e8abf(HEAD, pre-fix)deepseek_v41_flash.py:98with the sameTypeError; no other exception type appears.FAILED ... TypeError: Unsupported ... _gptqmodel_checkpoint_selection.FAILED ... AssertionErrorat themodel_local_pathassertion, proving the record is reused (the root decoy loads otherwise).Green:
Full
tests/module_tree/(CPU, same command on base and head):0dd8e8abf609637b26The +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_MAPentry, alias, module-tree path, role/tag, method override, or fusion eligibility change. The existing model-specific module-plan tests ran in the fulltests/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
Kernel Accuracy Requirements
Not applicable: no kernel, dispatch, pack/load/fusion, or linear-bias change.
Notes
#6381).DeepSeekV41FlashQModel.from_pretrainedforwards tofrom_quantized, so both public entry points are covered by the same pop; thefrom_pretrainedpath was also smoke-tested locally (passed).