|
51 | 51 | Examples:
|
52 | 52 | ```python
|
53 | 53 | >>> import torch
|
54 |
| - >>> from diffusers import HunyuanVideoPipeline, HunyuanVideoTransformer3DModel |
55 |
| - >>> from diffusers.utils import export_to_video |
| 54 | + >>> from diffusers import HunyuanVideoImageToVideoPipeline, HunyuanVideoTransformer3DModel |
| 55 | + >>> from diffusers.utils import load_image, export_to_video |
56 | 56 |
|
57 |
| - >>> model_id = "hunyuanvideo-community/HunyuanVideo" |
| 57 | + >>> model_id = "hunyuanvideo-community/HunyuanVideo-I2V" |
58 | 58 | >>> transformer = HunyuanVideoTransformer3DModel.from_pretrained(
|
59 | 59 | ... model_id, subfolder="transformer", torch_dtype=torch.bfloat16
|
60 | 60 | ... )
|
61 |
| - >>> pipe = HunyuanVideoPipeline.from_pretrained(model_id, transformer=transformer, torch_dtype=torch.float16) |
| 61 | + >>> pipe = HunyuanVideoImageToVideoPipeline.from_pretrained( |
| 62 | + ... model_id, transformer=transformer, torch_dtype=torch.float16 |
| 63 | + ... ) |
62 | 64 | >>> pipe.vae.enable_tiling()
|
63 | 65 | >>> pipe.to("cuda")
|
64 | 66 |
|
| 67 | + >>> prompt = "A man with short gray hair plays a red electric guitar." |
| 68 | + >>> image = load_image( |
| 69 | + ... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/guitar-man.png" |
| 70 | + ... ) |
| 71 | +
|
65 | 72 | >>> output = pipe(
|
66 |
| - ... prompt="A cat walks on the grass, realistic", |
67 |
| - ... height=320, |
68 |
| - ... width=512, |
69 |
| - ... num_frames=61, |
70 |
| - ... num_inference_steps=30, |
| 73 | + ... image=image, |
| 74 | + ... height=720, |
| 75 | + ... width=1280, |
| 76 | + ... num_frames=129, |
| 77 | + ... prompt=prompt, |
| 78 | + ... true_cfg_scale=1.0, |
| 79 | + ... guidance_scale=1.0, |
71 | 80 | ... ).frames[0]
|
72 | 81 | >>> export_to_video(output, "output.mp4", fps=15)
|
73 | 82 | ```
|
|
0 commit comments