Kosinkadink / ComfyUI-AnimateDiff-Evolved

Improved AnimateDiff for ComfyUI and Advanced Sampling Support
Apache License 2.0
2.76k stars 208 forks source link

Animate Diff sampler error: found at least two devices, cuda:0 and cpu #333

Closed ShmuelRonen closed 7 months ago

ShmuelRonen commented 7 months ago

This error appeared out of the blue. To try to fix it I installed a new VENV but the error keeps appearing.

(venv) E:\ComfyUI_4ALL\ComfyUI>python main.py ComfyUI startup time: 2024-04-05 20:54:31.611299 Platform: Windows Python version: 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] Python executable: E:\ComfyUI_4ALL\ComfyUI\venv\Scripts\python.exe ** Log path: E:\ComfyUI_4ALL\ComfyUI\comfyui.log

Prestartup times for custom nodes: 0.0 seconds: E:\ComfyUI_4ALL\ComfyUI\custom_nodes\rgthree-comfy 0.0 seconds: E:\ComfyUI_4ALL\ComfyUI\custom_nodes\ComfyUI-Marigold 0.1 seconds: E:\ComfyUI_4ALL\ComfyUI\custom_nodes\ComfyUI-Manager

Total VRAM 24576 MB, total RAM 31969 MB Set vram state to: NORMAL_VRAM Device: cuda:0 NVIDIA GeForce RTX 3090 : cudaMallocAsync VAE dtype: torch.bfloat16


Error occurred when executing AnimateDiffSampler:

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

File "E:\ComfyUI_4ALL\ComfyUI\execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "E:\ComfyUI_4ALL\ComfyUI\execution.py", line 81, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File "E:\ComfyUI_4ALL\ComfyUI\execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(slice_dict(input_data_all, i))) File "E:\ComfyUI_4ALL\ComfyUI\custom_nodes\comfyui-animatediff\animatediff\sampler.py", line 277, in animatediff_sample return super().sample( File "E:\ComfyUI_4ALL\ComfyUI\nodes.py", line 1369, in sample return common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise) File "E:\ComfyUI_4ALL\ComfyUI\nodes.py", line 1339, in common_ksampler samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, File "E:\ComfyUI_4ALL\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\sample_error_enhancer.py", line 22, in informative_sample raise e File "E:\ComfyUI_4ALL\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 "E:\ComfyUI_4ALL\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved\animatediff\sampling.py", line 278, in motion_sample return orig_comfy_sample(model, noise, args, kwargs) File "E:\ComfyUI_4ALL\ComfyUI\comfy\sample.py", line 100, 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 "E:\ComfyUI_4ALL\ComfyUI\custom_nodes\ComfyUI_smZNodes__init.py", line 130, in KSampler_sample return _KSampler_sample(*args, **kwargs) File "E:\ComfyUI_4ALL\ComfyUI\comfy\samplers.py", line 702, 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 "E:\ComfyUI_4ALL\ComfyUI\custom_nodes\ComfyUI_smZNodes\init__.py", line 149, in sample return _sample(args, kwargs) File "E:\ComfyUI_4ALL\ComfyUI\comfy\samplers.py", line 607, in sample samples = sampler.sample(model_wrap, sigmas, extra_args, callback, noise, latent_image, denoise_mask, disable_pbar) File "E:\ComfyUI_4ALL\ComfyUI\comfy\samplers.py", line 545, in sample samples = self.sampler_function(model_k, noise, sigmas, extra_args=extra_args, callback=k_callback, disable=disable_pbar, self.extra_options) File "E:\ComfyUI_4ALL\ComfyUI\venv\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context return func(args, kwargs) File "E:\ComfyUI_4ALL\ComfyUI\comfy\k_diffusion\sampling.py", line 137, in sample_euler denoised = model(x, sigma_hat * s_in, *extra_args) File "E:\ComfyUI_4ALL\ComfyUI\venv\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl return self._call_impl(args, kwargs) File "E:\ComfyUI_4ALL\ComfyUI\venv\lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl return forward_call(*args, kwargs) File "E:\ComfyUI_4ALL\ComfyUI\comfy\samplers.py", line 283, in forward out = self.inner_model(x, sigma, cond=cond, uncond=uncond, cond_scale=cond_scale, model_options=model_options, seed=seed) File "E:\ComfyUI_4ALL\ComfyUI\venv\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl return self._call_impl(*args, *kwargs) File "E:\ComfyUI_4ALL\ComfyUI\venv\lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl return forward_call(args, kwargs) File "E:\ComfyUI_4ALL\ComfyUI\comfy\samplers.py", line 270, in forward return self.apply_model(*args, kwargs) File "E:\ComfyUI_4ALL\ComfyUI\custom_nodes\ComfyUI_smZNodes\smZNodes.py", line 1047, in apply_model out = super().apply_model(*args, kwargs) File "E:\ComfyUI_4ALL\ComfyUI\comfy\samplers.py", line 267, in apply_model out = sampling_function(self.inner_model, x, timestep, uncond, cond, cond_scale, model_options=model_options, seed=seed) File "E:\ComfyUI_4ALL\ComfyUI\comfy\samplers.py", line 244, in sampling_function out = calc_cond_batch(model, conds, x, timestep, model_options) File "E:\ComfyUI_4ALL\ComfyUI\comfy\samplers.py", line 217, in calc_cond_batch output = model.apply_model(inputx, timestep, c).chunk(batch_chunks) File "E:\ComfyUI_4ALL\ComfyUI\comfy\model_base.py", line 97, in apply_model model_output = self.diffusion_model(xc, t, context=context, control=control, transformer_options=transformer_options, *extra_conds).float() File "E:\ComfyUI_4ALL\ComfyUI\venv\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl return self._call_impl(args, kwargs) File "E:\ComfyUI_4ALL\ComfyUI\venv\lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl return forward_call(*args, kwargs) File "E:\ComfyUI_4ALL\ComfyUI\comfy\ldm\modules\diffusionmodules\openaimodel.py", line 850, in forward h = forward_timestep_embed(module, h, emb, context, transformer_options, time_context=time_context, num_video_frames=num_video_frames, image_only_indicator=image_only_indicator) File "E:\ComfyUI_4ALL\ComfyUI\custom_nodes\comfyui-animatediff\animatediff\sampler.py", line 28, in forward_timestep_embed x = layer(x, context) File "E:\ComfyUI_4ALL\ComfyUI\venv\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl return self._call_impl(*args, *kwargs) File "E:\ComfyUI_4ALL\ComfyUI\venv\lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl return forward_call(args, kwargs) File "E:\ComfyUI_4ALL\ComfyUI\custom_nodes\comfyui-animatediff\animatediff\motion_module.py", line 183, in forward return self.temporal_transformer(input_tensor, encoder_hidden_states, attention_mask) File "E:\ComfyUI_4ALL\ComfyUI\venv\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl return self._call_impl(*args, kwargs) File "E:\ComfyUI_4ALL\ComfyUI\venv\lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl return forward_call(*args, *kwargs) File "E:\ComfyUI_4ALL\ComfyUI\custom_nodes\comfyui-animatediff\animatediff\motion_module.py", line 244, in forward hidden_states = self.norm(hidden_states) File "E:\ComfyUI_4ALL\ComfyUI\venv\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl return self._call_impl(args, kwargs) File "E:\ComfyUI_4ALL\ComfyUI\venv\lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl return forward_call(*args, **kwargs) File "E:\ComfyUI_4ALL\ComfyUI\custom_nodes\comfyui-animatediff\animatediff\sampler.py", line 42, in groupnorm_mm_forward input = group_norm(input, self.num_groups, self.weight, self.bias, self.eps) File "E:\ComfyUI_4ALL\ComfyUI\venv\lib\site-packages\torch\nn\functional.py", line 2561, in group_norm return torch.group_norm(input, num_groups, weight, bias, eps, torch.backends.cudnn.enabled)


A minimal config test

conflict

Kosinkadink commented 7 months ago

You need to use ComfyUI-AnimateDiff-Evolved (this repo), not comfyui-animatediff.