Repository navigation
fix(loader/save): ported fp32 loads and remote-code metadata (#6136, #6134) - #6147
Merged
Merged
Conversation
…e-code metadata - Hunyuan-MoE and Zamba declare their construction-time fp32 router/A_log modules in _keep_in_fp32_modules_strict, so bf16 loads pass the mixed-dtype guard without weakening it (#6136). - The writer drops auto_map only for model types natively registered in Transformers. Package-owned ports keep the released auto_map, checkpoint .py files and released architecture name (#6134). Fixes #6136 Fixes #6134
Qubitium
marked this pull request as ready for review
November 27, 2026 11:07
This was referenced Nov 29, 2026
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
Fixes #6136
Fixes #6134
Two regressions introduced by #4620:
mlp.gate.wg) and Zamba-7B-v1 (mamba.A_log) therefore failed dense bf16 loads and Hunyuan's quantize load withoffload_to_disk=False.auto_mapand their.pyfiles, so their config can no longer be loaded outside GPTQModel #6134: the writer droppedauto_map(and did not copy checkpoint.pyfiles) for every non-trust_remote_codesave. That is only safe for model types Transformers registers natively; package-owned ports such as MiniCPM-V/o, InternVL-Chat, Ovis2.5 and DeepSeek-VL2 became unreadable byAutoConfig.from_pretrained(..., trust_remote_code=True). MiniCPM-o 2.6 also saved its internalMiniCPMO26class name instead of the releasedMiniCPMO.What Changed
gptqmodel/models/ports/native/hunyuan_v1_moe/modeling_hunyuan_v1_moe.py: declare_keep_in_fp32_modules_strict = ["mlp.gate.wg"].gptqmodel/models/ports/native/zamba/modeling_zamba.py: declare_keep_in_fp32_modules_strict = ["A_log"].gptqmodel/utils/hf.py: addis_transformers_native_config_type()backed by the Transformers 5.23CONFIG_MAPPING.gptqmodel/models/writer.py: add_preserve_remote_code_config(). It dropsauto_maponly for natively registered model types. For package ports it restores the sourceauto_map, copies the source checkpoint.pyfiles as data, and keeps the releasedarchitecturesname when the runtime class is a package-internal subclass. The rule is used by both the normal save and module-replacement save paths.tests/test_ported_fp32_load_6136.py: tiny released-config Hunyuan/Zamba bf16 checkpoints, Hunyuan quantize load withoffload_to_disk=False, declaration/matcher checks, and a corrupted-bf16-parameter control.tests/test_config_only_export.py: five-family writer round trip for MiniCPM-V, MiniCPM-o, InternVL-Chat, Ovis2.5 and DeepSeek-VL2, assertingauto_map, referenced.pyfiles,AutoConfigresolution and the released MiniCPM-o architecture.tests/test_minicpm_o_local_port.py: end-to-end RTN quantize +save()for MiniCPM-o 2.6 with the same assertions.tests/fixtures/ports/hunyuan_v1_moe/released_config.json,tests/fixtures/ports/zamba/released_config.json: released configs (data) used to build the tiny checkpoints.Tests
All green runs below use
cd /root/openai-audit/w-loader-metadata/testsandPYTHONPATH=/root/openai-audit/w-loader-metadata:/root/openai-audit/w-loader-metadata/tests.Red evidence at base
43b999585(isolated worktree/tmp/wt-6136-6134-base, with only the new tests/fixtures copied in):Skips
test_save_loaded_quantized_model.py: 1 skip —BACKEND.BITBLASunavailable (bitblasnot installed).test_minicpm_o_local_port.py: 3 skips — MiniCPM-o 2.6 TTS requires the optionalgptqmodel[minicpm-o]extra.einops/timm, which the brief venv does not include; the committed five-family writer test does not need them. A real tiny DeepSeek-VL2 RTN save +AutoConfigcheck passed when run with/root/openai-audit/.model-audit-depsonPYTHONPATH.CUDA_VISIBLE_DEVICES=4set as assigned.Model Support / Module Plan
Not applicable: no
MODEL_MAPentry, alias, definition or module-plan change. The only model-code edits are two_keep_in_fp32_modules_strictdeclarations on existing ports.AWQ onboarding safety
Not applicable: no model onboarding or AWQ grouping/search/replay/fold change.
Logic Flow Documentation
Not applicable: the writer change is a single metadata predicate (native vs. package-owned model type); it does not alter quantization, loading or tensor lifecycle control flow.
Review Requirements
auto_mapdrop test remains green; mixed-load control still raises).Kernel Accuracy Requirements
Not applicable: no kernel change.