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] #4893 (fix of #4860) incomplete: after a cancelled/failed AWQ or QQQ quantize(), finished layers keep CUDA-only kernels on CPU (failure branch never runs rehome_quantized_kernel) -> next forward NotImplementedError #4947
#4893 (fix of #4860), and #4829/#4580 before it, made an in-session model usable after a cancelled or failed quantize(). The failure branch now restores the in-flight layer, restores the offloaded base modules and materializes the layers that were never reached (gptqmodel/looper/module_looper.py:2085-2112). It never calls rehome_quantized_kernel() (gptqmodel/models/base.py:640). The success path runs it at base.py:2627 (#4381/#4450): the quantize loop leaves packed layers on CPU, so AWQ/QQQ/GGUF modules packed with an accelerator-only kernel must be switched to the portable Torch kernel before any in-session forward.
After a cancel or failure, the layers that finished before the cancel point keep their CUDA-only kernel (AwqGEMMLinear, QQQLinear) while their weights sit on CPU behind the offload hooks. The next forward raises:
NotImplementedError: Could not run 'gptqmodel_awq::gemm_forward_fp32_reduce' with arguments from the 'CPU' backend.
GPTQ passes only because its pack kernel (TorchLinear) already runs on CPU. The cancel regression tests (test_cancelled_quantize_disk_offload_4807.py, test_cancelled_quantize_default_offload_4860.py, test_cancelled_quantize_layer_cleanup_4546.py) only use GPTQ.
It is the same at 0facf5f^ (before #4893), so this is not a regression from #4893. It is the part of the cancelled-run contract that #4546/#4807/#4829/#4860 left uncovered for the non-GPTQ methods. GGUF is in the same _IN_SESSION_KERNEL_METHODS set but runs through the weight-only looper. I did not drive a cancel there.
Suggested fix
At the end of the failure branch, after _materialize_unreached_meta_modules(), call rehome_quantized_kernel(self.gptq_model) best-effort: catch and log its "save and reload" RuntimeError so the original exception still propagates. Do the same in WeightOnlyLooper's failure branch. rehome_quantized_kernel already copes with offloaded modules (#4450).
Test that should have caught it
Parametrize tests/test_cancelled_quantize_default_offload_4860.py (and the #4807 test) over METHOD.AWQ and METHOD.QQQ on CUDA, and assert a finite in-session forward after the cancel.
Severity
Medium: for AWQ and QQQ, the documented "cancelled quantize leaves a usable model" guarantee does not hold on any cancel or failure, with either default offload or the cancel-at-last-layer case.
Finish #4893: after a cancelled/failed AWQ or QQQ quantize(), finished layers keep CUDA-only kernels on CPU so the failure path leaves an unrunnable model; rehome or restore those layers in the failure cleanup and test both methods.
Activity
Qubitium commentedon Nov 17, 2026
Agent claim released:
agent-53ba17eb4d83finished this issue.Pull request: #4979
Finish #4893: after a cancelled/failed AWQ or QQQ quantize(), finished layers keep CUDA-only kernels on CPU so the failure path leaves an unrunnable model; rehome or restore those layers in the failure cleanup and test both methods.
fix(looper): rehome finished layers' kernels after a failed quantize (#…
Merge origin/main into fix/issue-4937
fix(weight-only): return the in-flight layer to its home device on fa…
fix(looper): leave a cancelled quantize() with a runnable model (Mode…