Skip to content

Commit 4670287

Browse files
committed
update t2v example
1 parent 465e12e commit 4670287

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/diffusers/pipelines/wan/pipeline_wan.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,27 +45,31 @@
4545
Examples:
4646
```python
4747
>>> import torch
48-
>>> from diffusers import AutoencoderKLWan, WanPipeline
4948
>>> from diffusers.utils import export_to_video
49+
>>> from diffusers import AutoencoderKLWan, WanPipeline
50+
>>> from diffusers.schedulers.scheduling_unipc_multistep import UniPCMultistepScheduler
5051
5152
>>> # Available models: Wan-AI/Wan2.1-T2V-14B-Diffusers, Wan-AI/Wan2.1-T2V-1.3B-Diffusers
5253
>>> model_id = "Wan-AI/Wan2.1-T2V-14B-Diffusers"
5354
>>> vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float32)
55+
>>> flow_shift = 5.0 # 5.0 for 720P, 3.0 for 480P
56+
>>> scheduler = UniPCMultistepScheduler(prediction_type='flow_prediction', use_flow_sigmas=True, num_train_timesteps=1000, flow_shift=flow_shift)
5457
>>> pipe = WanPipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
58+
>>> pipe.scheduler = scheduler
5559
>>> pipe.to("cuda")
5660
57-
>>> prompt = "A cat walks on the grass, realistic"
61+
>>> prompt = "A cat and a dog baking a cake together in a kitchen. The cat is carefully measuring flour, while the dog is stirring the batter with a wooden spoon. The kitchen is cozy, with sunlight streaming through the window."
5862
>>> negative_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"
5963
6064
>>> output = pipe(
6165
... prompt=prompt,
6266
... negative_prompt=negative_prompt,
63-
... height=480,
64-
... width=832,
67+
... height=720,
68+
... width=1280,
6569
... num_frames=81,
6670
... guidance_scale=5.0,
67-
... ).frames[0]
68-
>>> export_to_video(output, "output.mp4", fps=15)
71+
... ).frames[0]
72+
>>> export_to_video(output, "output.mp4", fps=16)
6973
```
7074
"""
7175

0 commit comments

Comments
 (0)