From 5acdadc9f3a62eabf363f96f12797d45343635ca Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 9 Aug 2024 03:58:28 -0400 Subject: [PATCH] Fix issue with some lowvram weights. --- comfy/model_patcher.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/comfy/model_patcher.py b/comfy/model_patcher.py index 0615e0a4..5577ca4b 100644 --- a/comfy/model_patcher.py +++ b/comfy/model_patcher.py @@ -393,10 +393,13 @@ class ModelPatcher: if m.comfy_cast_weights: wipe_lowvram_weight(m) - if hasattr(m, "weight"): + param = list(m.parameters()) + if len(param) > 0: mem_counter += comfy.model_management.module_size(m) - if m.weight is not None and m.weight.device == device_to: + weight = param[0] + if weight.device == device_to: continue + self.patch_weight_to_device(weight_key) #TODO: speed this up without OOM self.patch_weight_to_device(bias_key) m.to(device_to)