From 70a708d72610fe60f4c5760371fb1043248461ba Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 20 Sep 2024 02:31:44 -0400 Subject: [PATCH] Fix model merging issue. --- comfy/lora.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/lora.py b/comfy/lora.py index 61979e50..83e55ec0 100644 --- a/comfy/lora.py +++ b/comfy/lora.py @@ -414,7 +414,7 @@ def calculate_weight(patches, weight, key, intermediate_dtype=torch.float32): weight *= strength_model if isinstance(v, list): - v = (calculate_weight(v[1:], v[0].clone(), key, intermediate_dtype=intermediate_dtype), ) + v = (calculate_weight(v[1:], comfy.model_management.cast_to_device(v[0], weight.device, intermediate_dtype, copy=True), key, intermediate_dtype=intermediate_dtype), ) if len(v) == 1: patch_type = "diff"