Repository navigation
chore(models): delete the test-only ds4rt per-model calibration adapters - #6408
Merged
Merged
Conversation
ds4rt is deprecated and is being refactored into method-agnostic features. The per-model calibration adapters it added (#3606-#3616) have no production caller: nothing in gptqmodel/ or scripts/ imports them, MODEL_MAP reaches none of them, and only their own doc pages and unit tests cite them. Delete 14 adapter utils plus exl3_hessian.py (its only user was kimi_k31): kimi_k3, kimi_k3_core_format, kimi_k3_core_stream, kimi_k31, glm5_core, glm5_mtp, glm5_flash_core, glm5_flash_mtp, step5_core, v41_capture, v41_checkpoint, v41_mixed_replay, v41_recovery and v41_routed_batch, with their 9 dedicated test files, their 9 doc pages and the index links. This also removes two policy violations that lived only in this code: step5_core.py ran an external families/step5/golden.py through exec_module with no trust_remote_code / GPTQ_BYPASS_SAFETY_CHECKS gate, and glm5_flash_core.py replaced chunk_kimi_delta_attention on the vendored glm5_next port module. The GPTQMODEL_KIMI_K3_UTILS env var in test_kimi_k3_support.py, which exec'd an arbitrary file, goes too. Kept: - ple_mmap.py: used by the deepseek_v41_flash port and definitions/deepseek_v41. - v41_source, v41_replay, v41_inputs, v41_dspark, v41_native: imported by tests/test_deepseek_v41_local_port.py, test_v41_checkpoint_mapped_ple.py and (v41_native) ports/deepseek_v41. They go with the separate ports/deepseek_v41 removal. - Tests of live code that lived in deleted files move to test_exl3_bitstream_oracle.py (ExllamaV3TorchLinear bitstream decode) and test_exllamav3_padded_output.py (ExllamaV3Linear padded output crop). The Kimi K3 definition, auto.py, kimi_linear.py and docs no longer point at the deleted "bounded KimiK3Source runner"; the NotImplementedError types and the substrings the tests match are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Qubitium
marked this pull request as ready for review
November 29, 2026 14:25
Qubitium
pushed a commit
that referenced
this pull request
Nov 29, 2026
This was referenced Nov 29, 2026
Merged
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.
Summary
ds4rt is deprecated and is being refactored into method-agnostic features (maintainer decision). This is PR-D1 of that plan. It deletes the per-model calibration adapters that ds4rt added in #3606-#3616. None of them has a production caller: nothing in
gptqmodel/orscripts/imports them,MODEL_MAPreaches none of them, and only their own doc pages and unit tests cite them. It is a pure deletion with no behavior change for any public API, model definition, quantize/pack/save/load path or checkpoint format.Net: 49 files changed, 129 insertions(+), 5739 deletions(-). That breaks down as gptqmodel +8/-2,810, tests +115/-2,594 and docs +6/-335.
What Changed
gptqmodel/utils/:kimi_k3,kimi_k3_core_format,kimi_k3_core_stream,kimi_k31glm5_core,glm5_mtp,glm5_flash_core,glm5_flash_mtpstep5_corev41_capture,v41_checkpoint,v41_mixed_replay,v41_recovery,v41_routed_batchexl3_hessian, whose only importer waskimi_k31test_glm5_core.py,test_glm5_core_cuda.py,test_glm5_flash_core.py,test_glm5_mtp.pytest_step5_core.pytest_kimi_k31.py,test_kimi_k3_core_stream.pytest_v41_routed_capture.pytest_exl3_hessian_accumulator.pytest_kimi_k3_core_cuda.py→test_exl3_bitstream_oracle.py. It keeps the CPU clean-room trellis decoder oracle forExllamaV3TorchLinear._unpack_indices/get_inner_weight_tensor.test_kimi_k3_core_format.py→test_exllamav3_padded_output.py. It keeps the twoExllamaV3Linear128-channel padded-output crop and logical-shape rejection tests.test_kimi_k3_support.py: dropped theutilsfixture and its 9KimiK3Source/decode_mxfp4/situ/prepare_moecases. TheGPTQMODEL_KIMI_K3_UTILSenv var, which exec'd an arbitrary file, goes with them. The registry, module-plan, fail-closed and latent-MoE oracle cases stay.test_e8m0_default_dtype_5297.py,test_ldexp_cross_device_5263.py: dropped thekimi_k3.decode_mxfp4cases. The livedecode_e8m0_scaleand EXL3 prescale cases stay.test_v41_checkpoint_mapped_ple.py: dropped thev41_checkpoint/v41_routed_batchfrontier cases. TheMappedPLETableandV41DSparkInputcases stay.kimi-k3-native-source,kimi-core-calibration,kimi-k31-calibration,glm-core-calibration,glm-native-mtp,glm-flash-native-calibration,step5-native-calibration,v41-routed-calibration,v41-durable-frontiers.docs/README.mdanddocs/proposed-feature-reference-pages.md.kimi_k3.pyrows fromdocs/trust-remote-code-isolation.md.supported-models.mdandtransformers-5-compat.mdno longer mention the "bounded KimiK3Source runner".definitions/kimi_k3.py,definitions/kimi_linear.py,models/auto.py): the docstring, comments and threeNotImplementedErrormessages no longer point at the deleted runner. The exception types and the substrings that tests match (prefix_sum and block_residual,AttnRes) are unchanged.utils/ple_mmap.pyis live:ports/deepseek_v41_flash/engram.py:12anddefinitions/deepseek_v41.py:13import it.utils/v41_source.py,v41_replay.py,v41_inputs.py,v41_dspark.py,v41_native.py(793 lines). They belong to theports/deepseek_v41+definitions/deepseek_v41.pystack, which is approved for removal in its own PR. Deleting them here would break that stack's imports:tests/test_deepseek_v41_local_port.py:31-32importsV41ReplayBatch/V41Source.V41Source.load_main_input,load_dspark_inputandload_decoded_blocklazily importv41_inputs,v41_dsparkandv41_native.test_v41_checkpoint_mapped_ple.pyimportsV41DSparkInput.v41_nativeitself importsports/deepseek_v41.docs/v41-native-source.mdanddocs/v41-dspark-replay.mdstay with them.definitions/deepseek_v41.py,ports/deepseek_v41/and the DSv4/GLM MTP calibration stack are untouched. None of the deleted modules is imported by any of them.Tests
MODEL_MAPis identical.Environment: CPU only (
CUDA_VISIBLE_DEVICES="",HF_HUB_OFFLINE=1), torch 2.15, transformers 5.23.0.python -Pwith each tree first onPYTHONPATH.gptqmodel.__file__was printed for each run and resolves to the tree under test.Zero remaining references (repo-wide
git grep -nP, 0 matches):Structural A/B (main 6b25d2c vs branch). The script records
MODEL_MAP(key → definition qualname,module_tree,loader) and then imports everygptqmodel.*module found bypkgutil.walk_packages:Pytest A/B, per-node junit outcomes on main vs branch:
Every CPU test file that imports something near the deleted modules, plus the docs contract test. Run at 6b25d2c vs this head,
-n 4:tests/test_docs_contract_refs.pynodes all pass on both trees.The
tests/module_treesuite plustests/test_docs_contract_refs.py,-n 8. Run at b1fdd38 vs this change before the rebase. The rebase onto 6b25d2c pulled 4 commits that touch none of this PR's files.Failures present on both main and branch (not caused by this PR, left alone):
tests/test_transformers_unpatched.py::test_gptqmodel_leaves_third_party_libraries_unpatched: the GPTQ v1 fixture fails inload_hf_tokenizer.tests/module_tree/test_deepseek_v41_flash.py: 8 failed and 9 errors, allTypeError: Unsupported DeepSeek V4.1 Flash load arguments: tokenizer.tests/module_tree/test_registered_module_plans.py::...[gemma4]and[gemma4_text]: the registered plan changed.tests/module_tree/test_inkling2_loop_plan.py::test_inkling2_loop_public_loader_uses_local_code_and_checkpoint_keys: the tiny tokenizer cannot encode text.Skips and what they leave unverified:
test_glm5_core_cuda.py(10),test_glm5_mtp.py(6) andtest_kimi_k3_core_cuda.py(6).test_e8m0_default_dtype_5297.py,test_ldexp_cross_device_5263.pyandtest_exllamav3_torch_padding.pytest_ldexp_cross_device_5263.pytest_kimi_k3_local_port.py(7): the pinned tokenizer asset is not cachedbash format/check.sh # ruff 0.14.2: All checks passed!Measured Impact
Not applicable: unreachable code was deleted, and no runtime path changed.
Model Support / Module Plan
Not applicable: no
MODEL_MAPentry, alias, module tree or fusion eligibility changes.MODEL_MAPis identical before and after (structural A/B above), andtests/module_treegives identical per-node outcomes. The only definition edits are theKimiLinearQModeldocstring and error-message strings.Model test node IDs and results:
tests/module_treeas above (identical outcomes on 4,483 common nodes).AWQ onboarding safety
Not applicable: no definition structure, AWQ grouping, search, replay or fold change.
KimiLinearQModel.awq_get_modules_for_scalingstill raisesNotImplementedError; only the message text changed.Logic Flow Documentation
Diagram summary: not applicable. Code with no caller is deleted and no decision mechanism is replaced. The one Mermaid node that named the deleted runner (
docs/transformers-5-compat.md) now readsquantize() fails closed, which is what the code does.Review Requirements
I or an AI agent (such as Codex or Claude) have:
Kernel Accuracy Requirements
Not applicable: no kernel changes. The two preserved EXL3 tests run on CPU and pass unchanged.
Notes
gptqmodel/utils/step5_core.py:136-170loaded<reference_root>/families/step5/golden.pythroughimportlib.util.spec_from_file_location+exec_module. It inserted that root atsys.path[0]permanently and importedshape_invariant.install(). None of this had atrust_remote_codeorGPTQ_BYPASS_SAFETY_CHECKSgate (fix(security): gate checkpoint code imports on trust_remote_code (#3968) #3981 gated kimi_k3/kimi_k31 but missed this file).gptqmodel/utils/glm5_flash_core.py:71-74(install_bounded_kda) permanently replacedchunk_kimi_delta_attentionon the vendoredgptqmodel/models/ports/native/glm5_next/modeling_glm5_next.pymodule. That is a monkeypatch of a model module.tests/test_kimi_k3_support.py:25readGPTQMODEL_KIMI_K3_UTILSand exec'd the file it named.ports/deepseek_v41+definitions/deepseek_v41.pyshould also deleteutils/v41_{source,replay,inputs,dspark,native}.py,docs/v41-native-source.md,docs/v41-dspark-replay.md,tests/test_deepseek_v41_local_port.pyand theV41DSparkInputcase intests/test_v41_checkpoint_mapped_ple.py.🤖 Generated with Claude Code