Skip to content

test(load): pin the nested-checkpoint resave round trip (#5380) - #5498

Merged
Qubitium merged 1 commit into
mainfrom
fix/5380-resave-subfolder-source
Nov 19, 2026
Merged

Qubitium merged 1 commit into
mainfrom
fix/5380-resave-subfolder-source

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Fixes #5380.

Status: the code fix already landed, the regression did not

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. #5461 (abb84bf16, "resolve the wrapper checkpoint directory from subfolder") fixed exactly that: the wrapper now receives the resolved checkpoint directory.

Verified with the 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 (issue's commit) /tmp/... (the root) ValueError: Unrecognized model in /tmp/...
current main /tmp/.../gptq succeeds

So no production change is needed; this PR adds the regression the issue asked for ("a round trip can load the nested checkpoint, re-save it, then reload and compare packed tensors"), which tests/test_checkpoint_subfolder_resolution.py did not cover.

Test

New tests/test_nested_checkpoint_resave_5380.py (1 test, ~8 s on CPU):

  1. quantize a tiny Llama into root/gptq with RTNConfig (weight-only, no calibration data) and assert the root has no config.json to fall back to;
  2. load it through subfolder="gptq" and assert model_local_path resolves to the nested directory - the root cause;
  3. save() into a fresh directory, reload it, and compare every qweight/qzeros/scales tensor for exact equality.

Red -> green:

tree result
72cef9bac 1 failed at the model_local_path assertion
current main 1 passed

Regression: tests/test_checkpoint_subfolder_resolution.py + the new file -> 23 passed; uvx [email protected] check gptqmodel docs/eora tests setup.py -> clean.

CPU-only; no GPU needed.

`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`. #5461 resolved the
wrapper directory; this test locks the behaviour the issue asks for.

Quantize a tiny Llama into `root/gptq` with RTN, load it through the subfolder,
save it to a fresh directory, reload and compare every packed tensor. It also
asserts the wrapper keeps the directory the load selected, which is the root
cause, and that the repository root carries no config to fall back to.
@Qubitium
Qubitium merged commit db5bd1d into main Nov 19, 2026
6 checks passed
@Qubitium
Qubitium deleted the fix/5380-resave-subfolder-source branch November 19, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Saving a GPTQ checkpoint loaded through subfolder= reopens the wrong directory

1 participant