|
46 | 46 | ```python |
47 | 47 | >>> import torch |
48 | 48 | >>> from diffusers import HunyuanSkyreelsImageToVideoPipeline, HunyuanVideoTransformer3DModel |
49 | | - >>> from diffusers.utils import export_to_video |
| 49 | + >>> from diffusers.utils import load_image, export_to_video |
50 | 50 |
|
51 | 51 | >>> model_id = "hunyuanvideo-community/HunyuanVideo" |
| 52 | + >>> transformer_model_id = "Skywork/SkyReels-V1-Hunyuan-I2V" |
52 | 53 | >>> transformer = HunyuanVideoTransformer3DModel.from_pretrained( |
53 | | - ... model_id, subfolder="transformer", torch_dtype=torch.bfloat16 |
| 54 | + ... transformer_model_id, torch_dtype=torch.bfloat16 |
54 | 55 | ... ) |
55 | 56 | >>> pipe = HunyuanSkyreelsImageToVideoPipeline.from_pretrained( |
56 | 57 | ... model_id, transformer=transformer, torch_dtype=torch.float16 |
57 | 58 | ... ) |
58 | 59 | >>> pipe.vae.enable_tiling() |
59 | 60 | >>> pipe.to("cuda") |
60 | 61 |
|
| 62 | + >>> prompt = "An astronaut hatching from an egg, on the surface of the moon, the darkness and depth of space realised in the background. High quality, ultrarealistic detail and breath-taking movie-like camera shot." |
| 63 | + >>> negative_prompt = "Aerial view, aerial view, overexposed, low quality, deformation, a poor composition, bad hands, bad teeth, bad eyes, bad limbs, distortion" |
| 64 | + >>> image = load_image( |
| 65 | + ... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/astronaut.jpg" |
| 66 | + ... ) |
| 67 | +
|
61 | 68 | >>> output = pipe( |
62 | | - ... prompt="A cat walks on the grass, realistic", |
63 | | - ... height=320, |
64 | | - ... width=512, |
65 | | - ... num_frames=61, |
| 69 | + ... image=image, |
| 70 | + ... prompt=prompt, |
| 71 | + ... negative_prompt=negative_prompt, |
66 | 72 | ... num_inference_steps=30, |
| 73 | + ... true_cfg_scale=6.0, |
| 74 | + ... guidance_scale=1.0, |
67 | 75 | ... ).frames[0] |
68 | | - >>> export_to_video(output, "output.mp4", fps=15) |
| 76 | + >>> export_to_video(output, "output_i2v.mp4", fps=15) |
69 | 77 | ``` |
70 | 78 | """ |
71 | 79 |
|
|
0 commit comments