Views
No views yet
num_frames=161pip install diffsynth1import torch
2from diffsynth import ModelManager, WanVideoPipeline, save_video
3from modelscope import snapshot_download
4
5
6snapshot_download(
7 model_id="DiffSynth-Studio/Wan2.1-1.3b-lora-exvideo-v1",
8 local_dir="models/DiffSynth-Studio/Wan2.1-1.3b-lora-exvideo-v1",
9 allow_file_pattern="*.safetensors"
10)
11model_manager = ModelManager(device="cpu")
12model_manager.load_models(
13 [
14 "models/Wan-AI/Wan2.1-T2V-1.3B/diffusion_pytorch_model.safetensors",
15 "models/Wan-AI/Wan2.1-T2V-1.3B/models_t5_umt5-xxl-enc-bf16.pth",
16 "models/Wan-AI/Wan2.1-T2V-1.3B/Wan2.1_VAE.pth",
17 ],
18 torch_dtype=torch.bfloat16,
19)
20model_manager.load_lora("models/DiffSynth-Studio/Wan2.1-1.3b-lora-exvideo-v1/model.safetensors", lora_alpha=1)
21pipe = WanVideoPipeline.from_model_manager(model_manager, torch_dtype=torch.bfloat16, device="cuda")
22pipe.enable_vram_management(num_persistent_param_in_dit=None)
23
24video = pipe(
25 prompt="Documentary photography style scene, a lively little dog running quickly on a green grassy field. The dog has brownish-yellow fur, upright ears, and an expression that is focused yet joyful. Sunlight shines on its body, making the fur appear exceptionally soft and shiny. The background features an open grassland dotted with occasional wildflowers, with a faint view of blue sky and a few white clouds in the distance. Strong sense of perspective captures the dynamic motion of the running dog and the vitality of the surrounding grass. Mid-shot side-moving viewpoint.",
26 negative_prompt="Vivid colors, overexposed, static, blurry details, subtitles, style, artwork, painting, frame, still, overall grayish tone, worst quality, low quality, JPEG compression artifacts, ugly, defective, extra fingers, poorly drawn hands, poorly drawn face, malformed limbs, fused fingers, motionless scene, cluttered background, three legs, crowded background, walking backwards",
27 num_inference_steps=50, num_frames=161,
28 seed=0, tiled=True
29)
30save_video(video, "video1.mp4", fps=15, quality=5)