Skip to content

Commit 2bde95a

Browse files
authored
Merge pull request #237 from Kosinkadink/develop
Fixed device mismatch issue for ControlNet++, SparseCtrl, and SVDControlNet
2 parents f9a1225 + c0b5d73 commit 2bde95a

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

adv_control/control.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ def get_control_advanced(self, x_noisy, t, cond, batched_number, transformer_opt
326326
# uses 'y' in new ComfyUI update
327327
y = cond.get('y', None)
328328
if y is not None:
329-
y = y.to(dtype)
329+
y = comfy.model_base.convert_tensor(y, dtype, x_noisy.device)
330330
timestep = self.model_sampling_current.timestep(t)
331331
x_noisy = self.model_sampling_current.calculate_input(t, x_noisy)
332332
# concat c_concat if exists (should exist for SVD), doubling channels to 8
@@ -459,7 +459,7 @@ def get_control_advanced(self, x_noisy: Tensor, t, cond, batched_number: int, tr
459459
context = cond['c_crossattn']
460460
y = cond.get('y', None)
461461
if y is not None:
462-
y = y.to(dtype)
462+
y = comfy.model_base.convert_tensor(y, dtype, x_noisy.device)
463463
timestep = self.model_sampling_current.timestep(t)
464464
x_noisy = self.model_sampling_current.calculate_input(t, x_noisy)
465465

adv_control/control_plusplus.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#from comfy.t2i_adapter.adapter import ResidualAttentionBlock
1919
from comfy.ldm.modules.attention import optimized_attention
2020
import comfy.ops
21+
import comfy.model_base
2122
import comfy.model_management
2223
import comfy.model_detection
2324
import comfy.utils
@@ -339,7 +340,7 @@ def get_control_advanced(self, x_noisy: Tensor, t, cond, batched_number, transfo
339340
context = cond.get('crossattn_controlnet', cond['c_crossattn'])
340341
y = cond.get('y', None)
341342
if y is not None:
342-
y = y.to(dtype)
343+
y = comfy.model_base.convert_tensor(y, dtype, x_noisy.device)
343344
timestep = self.model_sampling_current.timestep(t)
344345
x_noisy = self.model_sampling_current.calculate_input(t, x_noisy)
345346

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "comfyui-advanced-controlnet"
33
description = "Nodes for scheduling ControlNet strength across timesteps and batched latents, as well as applying custom weights and attention masks."
4-
version = "1.5.5"
4+
version = "1.5.6"
55
license = { file = "LICENSE" }
66
dependencies = []
77

0 commit comments

Comments
 (0)