banodoco / Steerable-Motion

A ComfyUI node for driving videos using batches of images.
Other
826 stars 40 forks source link

Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! (when checking argument for argument mat1 in method wrapper_CUDA_addmm) #11

Closed Jasperb3 closed 9 months ago

Jasperb3 commented 9 months ago

Error occurred when executing KSampler Adv. (Efficient):

Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! (when checking argument for argument mat1 in method wrapper_CUDA_addmm)

Some changes were recently made to ComfyUI-Advanced-ControlNet that affect the imported AdvancedControlNet.py for SM

See here: https://github.com/Kosinkadink/ComfyUI-Advanced-ControlNet/issues/36

https://github.com/Kosinkadink/ComfyUI-Advanced-ControlNet/issues/38

and here: https://github.com/Kosinkadink/ComfyUI-Advanced-ControlNet/commit/296a9ef49ce29e826c91e63e85052785825d0dd7

peteromallet commented 9 months ago

Pushed a fix for this - plus some other improvements. Please update and let me know if it's all good.

Jasperb3 commented 9 months ago

Works like a charm. Great job. Thanks

zqlong123 commented 9 months ago

Error occurred when executing KSampler:

Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! (when checking argument for argument mat1 in method wrapper_CUDA_addmm)

File "F:\Blender_ComfyUI\ComfyUI\execution.py", line 153, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "F:\Blender_ComfyUI\ComfyUI\execution.py", line 83, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File "F:\Blender_ComfyUI\ComfyUI\execution.py", line 76, in map_node_over_list results.append(getattr(obj, func)(slice_dict(input_data_all, i))) File "F:\Blender_ComfyUI\ComfyUI\nodes.py", line 1299, in sample return common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise) File "F:\Blender_ComfyUI\ComfyUI\custom_nodes\AIT\AITemplate\AITemplate.py", line 176, in common_ksampler samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, File "F:\Blender_ComfyUI\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\sample_error_enhancer.py", line 22, in informative_sample raise e File "F:\Blender_ComfyUI\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\sample_error_enhancer.py", line 9, in informative_sample return original_sample(*args, *kwargs) # This code helps interpret error messages that occur within exceptions but does not have any impact on other operations. File "F:\Blender_ComfyUI\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved\animatediff\sampling.py", line 284, in motion_sample return wrap_function_to_inject_xformers_bug_info(orig_comfy_sample)(model, noise, args, kwargs) File "F:\Blender_ComfyUI\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved\animatediff\model_utils.py", line 205, in wrapped_function return function_to_wrap(args, kwargs) File "F:\Blender_ComfyUI\ComfyUI\custom_nodes\AIT\AITemplate\AITemplate.py", line 293, in sample samples = sampler.sample(noise, positive_copy, negative_copy, cfg=cfg, latent_image=latent_image, start_step=start_step, last_step=last_step, force_full_denoise=force_full_denoise, denoise_mask=noise_mask, sigmas=sigmas, callback=callback, disable_pbar=disable_pbar, seed=seed) File "F:\Blender_ComfyUI\ComfyUI\comfy\samplers.py", line 716, in sample return sample(self.model, noise, positive, negative, cfg, self.device, sampler, sigmas, self.model_options, latent_image=latent_image, denoise_mask=denoise_mask, callback=callback, disable_pbar=disable_pbar, seed=seed) File "F:\Blender_ComfyUI\ComfyUI\comfy\samplers.py", line 622, in sample samples = sampler.sample(model_wrap, sigmas, extra_args, callback, noise, latent_image, denoise_mask, disable_pbar) File "F:\Blender_ComfyUI\ComfyUI\comfy\samplers.py", line 561, in sample samples = self.sampler_function(model_k, noise, sigmas, extra_args=extra_args, callback=k_callback, disable=disable_pbar, self.extra_options) File "F:\Blender_ComfyUI\python_embeded\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context return func(args, kwargs) File "F:\Blender_ComfyUI\ComfyUI\comfy\k_diffusion\sampling.py", line 137, in sample_euler denoised = model(x, sigma_hat * s_in, *extra_args) File "F:\Blender_ComfyUI\python_embeded\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(args, kwargs) File "F:\Blender_ComfyUI\python_embeded\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(*args, kwargs) File "F:\Blender_ComfyUI\ComfyUI\comfy\samplers.py", line 285, in forward out = self.inner_model(x, sigma, cond=cond, uncond=uncond, cond_scale=cond_scale, model_options=model_options, seed=seed) File "F:\Blender_ComfyUI\python_embeded\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, *kwargs) File "F:\Blender_ComfyUI\python_embeded\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(args, kwargs) File "F:\Blender_ComfyUI\ComfyUI\comfy\samplers.py", line 275, in forward return self.apply_model(*args, kwargs) File "F:\Blender_ComfyUI\ComfyUI\comfy\samplers.py", line 272, in apply_model out = sampling_function(self.inner_model, x, timestep, uncond, cond, cond_scale, model_options=model_options, seed=seed) File "F:\Blender_ComfyUI\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved\animatediff\sampling.py", line 634, in sliding_sampling_function cond, uncond = sliding_calc_cond_uncond_batch(model, cond, uncond, x, timestep, model_options) File "F:\Blender_ComfyUI\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved\animatediff\sampling.py", line 615, in sliding_calc_cond_uncond_batch sub_cond_out, sub_uncond_out = calc_cond_uncond_batch(model, sub_cond, sub_uncond, sub_x, sub_timestep, model_options) File "F:\Blender_ComfyUI\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved\animatediff\sampling.py", line 488, in calc_cond_uncond_batch c['control'] = control.get_control(inputx, timestep, c, len(cond_or_uncond)) File "F:\Blender_ComfyUI\ComfyUI\custom_nodes\ComfyUI-Advanced-ControlNet\control\control.py", line 276, in get_control return self.sliding_get_control(x_noisy, t, cond, batched_number) File "F:\Blender_ComfyUI\ComfyUI\custom_nodes\ComfyUI-Advanced-ControlNet\control\control.py", line 281, in sliding_get_control control_prev = self.previous_controlnet.get_control(x_noisy, t, cond, batched_number) File "F:\Blender_ComfyUI\ComfyUI\custom_nodes\ComfyUI-Advanced-ControlNet\control\control.py", line 276, in get_control return self.sliding_get_control(x_noisy, t, cond, batched_number) File "F:\Blender_ComfyUI\ComfyUI\custom_nodes\ComfyUI-Advanced-ControlNet\control\control.py", line 319, in sliding_get_control control = self.control_model(x=x_noisy.to(self.control_model.dtype), hint=self.cond_hint, timesteps=timestep.float(), context=context.to(self.control_model.dtype), y=y) File "F:\Blender_ComfyUI\python_embeded\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, *kwargs) File "F:\Blender_ComfyUI\python_embeded\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(args, kwargs) File "F:\Blender_ComfyUI\ComfyUI\comfy\cldm\cldm.py", line 287, in forward emb = self.time_embed(t_emb) File "F:\Blender_ComfyUI\python_embeded\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, kwargs) File "F:\Blender_ComfyUI\python_embeded\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(*args, *kwargs) File "F:\Blender_ComfyUI\python_embeded\lib\site-packages\torch\nn\modules\container.py", line 215, in forward input = module(input) File "F:\Blender_ComfyUI\python_embeded\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(args, kwargs) File "F:\Blender_ComfyUI\python_embeded\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(*args, **kwargs) File "F:\Blender_ComfyUI\python_embeded\lib\site-packages\torch\nn\modules\linear.py", line 114, in forward return F.linear(input, self.weight, self.bias)

zqlong123 commented 9 months ago

Can anyone help me solve this problem? ? ?

peteromallet commented 9 months ago

See the soluton above - you need to update the node and Comfy