From 38ed808658b3bafe2b6bd237b0f409b5489d6b5c Mon Sep 17 00:00:00 2001 From: qiaoce <542735830@163.com> Date: Fri, 21 Feb 2025 09:13:19 +0800 Subject: [PATCH] fix the bug 'Linear' object has no attribute 'weight_function' fix the bug 'Linear' object has no attribute 'weight_function' --- comfy/model_patcher.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/comfy/model_patcher.py b/comfy/model_patcher.py index 2c683320..208fee06 100644 --- a/comfy/model_patcher.py +++ b/comfy/model_patcher.py @@ -97,7 +97,7 @@ def wipe_lowvram_weight(m): m.comfy_cast_weights = m.prev_comfy_cast_weights del m.prev_comfy_cast_weights - if not hasattr(m, "weight_function"): + if hasattr(m, "weight_function"): m.weight_function = [] if hasattr(m, "bias_function"): @@ -781,6 +781,8 @@ class ModelPatcher: if move_weight: cast_weight = self.force_cast_weights m.to(device_to) + if not hasattr(m, "weight_function"): + m.weight_function=[] module_mem += move_weight_functions(m, device_to) if lowvram_possible: if weight_key in self.patches: