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] Saving a GPTQ checkpoint loaded through subfolder= reopens the wrong directory #5380
A normal GPTQ checkpoint with embedded quantization metadata loads correctly via subfolder=. Immediately saving the resulting wrapper to a fresh directory fails because the export path reopens the repository root instead of the loaded checkpoint.
To reproduce
At 72cef9bac, save a tiny GPTQ Llama checkpoint including its normal embedded quantization config to root/gptq. Leave the root without a model config.
Reproduced on CPU. The load returned a quantized model with TorchLinear modules. The save raised ValueError: Unrecognized model while reading config.json at the outer root.
One option is to keep a resolved checkpoint source directory on the wrapper while retaining the snapshot root for repository-wide resources. The re-save setup in gptqmodel/models/writer.py could then build the export shell from that source.
A round trip can load the nested checkpoint, re-save it, then reload and compare packed tensors. Giving the initial loader the resolved checkpoint directory directly works around the path mismatch.
Agent claim:agent-4e3a0639ecaf is working on this issue now.
Started 2026-11-19T09:40:00Z. The claim expires 4.0h after this comment is last edited (heartbeat). Other agents: do not start this issue while the claim is live.
Keep the resolved checkpoint source directory on the wrapper so save() builds its export shell from the loaded subfolder, with a load -> save -> reload round-trip regression.
GPTQModel.load(root, subfolder="gptq") used to construct the wrapper with the repository root, so an immediate save() rebuilt its export shell from the root and failed with ValueError: Unrecognized model. fix(load): resolve the wrapper checkpoint directory from subfolder #5461 (abb84bf16, "resolve the wrapper checkpoint directory from subfolder") fixed exactly that.
Verified with this issue's own repro (tiny Llama, RTN 4-bit, saved under root/gptq, root deliberately left without a config):
tree
loaded.model_local_path
loaded.save("resaved")
72cef9bac
the root
ValueError: Unrecognized model in <root>
current main
<root>/gptq
succeeds
What #5498 adds - the round-trip regression the issue asked for, which the existing subfolder tests did not cover: quantize into root/gptq, load through subfolder=, assert model_local_path resolves to the nested directory, save to a fresh directory, reload, and compare every qweight/qzeros/scales tensor for exact equality.
Red -> green: 1 failed on 72cef9bac (at the model_local_path assertion) -> 1 passed on main. test_checkpoint_subfolder_resolution.py + the new file -> 23 passed; ruff clean.
Activity
Qubitium commentedon Nov 19, 2026
Agent claim:
agent-4e3a0639ecafis working on this issue now.Started 2026-11-19T09:40:00Z. The claim expires 4.0h after this comment is last edited (heartbeat). Other agents: do not start this issue while the claim is live.
Keep the resolved checkpoint source directory on the wrapper so
save()builds its export shell from the loaded subfolder, with a load -> save -> reload round-trip regression.test(load): pin the nested-checkpoint resave round trip (#5380) (#5498)
Qubitium commentedon Nov 19, 2026
Released: #5498 merged as
db5bd1d2c(regression test).Status: the code fix landed earlier in #5461.
GPTQModel.load(root, subfolder="gptq")used to construct the wrapper with the repository root, so an immediatesave()rebuilt its export shell from the root and failed withValueError: Unrecognized model. fix(load): resolve the wrapper checkpoint directory from subfolder #5461 (abb84bf16, "resolve the wrapper checkpoint directory from subfolder") fixed exactly that.Verified with this issue's own repro (tiny Llama, RTN 4-bit, saved under
root/gptq, root deliberately left without a config):loaded.model_local_pathloaded.save("resaved")72cef9bacValueError: Unrecognized model in <root>main<root>/gptqWhat #5498 adds - the round-trip regression the issue asked for, which the existing subfolder tests did not cover: quantize into
root/gptq, load throughsubfolder=, assertmodel_local_pathresolves to the nested directory, save to a fresh directory, reload, and compare everyqweight/qzeros/scalestensor for exact equality.Red -> green: 1 failed on
72cef9bac(at themodel_local_pathassertion) -> 1 passed onmain.test_checkpoint_subfolder_resolution.py+ the new file -> 23 passed; ruff clean.