Repository navigation
test(load): pin the nested-checkpoint resave round trip (#5380) - #5498
Merged
Merged
Conversation
`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.
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.
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 immediatesave()rebuilt its export shell from the root and failed withValueError: 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):loaded.model_local_pathloaded.save("resaved")72cef9bac(issue's commit)/tmp/...(the root)ValueError: Unrecognized model in /tmp/...main/tmp/.../gptqSo 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.pydid not cover.Test
New
tests/test_nested_checkpoint_resave_5380.py(1 test, ~8 s on CPU):root/gptqwithRTNConfig(weight-only, no calibration data) and assert the root has noconfig.jsonto fall back to;subfolder="gptq"and assertmodel_local_pathresolves to the nested directory - the root cause;save()into a fresh directory, reload it, and compare everyqweight/qzeros/scalestensor for exact equality.Red -> green:
72cef9bacmodel_local_pathassertionmainRegression:
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.