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] RTN format=GEMM + default offload still crashes in AWQ pack: weight-only looper leaves counterless source Parameters (#6539 follow-up) #6595
Follow-up to #6539 / #6564, which fixed one consumer only. RTNConfig(format=FORMAT.GEMM) (RTN exported in AWQ layout) with the default offload_to_disk=True still crashes on current main (2a87e13), in the AWQ packer:
weight_only_looper.py _finalize_quantized_module -> weight_only_processor.submodule_finalize
-> utils/model.py pack_module -> nn_modules/qlinear/torch_awq.py pack: weight.t()
RuntimeError: Inference tensors do not track version counter.
The issue was reported in the #6564 / #6539 comments; the reproduction is below.
Repro
importtorchfromgptqmodelimportGPTQModelfromgptqmodel.quantizationimportFORMAT, RTNConfigm=GPTQModel.load("Qwen/Qwen2.5-0.5B-Instruct", RTNConfig(bits=4, group_size=128, sym=False, format=FORMAT.GEMM),
device="cuda:0", dtype=torch.float16)
m.quantize() # RuntimeError: Inference tensors do not track version counter.
tests/test_awq_variable_length_ppl.py::test_awq_beats_rtn_with_variable_length_calibration fails the same way. CPU and CUDA are both affected. offload_to_disk=False works.
Root cause (producer)
Tracing one module: after pre_quantize, the layer's q_proj.weight is an inference tensor, materialized by the lazy source under inference_mode. WeightOnlyLooper._move_named_module_to_cpu then rebinds it with .data = outside inference mode. The result is the #4572 state: is_inference() == False and no version counter. Every consumer that views the tensor raises:
Repair the producer state once, before finalize. In WeightOnlyLooper._finalize_quantized_module, call replace_inference_parameters(named.module) under inference_mode(False) before pack and offload. This is the existing #4450/#4572 helper, and it only clones parameters that lack a counter.
Activity