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): 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 = []