Repository navigation
fix(gptq): harden the failed-quantize Hessian release and run the #5026 guards - #5054
Merged
Merged
Conversation
… guards `GPTQProcessor.process()` releases the task's `[C, C]` accumulator when `g.quantize()` raises (#5026). The release went through `g.release_hessian_state()` unconditionally, so a task double without that method - which is exactly how `tests/test_gptq_processor_hessian_lifetime_5026.py` probes the reference count - turns the original quantize error into `AttributeError: 'SimpleNamespace' object has no attribute 'release_hessian_state'`. That test fails on `main` today (`7fea67058`). Release through the method only when the task provides it, and log (rather than propagate) a teardown error so the exception that ended `quantize()` is always the one the caller sees. Also wire both #5026 regression files into the AWQ CPU `unit` lane. Neither was run by any workflow, which is how a stale `del g_h` from a duplicate PR could merge on top of the fix that removed the local and break every GPTQ quantize until it was found by hand. The lane's path filter already covers `gptqmodel/looper/**` and `gptqmodel/quantization/**`; add the test glob too. The `del g_h` half of the original report is already fixed on `main` (`f4511e735`); this commit carries only what is still missing.
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
Follow-up to the #5026 sequence (#5040, #5043, #5047). The
del g_hhalf of thereport is already fixed on
main(f4511e735), so this PR carries only what isstill broken. It replaces the closed #5050 with a narrower scope.
1. A #5026 regression file fails on
maintoday.process()releases thetask's
[C, C]accumulator wheng.quantize()raises, throughg.release_hessian_state()— unconditionally. The lifetime probe(
tests/test_gptq_processor_hessian_lifetime_5026.py) drives that path with aSimpleNamespacetask to count strong references, so the teardown raises andreplaces the
_StopInQuantizethe probe relies on:2. Neither #5026 test file is run by any workflow. That is how a stale
del g_hfrom a duplicate PR could merge on top of the fix that removed thelocal and break every GPTQ/GPTAQ/FOEM
quantize()withUnboundLocalError: cannot access local variable 'g_h'until it was found byhand.
What Changed
gptqmodel/looper/gptq_processor.py: the failure-path release goes throughrelease_hessian_state()only when the task provides it, and a teardown erroris logged instead of propagated, so the exception that ended
quantize()isalways the one the caller sees. Success path and numerics unchanged.
.github/workflows/awq_cpu.yml: theunitlane runs both [MEM] GPTQProcessor.process() keeps the task Hessian alive across g.quantize() (local g_h): GPTAQ/FOEM peak VRAM +784 MiB per layer on Llama-3.1-8B (6280 -> 5496 MiB with del g_h, bitwise identical) #5026 regressionfiles, and the pull-request path filter gains
tests/test_gptq_processor_hessian_*.py. The lane already triggers ongptqmodel/looper/**andgptqmodel/quantization/**, so a change to eitherfile now runs the guards that cover it.
Tests
On unmodified
origin/main(7fea67058, both files copied into a separateworktree):
tests/test_gptq_processor_hessian_release_5026.py(5 nodes)del g_hbreakage is already fixed on maintests/test_gptq_processor_hessian_lifetime_5026.py(1 node)AttributeError: 'SimpleNamespace' object has no attribute 'release_hessian_state'On this branch: 6 passed.
Neighbouring suites (CPU):
test_gptq_hessian_memory,test_gptq_shared_hessian,test_gptq_workspace_release,test_gptaq_foem_batch,test_gptaq_shuffle_pairing_4869,test_fallback_hessian_release,test_failed_run_model_state_5009,test_docs_contract_refs+ both #5026 filesThe single failure is the pre-existing
test_fallback_hessian_release.py::TestFallbackReleasesPartials::test_shared_input_fallback_releases_adopted_source_before_clone(
IndexError: list index out of range), identical onmainand unrelated.ruff checkclean on the changed Python file.Notes
ruffalso reports the staledel g_hasF821 Undefined name 'g_h'on thebroken revision, so the lint lane covers that class of breakage too. The gap
this PR closes is the test lane, which had neither file.
del g_hremoval with these two changes; thathalf is superseded by
f4511e735, so it is not repeated here.rebased onto each other instead of one being closed, which is how two halves
of one statement ended up merged. Closing the duplicate before merging avoids
that class of breakage.