Views
No views yet
flat color to trigger the image generation.no lineart to trigger the image 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("motimalu/wan-flat-color-v2")
15
16pipe.enable_model_cpu_offload() #for low-vram environments
17
18prompt = "A cat wandering around new york city"
19negative_prompt = "Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality, low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured, misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards"
20
21output = pipe(
22 prompt=prompt,
23 negative_prompt=negative_prompt,
24 height=480,
25 width=720,
26 num_frames=81,
27 guidance_scale=5.0,
28).frames[0]
29export_to_video(output, "output.mp4", fps=16)