From ab5dac03c6ab0e201efc2ec6c1dcd50124f36f0a Mon Sep 17 00:00:00 2001 From: Jedrzej Kosinski Date: Fri, 31 Jan 2025 03:54:39 -0600 Subject: [PATCH 1/4] Fixed BIGMAX_TENSOR to not be so big that it becomes an int64 instead of a float32 --- adv_control/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adv_control/utils.py b/adv_control/utils.py index 4dc7363..0f023e9 100644 --- a/adv_control/utils.py +++ b/adv_control/utils.py @@ -18,7 +18,7 @@ from .logger import logger BIGMIN = -(2**53-1) BIGMAX = (2**53-1) -BIGMAX_TENSOR = torch.tensor(BIGMAX) +BIGMAX_TENSOR = torch.tensor(9999999999.9) ORIG_PREVIOUS_CONTROLNET = "_orig_previous_controlnet" CONTROL_INIT_BY_ACN = "_control_init_by_ACN" From 9cf9d310ba64eefb2f5e8c28efa73e4931638006 Mon Sep 17 00:00:00 2001 From: Jedrzej Kosinski Date: Fri, 31 Jan 2025 03:55:17 -0600 Subject: [PATCH 2/4] version bump --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3f9afa5..f04a8ac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui-advanced-controlnet" description = "Nodes for scheduling ControlNet strength across timesteps and batched latents, as well as applying custom weights and attention masks." -version = "1.5.2" +version = "1.5.3" license = { file = "LICENSE" } dependencies = [] From 0da13ac0e2c8953024a0ff0c4476d0028cdf6322 Mon Sep 17 00:00:00 2001 From: Jedrzej Kosinski Date: Tue, 5 Aug 2025 13:43:52 -0700 Subject: [PATCH 3/4] Updated the remaining context= controlnet code to use comfy.model_management.cast_to_device calls --- adv_control/control.py | 4 ++-- adv_control/control_plusplus.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/adv_control/control.py b/adv_control/control.py index 623038a..c15fd17 100644 --- a/adv_control/control.py +++ b/adv_control/control.py @@ -333,7 +333,7 @@ class SVDControlNetAdvanced(ControlNetAdvanced): if cond.get('c_concat', None) is not None: x_noisy = torch.cat([x_noisy] + [cond['c_concat']], dim=1) - control = self.control_model(x=x_noisy.to(dtype), hint=self.cond_hint, timesteps=timestep.float(), context=context.to(dtype), y=y, cond=cond) + control = self.control_model(x=x_noisy.to(dtype), hint=self.cond_hint, timesteps=timestep.float(), context=comfy.model_management.cast_to_device(context, x_noisy.device, dtype), y=y, cond=cond) return self.control_merge(control, control_prev, output_dtype) def copy(self): @@ -463,7 +463,7 @@ class SparseCtrlAdvanced(ControlNetAdvanced): timestep = self.model_sampling_current.timestep(t) x_noisy = self.model_sampling_current.calculate_input(t, x_noisy) - control = self.control_model(x=x_noisy.to(dtype), hint=self.cond_hint, timesteps=timestep.float(), context=context.to(dtype), y=y) + control = self.control_model(x=x_noisy.to(dtype), hint=self.cond_hint, timesteps=timestep.float(), context=comfy.model_management.cast_to_device(context, x_noisy.device, dtype), y=y) return self.control_merge(control, control_prev, output_dtype) def apply_advanced_strengths_and_masks(self, x: Tensor, batched_number: int, *args, **kwargs): diff --git a/adv_control/control_plusplus.py b/adv_control/control_plusplus.py index b0a10a4..3f984b6 100644 --- a/adv_control/control_plusplus.py +++ b/adv_control/control_plusplus.py @@ -343,7 +343,7 @@ class ControlNetPlusPlusAdvanced(ControlNet, AdvancedControlBase): timestep = self.model_sampling_current.timestep(t) x_noisy = self.model_sampling_current.calculate_input(t, x_noisy) - control = self.control_model(x=x_noisy.to(dtype), hint=self.cond_hint, timesteps=timestep.float(), context=context.to(dtype), y=y, control_type=self.cond_hint_types) + control = self.control_model(x=x_noisy.to(dtype), hint=self.cond_hint, timesteps=timestep.float(), context=comfy.model_management.cast_to_device(context, x_noisy.device, dtype), y=y, control_type=self.cond_hint_types) return self.control_merge(control, control_prev, output_dtype) def copy(self): From 86bfde7eb662797d8a0b7d626ddb4ac946a496ed Mon Sep 17 00:00:00 2001 From: Jedrzej Kosinski Date: Tue, 5 Aug 2025 13:44:34 -0700 Subject: [PATCH 4/4] version bump --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index add2432..27bd14e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui-advanced-controlnet" description = "Nodes for scheduling ControlNet strength across timesteps and batched latents, as well as applying custom weights and attention masks." -version = "1.5.4" +version = "1.5.5" license = { file = "LICENSE" } dependencies = []