Mac max1 14.6 64g内存 跑CogVideoX-2btest.py报错
System Info / 系統信息
Mac max1 14.6 64g内存跑这个代码
import torch from diffusers import CogVideoXPipeline from diffusers.utils import export_to_video
prompt = "A panda, dressed in a small, red jacket and a tiny hat, sits on a wooden stool in a serene bamboo forest. The panda's fluffy paws strum a miniature acoustic guitar, producing soft, melodic tunes. Nearby, a few other pandas gather, watching curiously and some clapping in rhythm. Sunlight filters through the tall bamboo, casting a gentle glow on the scene. The panda's face is expressive, showing concentration and joy as it plays. The background includes a small, flowing stream and vibrant green foliage, enhancing the peaceful and magical atmosphere of this unique musical performance."
pipe = CogVideoXPipeline.from_pretrained( "CogVideoX-2b", torch_dtype=torch.float16 ).to("mps")
prompt_embeds, _ = pipe.encode_prompt( prompt=prompt, do_classifier_free_guidance=True, num_videos_per_prompt=1, max_sequence_length=226, device="mps", dtype=torch.float16, )
video = pipe( num_inference_steps=50, guidance_scale=2, prompt_embeds=prompt_embeds, ).frames[0]
export_to_video(video, "output.mp4", fps=8)
报错信息:
/AppleInternal/Library/BuildRoots/4ff29661-3588-11ef-9513-e2437461156c/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShaders/MPSCore/Types/MPSNDArray.mm:788: failed assertion `[MPSNDArray initWithDevice:descriptor:] Error: total bytes of NDArray > 2**32' zsh: abort python CogVideoX-2btest.py (base) a1-6@MacBook-Pro mygit % /Users/a1-6/miniforge3/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown warnings.warn('resource_tracker: There appear to be %d '
Information / 问题信息
- [X] The official example scripts / 官方的示例脚本
- [ ] My own modified scripts / 我自己修改的脚本和任务
Reproduction / 复现过程
- 改为 mps 后报以上错误
Expected behavior / 期待表现
改为 mps 后能运行
这个好像是底层的问题了,不是算法层的问题,似乎是有哪个算子不支持