MrForExample/ComfyUI-AnimateAnyone-Evolved

Fix Info For MACOS

ghzgod opened this issue · 2 comments

If you run the example workflow you will get a 'torch not compiled with cuda' error on macOS/OSX.

To fix this, open nodes.py within the custom_nodes/ComfyUI-AnimateAnyone-Evolved folder.

Replace DEVICE='cuda' with

# DEVICE = 'cuda'
if torch.cuda.is_available():
    DEVICE = "cuda"
elif torch.backends.mps.is_available():
    DEVICE = "mps"
    torch_dtype = torch.float32
else:
    DEVICE = "cpu"

Great, it really helped me

Hello,

I tried this and it seemed to solve the issue. However, I have run into another error:

Error occurred when executing [AnimateAnyone] Animate Anyone Sampler:

Invalid buffer size: 27.00 GB

File "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "/Users/macintosh/AI/StableSwarmUI/dlbackend/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 "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/custom_nodes/ComfyUI-AnimateAnyone-Evolved/nodes.py", line 159, in animate_anyone
samples = diffuser(
File "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/venv/lib/python3.9/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/custom_nodes/ComfyUI-AnimateAnyone-Evolved/src/models/main_diffuser.py", line 440, in __call__
latents = self.denoise_loop(
File "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/custom_nodes/ComfyUI-AnimateAnyone-Evolved/src/models/main_diffuser.py", line 332, in denoise_loop
latents = self.solve_one_step(
File "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/custom_nodes/ComfyUI-AnimateAnyone-Evolved/src/models/main_diffuser.py", line 257, in solve_one_step
noise_pred, counter = self.denoise_all_one_step(
File "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/custom_nodes/ComfyUI-AnimateAnyone-Evolved/src/models/main_diffuser.py", line 229, in denoise_all_one_step
pred = self.unet(
File "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
File "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/custom_nodes/ComfyUI-AnimateAnyone-Evolved/src/models/unet_3d.py", line 494, in forward
sample, res_samples = downsample_block(
File "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
File "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/custom_nodes/ComfyUI-AnimateAnyone-Evolved/src/models/unet_3d_blocks.py", line 442, in forward
hidden_states = attn(
File "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
File "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/custom_nodes/ComfyUI-AnimateAnyone-Evolved/src/models/transformer_3d.py", line 140, in forward
hidden_states = block(
File "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
File "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/custom_nodes/ComfyUI-AnimateAnyone-Evolved/src/models/mutual_self_attention.py", line 158, in hacked_basic_transformer_inner_forward
self.attn1(
File "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
File "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/venv/lib/python3.9/site-packages/diffusers/models/attention_processor.py", line 522, in forward
return self.processor(
File "/Users/macintosh/AI/StableSwarmUI/dlbackend/ComfyUI/venv/lib/python3.9/site-packages/diffusers/models/attention_processor.py", line 1279, in __call__
hidden_states = F.scaled_dot_product_attention(