|
| 1 | +<!-- Copyright 2025 The HuggingFace Team. All rights reserved. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. --> |
| 14 | + |
| 15 | +<div style="float: right;"> |
| 16 | + <div class="flex flex-wrap space-x-1"> |
| 17 | + <a href="https://huggingface.co/docs/diffusers/main/en/tutorials/using_peft_for_inference" target="_blank" rel="noopener"> |
| 18 | + <img alt="LoRA" src="https://img.shields.io/badge/LoRA-d8b4fe?style=flat"/> |
| 19 | + </a> |
| 20 | + </div> |
| 21 | +</div> |
| 22 | + |
| 23 | +# HunyuanVideo-1.5 |
| 24 | + |
| 25 | +HunyuanVideo-1.5 is a lightweight yet powerful video generation model that achieves state-of-the-art visual quality and motion coherence with only 8.3 billion parameters, enabling efficient inference on consumer-grade GPUs. This achievement is built upon several key components, including meticulous data curation, an advanced DiT architecture with selective and sliding tile attention (SSTA), enhanced bilingual understanding through glyph-aware text encoding, progressive pre-training and post-training, and an efficient video super-resolution network. Leveraging these designs, we developed a unified framework capable of high-quality text-to-video and image-to-video generation across multiple durations and resolutions. Extensive experiments demonstrate that this compact and proficient model establishes a new state-of-the-art among open-source models. |
| 26 | + |
| 27 | +You can find all the original HunyuanVideo checkpoints under the [Tencent](https://huggingface.co/tencent) organization. |
| 28 | + |
| 29 | +> [!TIP] |
| 30 | +> Click on the HunyuanVideo models in the right sidebar for more examples of video generation tasks. |
| 31 | +> |
| 32 | +> The examples below use a checkpoint from [hunyuanvideo-community](https://huggingface.co/hunyuanvideo-community) because the weights are stored in a layout compatible with Diffusers. |
| 33 | +
|
| 34 | +The example below demonstrates how to generate a video optimized for memory or inference speed. |
| 35 | + |
| 36 | +<hfoptions id="usage"> |
| 37 | +<hfoption id="memory"> |
| 38 | + |
| 39 | +Refer to the [Reduce memory usage](../../optimization/memory) guide for more details about the various memory saving techniques. |
| 40 | + |
| 41 | + |
| 42 | +```py |
| 43 | +import torch |
| 44 | +from diffusers import AutoModel, HunyuanVideo15Pipeline |
| 45 | +from diffusers.utils import export_to_video |
| 46 | + |
| 47 | + |
| 48 | +pipeline = HunyuanVideo15Pipeline.from_pretrained( |
| 49 | + "HunyuanVideo-1.5-Diffusers-480p_t2v", |
| 50 | + torch_dtype=torch.bfloat16, |
| 51 | +) |
| 52 | + |
| 53 | +# model-offloading and tiling |
| 54 | +pipeline.enable_model_cpu_offload() |
| 55 | +pipeline.vae.enable_tiling() |
| 56 | + |
| 57 | +prompt = "A fluffy teddy bear sits on a bed of soft pillows surrounded by children's toys." |
| 58 | +video = pipeline(prompt=prompt, num_frames=61, num_inference_steps=30).frames[0] |
| 59 | +export_to_video(video, "output.mp4", fps=15) |
| 60 | +``` |
| 61 | + |
| 62 | + |
| 63 | +## HunyuanVideo15Pipeline |
| 64 | + |
| 65 | +[[autodoc]] HunyuanVideo15Pipeline |
| 66 | + - all |
| 67 | + - __call__ |
| 68 | + |
| 69 | +## HunyuanVideo15ImageToVideoPipeline |
| 70 | + |
| 71 | +[[autodoc]] HunyuanVideo15ImageToVideoPipeline |
| 72 | + - all |
| 73 | + - __call__ |
| 74 | + |
| 75 | +## HunyuanVideo15PipelineOutput |
| 76 | + |
| 77 | +[[autodoc]] pipelines.hunyuan_video1_5.pipeline_output.HunyuanVideo15PipelineOutput |
0 commit comments