Skip to content

Facing issue while running Wan14B on Mutli GPU #659

@Akshaysharma29

Description

@Akshaysharma29

Hi Team, Thanks for your work but I am not able to run the 14B model using the step given.

I have 8 gpu with 24GB ram.

Cmd used:
torchrun --standalone --nproc_per_node=8 examples/wanvideo/acceleration/unified_sequence_parallel.py

Code used:

import torch
from PIL import Image
from diffsynth import save_video, VideoData
from diffsynth.pipelines.wan_video_new import WanVideoPipeline, ModelConfig
import torch.distributed as dist


pipe = WanVideoPipeline.from_pretrained(
    torch_dtype=torch.bfloat16,
    device="cuda",
    use_usp=True,
    skip_download = True,
    redirect_common_files = False,
    model_configs=[
        ModelConfig(path = [
            "/data/akshay/wan/Wan2.1-T2V-14B/diffusion_pytorch_model-00001-of-00006.safetensors",
            "/data/akshay/wan/Wan2.1-T2V-14B/diffusion_pytorch_model-00002-of-00006.safetensors",
            "/data/akshay/wan/Wan2.1-T2V-14B/diffusion_pytorch_model-00003-of-00006.safetensors",
            "/data/akshay/wan/Wan2.1-T2V-14B/diffusion_pytorch_model-00004-of-00006.safetensors",
            "/data/akshay/wan/Wan2.1-T2V-14B/diffusion_pytorch_model-00005-of-00006.safetensors",
            "/data/akshay/wan/Wan2.1-T2V-14B/diffusion_pytorch_model-00006-of-00006.safetensors",
        ], offload_device="cpu"),
        ModelConfig(path = "/data/akshay/wan/Wan2.1-T2V-14B/models_t5_umt5-xxl-enc-bf16.pth", offload_device="cpu"),
        ModelConfig(path = "/data/akshay/wan/Wan2.1-T2V-14B/Wan2.1_VAE.pth", offload_device="cpu"),
    
    ],
)

print('loading complete')
pipe.enable_vram_management()


video = pipe(
    prompt="一名宇航员身穿太空服,面朝镜头骑着一匹机械马在火星表面驰骋。红色的荒凉地表延伸至远方,点缀着巨大的陨石坑和奇特的岩石结构。机械马的步伐稳健,扬起微弱的尘埃,展现出未来科技与原始探索的完美结合。宇航员手持操控装置,目光坚定,仿佛正在开辟人类的新疆域。背景是深邃的宇宙和蔚蓝的地球,画面既科幻又充满希望,让人不禁畅想未来的星际生活。",
    negative_prompt="色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走",
    seed=0, tiled=True,
)
if dist.get_rank() == 0:
    save_video(video, "video1.mp4", fps=15, quality=5)

Error:

Traceback (most recent call last):
[rank5]:   File "/data/akshay/wan/DiffSynth-Studio/examples/wanvideo/acceleration/unified_sequence_parallel.py", line 51, in <module>
[rank5]:     pipe.enable_vram_management()
[rank5]:   File "/data/akshay/wan/DiffSynth-Studio/diffsynth/pipelines/wan_video_new.py", line 278, in enable_vram_management
[rank5]:     vram_limit = self.get_vram()
[rank5]:                  ^^^^^^^^^^^^^^^
[rank5]:   File "/data/akshay/wan/DiffSynth-Studio/diffsynth/pipelines/wan_video_new.py", line 147, in get_vram
[rank5]:     return torch.cuda.mem_get_info(self.device)[1] / (1024 ** 3)
[rank5]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank5]:   File "/opt/conda/lib/python3.11/site-packages/torch/cuda/memory.py", line 684, in mem_get_info
[rank5]:     device = _get_device_index(device)
[rank5]:              ^^^^^^^^^^^^^^^^^^^^^^^^^
[rank5]:   File "/opt/conda/lib/python3.11/site-packages/torch/cuda/_utils.py", line 38, in _get_device_index
[rank5]:     return _torch_get_device_index(device, optional, allow_cpu)
[rank5]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank5]:   File "/opt/conda/lib/python3.11/site-packages/torch/_utils.py", line 803, in _get_device_index
[rank5]:     raise ValueError(
[rank5]: ValueError: Expected a torch.device with a specified index or an integer, but got:cuda

Can you please help me with this?
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions