Views
No views yet
pip install kernels) to access prebuilt attention kernels1import torch
2
3dtype = torch.bfloat16
4device = "cuda:0"
5from diffusers import HunyuanVideo15ImageToVideoPipeline, attention_backend
6from diffusers.utils import export_to_video, load_image
7
8pipe = HunyuanVideo15ImageToVideoPipeline.from_pretrained("hunyuanvideo-community/HunyuanVideo-1.5-Diffusers-720p_i2v_distilled", torch_dtype=dtype)
9pipe.enable_model_cpu_offload()
10pipe.vae.enable_tiling()
11
12generator = torch.Generator(device=device).manual_seed(1)
13image = load_image("https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/wan_i2v_input.JPG")
14prompt="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."
15with attention_backend("_flash_3_hub"): # or `"flash_hub" if you're not using Hopper GPUs
16 video = pipe(
17 prompt=prompt,
18 image=image,
19 generator=generator,
20 num_frames=121,
21 num_inference_steps=50,
22 ).frames[0]
23export_to_video(video, "output.mp4", fps=24)1import torch
2
3dtype = torch.bfloat16
4device = "cuda:0"
5from diffusers import HunyuanVideo15ImageToVideoPipeline
6from diffusers.utils import export_to_video, load_image
7
8pipe = HunyuanVideo15ImageToVideoPipeline.from_pretrained("hunyuanvideo-community/HunyuanVideo-1.5-Diffusers-720p_i2v_distilled", torch_dtype=dtype)
9pipe.enable_model_cpu_offload()
10pipe.vae.enable_tiling()
11
12generator = torch.Generator(device=device).manual_seed(1)
13image = load_image("https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/wan_i2v_input.JPG")
14prompt="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."
15
16video = pipe(
17 prompt=prompt,
18 image=image,
19 generator=generator,
20 num_frames=121,
21 num_inference_steps=50,
22).frames[0]
23export_to_video(video, "output.mp4", fps=24)