You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- 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
+
16
+
# HunyuanVideo-1.5
17
+
18
+
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.
19
+
20
+
You can find all the original HunyuanVideo checkpoints under the [Tencent](https://huggingface.co/tencent) organization.
21
+
22
+
> [!TIP]
23
+
> Click on the HunyuanVideo models in the right sidebar for more examples of video generation tasks.
24
+
>
25
+
> 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.
26
+
27
+
The example below demonstrates how to generate a video optimized for memory or inference speed.
28
+
29
+
<hfoptionsid="usage">
30
+
<hfoptionid="memory">
31
+
32
+
Refer to the [Reduce memory usage](../../optimization/memory) guide for more details about the various memory saving techniques.
33
+
34
+
35
+
```py
36
+
import torch
37
+
from diffusers import AutoModel, HunyuanVideo15Pipeline
prompt ="A fluffy teddy bear sits on a bed of soft pillows surrounded by children's toys."
51
+
video = pipeline(prompt=prompt, num_frames=61, num_inference_steps=30).frames[0]
52
+
export_to_video(video, "output.mp4", fps=15)
53
+
```
54
+
55
+
## Notes
56
+
57
+
- HunyuanVideo1.5 use attention masks with variable-length sequences. For best performance, we recommend using an attention backend that handles padding efficiently.
58
+
59
+
-**H100/H800:**`_flash_3_hub` or `_flash_varlen_3`
60
+
-**A100/A800/RTX 4090:**`flash_hub` or `flash_varlen`
61
+
-**Other GPUs:**`sage_hub`
62
+
63
+
Refer to the [Attention backends](../../optimization/attention_backends) guide for more details about using a different backend.
64
+
65
+
66
+
```py
67
+
pipe.transformer.set_attention_backend("flash_hub") # or your preferred backend
68
+
```
69
+
70
+
-[`HunyuanVideo15Pipeline`] use guider and does not take `guidance_scale` parameter at runtime.
71
+
72
+
You can check the default guider configuration using `pipe.guider`:
73
+
74
+
```py
75
+
>>> pipe.guider
76
+
ClassifierFreeGuidance {
77
+
"_class_name": "ClassifierFreeGuidance",
78
+
"_diffusers_version": "0.36.0.dev0",
79
+
"enabled": true,
80
+
"guidance_rescale": 0.0,
81
+
"guidance_scale": 6.0,
82
+
"start": 0.0,
83
+
"stop": 1.0,
84
+
"use_original_formulation": false
85
+
}
86
+
87
+
State:
88
+
step: None
89
+
num_inference_steps: None
90
+
timestep: None
91
+
count_prepared: 0
92
+
enabled: True
93
+
num_conditions: 2
94
+
```
95
+
96
+
To update guider configuration, you can run `pipe.guider = pipe.guider.new(...)`
97
+
98
+
```py
99
+
pipe.guider = pipe.guider.new(guidance_scale=5.0)
100
+
```
101
+
102
+
Read more on Guider [here](../../modular_diffusers/guiders).
0 commit comments