Skip to content

Commit 6d0d68a

Browse files
committed
update
1 parent 598ca27 commit 6d0d68a

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/diffusers/pipelines/wan/pipeline_wan_video2video.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,26 @@
5252
>>> from diffusers.schedulers.scheduling_unipc_multistep import UniPCMultistepScheduler
5353
5454
>>> # Available models: Wan-AI/Wan2.1-T2V-14B-Diffusers, Wan-AI/Wan2.1-T2V-1.3B-Diffusers
55-
>>> model_id = "Wan-AI/Wan2.1-T2V-14B-Diffusers"
55+
>>> model_id = "Wan-AI/Wan2.1-T2V-1.3B-Diffusers"
5656
>>> vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float32)
5757
>>> pipe = WanVideoToVideoPipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
58-
>>> flow_shift = 5.0 # 5.0 for 720P, 3.0 for 480P
58+
>>> flow_shift = 3.0 # 5.0 for 720P, 3.0 for 480P
5959
>>> pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config, flow_shift=flow_shift)
6060
>>> pipe.to("cuda")
6161
6262
>>> 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."
6363
>>> 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"
64-
64+
>>> video = load_video(
65+
... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/hiker.mp4"
66+
... )
6567
>>> output = pipe(
68+
... video=video,
6669
... prompt=prompt,
6770
... negative_prompt=negative_prompt,
68-
... height=720,
69-
... width=1280,
70-
... num_frames=81,
71+
... height=480,
72+
... width=720,
7173
... guidance_scale=5.0,
74+
... strength=0.7,
7275
... ).frames[0]
7376
>>> export_to_video(output, "output.mp4", fps=16)
7477
```
@@ -341,6 +344,8 @@ def check_inputs(
341344
negative_prompt,
342345
height,
343346
width,
347+
video=None,
348+
latents=None,
344349
prompt_embeds=None,
345350
negative_prompt_embeds=None,
346351
callback_on_step_end_tensor_inputs=None,
@@ -376,6 +381,9 @@ def check_inputs(
376381
):
377382
raise ValueError(f"`negative_prompt` has to be of type `str` or `list` but is {type(negative_prompt)}")
378383

384+
if video is not None and latents is not None:
385+
raise ValueError("Only one of `video` or `latents` should be provided")
386+
379387
def prepare_latents(
380388
self,
381389
video: Optional[torch.Tensor] = None,
@@ -569,6 +577,8 @@ def __call__(
569577
negative_prompt,
570578
height,
571579
width,
580+
video,
581+
latents,
572582
prompt_embeds,
573583
negative_prompt_embeds,
574584
callback_on_step_end_tensor_inputs,

0 commit comments

Comments
 (0)