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