Update README.md
Browse files
README.md
CHANGED
@@ -151,6 +151,35 @@ pip install "xfuser>=0.4.1"
|
|
151 |
torchrun --nproc_per_node=8 generate.py --task i2v-14B --size 1280*720 --ckpt_dir ./Wan2.1-I2V-14B-720P --image examples/i2v_input.JPG --dit_fsdp --t5_fsdp --ulysses_size 8 --prompt "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard. The fluffy-furred feline gazes directly at the camera with a relaxed expression. Blurred beach scenery forms the background featuring crystal-clear waters, distant green hills, and a blue sky dotted with white clouds. The cat assumes a naturally relaxed posture, as if savoring the sea breeze and warm sunlight. A close-up shot highlights the feline's intricate details and the refreshing atmosphere of the seaside."
|
152 |
```
|
153 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
##### (2) Using Prompt Extention
|
155 |
|
156 |
|
|
|
151 |
torchrun --nproc_per_node=8 generate.py --task i2v-14B --size 1280*720 --ckpt_dir ./Wan2.1-I2V-14B-720P --image examples/i2v_input.JPG --dit_fsdp --t5_fsdp --ulysses_size 8 --prompt "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard. The fluffy-furred feline gazes directly at the camera with a relaxed expression. Blurred beach scenery forms the background featuring crystal-clear waters, distant green hills, and a blue sky dotted with white clouds. The cat assumes a naturally relaxed posture, as if savoring the sea breeze and warm sunlight. A close-up shot highlights the feline's intricate details and the refreshing atmosphere of the seaside."
|
152 |
```
|
153 |
|
154 |
+
Wan can also be run directly using 🤗 Diffusers!
|
155 |
+
|
156 |
+
```python
|
157 |
+
import torch
|
158 |
+
from diffusers import AutoencoderKLWan, WanImageToVideoPipeline
|
159 |
+
from diffusers.utils import export_to_video, load_image
|
160 |
+
|
161 |
+
# Available models: Wan-AI/Wan2.1-I2V-14B-480P, Wan-AI/Wan2.1-I2V-1.3B-720P
|
162 |
+
model_id = "Wan-AI/Wan2.1-I2V-14B-720P"
|
163 |
+
vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float32)
|
164 |
+
pipe = WanImageToVideoPipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
|
165 |
+
pipe.to("cuda")
|
166 |
+
|
167 |
+
height, width = 480, 832
|
168 |
+
image = load_image(
|
169 |
+
"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/astronaut.jpg"
|
170 |
+
).resize((width, height))
|
171 |
+
prompt = (
|
172 |
+
"An astronaut hatching from an egg, on the surface of the moon, the darkness and depth of space realised in "
|
173 |
+
"the background. High quality, ultrarealistic detail and breath-taking movie-like camera shot."
|
174 |
+
)
|
175 |
+
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"
|
176 |
+
|
177 |
+
output = pipe(
|
178 |
+
image=image, prompt=prompt, negative_prompt=negative_prompt, num_frames=81, guidance_scale=5.0
|
179 |
+
).frames[0]
|
180 |
+
export_to_video(output, "output.mp4", fps=15)
|
181 |
+
```
|
182 |
+
|
183 |
##### (2) Using Prompt Extention
|
184 |
|
185 |
|