You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] GPTQModel.export(): unknown formats silently "succeed", trust_remote_code is dropped on the non-hf path, and hf exports keep quantize_config.json, so the dense output can't be reloaded #4386
Severity: medium-low. Status: all three parts confirmed on CPU at def6e61. Kind: new bug. #4053 item 7 fixed only the dequant routing of the hf format.
GPTQModel.export("<GPTQ ckpt>", "out", "HF") behaves the same as an uppercase name, a typo, or "gguf":
the full quantized model is loaded;
there is no branch for the format, so only the tokenizer is written (['chat_template.jinja','tokenizer.json','tokenizer_config.json']);
the call returns None with no error.
Expected:ValueError for any format other than hf / mlx.
b. trust_remote_code is dropped
GPTQModel.export("<remote-code GPTQ ckpt, e.g. GRIN-MoE-gptq-4bit>", "out", "mlx", trust_remote_code=True) raises ValueError: ... contains custom code which must be executed. The cause is that auto.py:1178 calls GPTQModel.load(model_id_or_path, backend=backend) without forwarding trust_remote_code.
c. The dense hf export keeps quantization metadata
The export correctly removes quantization_config from config.json, and the dense weights are correct (HF PPL 5.583, against 5.584 for the quantized model).
However, it still copies quantize_config.json and quant_log.csv from the source.
So GPTQModel.load(export_dir) takes the QUANT_CONFIG_FILENAME branch (auto.py:907-911) and fails with ValueError: Missing required quantized weights ... model.layers.0.mlp.down_proj.qweight.
Trying to re-quantize the export with quantize_config=QuantizeConfig(bits=4) fails the same way, because the call is routed to from_quantized.
Expected: leave quantize_config.json, quant_config.json and quant_log.csv out of the dense output.
Also, unrelated but small
gptqmodel/models/base.py:2899 does raise f"{...} does not support the to() method". Raising a plain string fails with TypeError: exceptions must derive from BaseException instead of the intended message. This path is only reached when the wrapped model has no .to; the finding is from code reading only.
Found during an AI-assisted review (Claude Code, round 12) of def6e61; repros were run at that commit (A/B against 842d666 where noted) on RTX 4090/5090 (CUDA 13) and/or Radeon AI PRO R9700 (ROCm) unless marked static/suspected.
Activity
Qubitium commentedon Nov 16, 2026
Claimed. This issue is now owned by a dedicated worker; a fix PR referencing it will follow. Please avoid duplicating work on it in the meantime.
fix(export): fail closed on unknown formats and keep dense exports lo…