Views
No views yet
malone to trigger the video generation.pip install git+https://github.com/huggingface/diffusers.git1import torch
2from diffusers.utils import export_to_video
3from diffusers import AutoencoderKLWan, WanPipeline
4from diffusers.schedulers.scheduling_unipc_multistep import UniPCMultistepScheduler
5
6# Available models: Wan-AI/Wan2.1-T2V-14B-Diffusers, Wan-AI/Wan2.1-T2V-1.3B-Diffusers
7model_id = "Wan-AI/Wan2.1-T2V-14B-Diffusers"
8vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float32)
9pipe = WanPipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
10flow_shift = 5.0 # 5.0 for 720P, 3.0 for 480P
11pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config, flow_shift=flow_shift)
12pipe.to("cuda")
13
14pipe.load_lora_weights("shauray/PostMalone_WanLora")
15
16pipe.enable_model_cpu_offload() #for low-vram environments
17
18prompt = "malone a man walking through texas"
19
20output = pipe(
21 prompt=prompt,
22 height=480,
23 width=720,
24 num_frames=81,
25 guidance_scale=5.0,
26).frames[0]
27export_to_video(output, "output.mp4", fps=16)