Mac M1 Comfyui 使用MMAudio遇到的问题解决?

发布于:2025-02-10 ⋅ 阅读:(49) ⋅ 点赞:(0)

问题1: AssertionError: Torch not compiled with CUDA enabled?

解决办法:修改代码以 CPU 运行

第一步:找到 /ComfyUI/custom_nodes/ComfyUI-MMAudio/mmaudio/ext/autoencoder/vae.py文件中的下面这两行代码
self.data_mean = nn.Buffer(torch.tensor(DATA_MEAN_128D, dtype=torch.float32).cuda())
self.data_std = nn.Buffer(torch.tensor(DATA_STD_128D, dtype=torch.float32).cuda())

第二步:将其修改为:

self.data_mean = nn.Buffer(torch.tensor(DATA_MEAN_128D, dtype=torch.float32).cpu())
self.data_std = nn.Buffer(torch.tensor(DATA_STD_128D, dtype=torch.float32).cpu())

问题2: NotImplementedError: The operator ‘aten::_upsample_bicubic2d_aa.out’ is not currently implemented for the MPS device. If you want this op to be added in priority during the prototype phase of this feature, please comment on https://github.com/pytorch/pytorch/issues/77764. As a temporary fix, you can set the environment variable PYTORCH_ENABLE_MPS_FALLBACK=1 to use the CPU as a fallback for this op. WARNING: this will be slower than running natively on MPS?

解决办法:临时解决办法:启用 MPS 回退机制

在main.py中 import os 后面添加如下代码:

import os
os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1"

问题3: ComfyUI/custom_nodes/ComfyUI-MMAudio/mmaudio/model/utils/features_utils.py", line 112, in encode_video_with_sync x = torch.stack(segments, dim=1) # (B, S, T, C, H, W) RuntimeError: stack expects a non-empty TensorList?

解决办法:上传的视频时长太短,重新选择时长稍微长些的视频。

问题4: NotImplementedError: Output channels > 65536 not supported at the MPS device?

解决办法:更新 PyTorch 版本

pip install --upgrade torch torchvision torchaudio

问题5: ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite/videohelpersuite/server.py", line 86, in view_video if int(query.get(‘force_rate’,0)) != 0:^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: ‘7.87890625’?

解决办法:在VideoHelperSuite节点的format格式animatediff 修改为Hunyuan