From 79f8a8aa8bef2286f1dd90af7a4e664d42bc22e5 Mon Sep 17 00:00:00 2001 From: Jedrzej Kosinski Date: Wed, 6 Aug 2025 12:59:25 -0700 Subject: [PATCH] Fixed device mismatch issue for ControlNet++, SparseCtrl, and SVDControlNet --- adv_control/control.py | 4 ++-- adv_control/control_plusplus.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/adv_control/control.py b/adv_control/control.py index c15fd17..eb71b0f 100644 --- a/adv_control/control.py +++ b/adv_control/control.py @@ -326,7 +326,7 @@ class SVDControlNetAdvanced(ControlNetAdvanced): # uses 'y' in new ComfyUI update y = cond.get('y', None) if y is not None: - y = y.to(dtype) + y = comfy.model_base.convert_tensor(y, dtype, x_noisy.device) timestep = self.model_sampling_current.timestep(t) x_noisy = self.model_sampling_current.calculate_input(t, x_noisy) # concat c_concat if exists (should exist for SVD), doubling channels to 8 @@ -459,7 +459,7 @@ class SparseCtrlAdvanced(ControlNetAdvanced): context = cond['c_crossattn'] y = cond.get('y', None) if y is not None: - y = y.to(dtype) + y = comfy.model_base.convert_tensor(y, dtype, x_noisy.device) timestep = self.model_sampling_current.timestep(t) x_noisy = self.model_sampling_current.calculate_input(t, x_noisy) diff --git a/adv_control/control_plusplus.py b/adv_control/control_plusplus.py index 3f984b6..25cb705 100644 --- a/adv_control/control_plusplus.py +++ b/adv_control/control_plusplus.py @@ -18,6 +18,7 @@ from comfy.controlnet import ControlNet #from comfy.t2i_adapter.adapter import ResidualAttentionBlock from comfy.ldm.modules.attention import optimized_attention import comfy.ops +import comfy.model_base import comfy.model_management import comfy.model_detection import comfy.utils @@ -339,7 +340,7 @@ class ControlNetPlusPlusAdvanced(ControlNet, AdvancedControlBase): context = cond.get('crossattn_controlnet', cond['c_crossattn']) y = cond.get('y', None) if y is not None: - y = y.to(dtype) + y = comfy.model_base.convert_tensor(y, dtype, x_noisy.device) timestep = self.model_sampling_current.timestep(t) x_noisy = self.model_sampling_current.calculate_input(t, x_noisy)