From a724e532b0dff619820deda5fb84622f081b3a9e Mon Sep 17 00:00:00 2001 From: ZX-ModelCloud Date: Sun, 28 Sep 2025 16:13:29 +0800 Subject: [PATCH 1/2] fix UnboundLocalError: cannot access local variable 'layer_output' where it is not associated with a value Signed-off-by: ZX-ModelCloud --- gptqmodel/looper/module_looper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gptqmodel/looper/module_looper.py b/gptqmodel/looper/module_looper.py index 517d065fb..618b02bd1 100644 --- a/gptqmodel/looper/module_looper.py +++ b/gptqmodel/looper/module_looper.py @@ -349,7 +349,7 @@ def loop(self, fail_safe: bool = False, **kwargs): if hasattr(subset[name], 'forward_hook'): original_hook = processor.pre_process_fwd_hook(name) subset[name].forward_hook = self._masked_hook_wrapper(processor, original_hook) - if is_last: + if is_last and processor.fwd_after_process: subset[name].forward_hook_last = True else: # Older registration path From b93052e06f66a6ce2e28405fd39eff3126c88a89 Mon Sep 17 00:00:00 2001 From: ZX-ModelCloud Date: Sun, 28 Sep 2025 16:14:28 +0800 Subject: [PATCH 2/2] Fix "dXXT" / "H" initialization for gptqv2 Signed-off-by: ZX-ModelCloud --- gptqmodel/quantization/gptqv2.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gptqmodel/quantization/gptqv2.py b/gptqmodel/quantization/gptqv2.py index e1b180d11..64d305765 100644 --- a/gptqmodel/quantization/gptqv2.py +++ b/gptqmodel/quantization/gptqv2.py @@ -28,6 +28,7 @@ def __init__(self, module: NamedModule, qcfg: Optional[QuantizeConfig] = None): super().__init__(module, qcfg) + self.H = None self.dXXT = None self.native_inps = module.state.pop(NATIVE_INPUTS_STATE_KEY)