Skip to content

HunyuanVideo: A Systematic Framework For Large Video Generation Model

Update README.md and README_zh.md

ckczzj912950c1e30f
diff --git a/README.md b/README.md
index 4907b9b..285909c 100644
--- a/README.md
+++ b/README.md
@@ -50,6 +50,17 @@ This repo contains PyTorch model definitions, pre-trained weights and inference/
* Dec 7, 2024: 🚀 We release the parallel inference code for HunyuanVideo powered by [xDiT](https://github.com/xdit-project/xDiT).
* Dec 3, 2024: 👋 We release the inference code and model weights of HunyuanVideo.
+
+
+## 🧩 Projects that use HunyuanVideo
+
+If you develop/use HunyuanVideo in your projects, welcome to let us know.
+- ComfyUI (with support for F8 Inference and Video2Video Generation): [ComfyUI-HunyuanVideoWrapper](https://github.com/kijai/ComfyUI-HunyuanVideoWrapper) by [Kijai](https://github.com/kijai)
+- FastVideo (consistency distilled model): [FastVideo](https://github.com/hao-ai-lab/FastVideo) by [Hao AI Lab](https://hao-ai-lab.github.io/)
+
+
+
+
## 📑 Open-source Plan
- HunyuanVideo (Text-to-Video Model)
@@ -66,10 +77,13 @@ This repo contains PyTorch model definitions, pre-trained weights and inference/
- [ ] Inference
- [ ] Checkpoints
+
+
## Contents
- [HunyuanVideo: A Systematic Framework For Large Video Generation Model](#hunyuanvideo-a-systematic-framework-for-large-video-generation-model)
- [🎥 Demo](#-demo)
- [🔥🔥🔥 News!!](#-news)
+ - [🧩 Projects that use HunyuanVideo](#-projects-that-use-hunyuanvideo)
- [📑 Open-source Plan](#-open-source-plan)
- [Contents](#contents)
- [**Abstract**](#abstract)
@@ -93,7 +107,6 @@ This repo contains PyTorch model definitions, pre-trained weights and inference/
- [🚀 FP8 Inference](#--fp8-inference)
- [Using Command Line](#using-command-line-2)
- [🔗 BibTeX](#-bibtex)
- - [🧩 Projects that use HunyuanVideo](#-projects-that-use-hunyuanvideo)
- [Acknowledgements](#acknowledgements)
- [Star History](#star-history)
---
@@ -103,6 +116,8 @@ We present HunyuanVideo, a novel open-source video foundation model that exhibit
We conducted extensive experiments and implemented a series of targeted designs to ensure high visual quality, motion diversity, text-video alignment, and generation stability. According to professional human evaluation results, HunyuanVideo outperforms previous state-of-the-art models, including Runway Gen-3, Luma 1.6, and 3 top-performing Chinese video generative models. By releasing the code and weights of the foundation model and its applications, we aim to bridge the gap between closed-source and open-source video foundation models. This initiative will empower everyone in the community to experiment with their ideas, fostering a more dynamic and vibrant video generation ecosystem.
+
+
## **HunyuanVideo Overall Architecture**
HunyuanVideo is trained on a spatial-temporally
@@ -114,7 +129,9 @@ the 3D VAE decoder.
<img src="https://raw.githubusercontent.com/Tencent/HunyuanVideo/refs/heads/main/assets/overall.png" height=300>
</p>
+
## 🎉 **HunyuanVideo Key Features**
+
### **Unified Image and Video Generative Architecture**
HunyuanVideo introduces the Transformer design and employs a Full Attention mechanism for unified image and video generation.
Specifically, we use a "Dual-stream to Single-stream" hybrid model design for video generation. In the dual-stream phase, video and text
@@ -147,6 +164,8 @@ We provide two rewrite modes: Normal mode and Master mode, which can be called u
The Prompt Rewrite Model can be directly deployed and inferred using the [Hunyuan-Large original code](https://github.com/Tencent/Tencent-Hunyuan-Large). We release the weights of the Prompt Rewrite Model [here](https://huggingface.co/Tencent/HunyuanVideo-PromptRewrite).
+
+
## 📈 Comparisons
To evaluate the performance of HunyuanVideo, we selected five strong baselines from closed-source video generation models. In total, we utilized 1,533 text prompts, generating an equal number of video samples with HunyuanVideo in a single run. For a fair comparison, we conducted inference only once, avoiding any cherry-picking of results. When comparing with the baseline methods, we maintained the default settings for all selected models, ensuring consistent video resolution. Videos were assessed based on three criteria: Text Alignment, Motion Quality, and Visual Quality. More than 60 professional evaluators performed the evaluation. Notably, HunyuanVideo demonstrated the best overall performance, particularly excelling in motion quality. Please note that the evaluation is based on Hunyuan Video's high-quality version. This is different from the currently released fast version.
@@ -181,6 +200,7 @@ To evaluate the performance of HunyuanVideo, we selected five strong baselines f
</table>
</p>
+
## 📜 Requirements
The following table shows the requirements for running HunyuanVideo model (batch size = 1) to generate videos:
@@ -196,6 +216,8 @@ The following table shows the requirements for running HunyuanVideo model (batch
* **Recommended**: We recommend using a GPU with 80GB of memory for better generation quality.
* Tested operating system: Linux
+
+
## 🛠️ Dependencies and Installation
Begin by cloning the repository:
@@ -268,7 +290,10 @@ docker run -itd --gpus all --init --net=host --uts=host --ipc=host --name hunyua
The details of download pretrained models are shown [here](ckpts/README.md).
+
+
## 🔑 Single-gpu Inference
+
We list the height/width/frame settings we support in the following table.
| Resolution | h/w=9:16 | h/w=16:9 | h/w=4:3 | h/w=3:4 | h/w=1:1 |
@@ -317,6 +342,7 @@ We list some more useful configurations for easy usage:
| `--save-path` | ./results | Path to save the generated video |
+
## 🚀 Parallel Inference on Multiple GPUs by xDiT
[xDiT](https://github.com/xdit-project/xDiT) is a Scalable Inference Engine for Diffusion Transformers (DiTs) on multi-GPU Clusters.
@@ -398,6 +424,8 @@ You can change the `--ulysses-degree` and `--ring-degree` to control the paralle
</table>
</p>
+
+
## 🚀 FP8 Inference
Using HunyuanVideo with FP8 quantized weights, which saves about 10GB of GPU memory. You can download the [weights](https://huggingface.co/tencent/HunyuanVideo/blob/main/hunyuan-video-t2v-720p/transformers/mp_rank_00_model_states_fp8.pt) and [weight scales](https://huggingface.co/tencent/HunyuanVideo/blob/main/hunyuan-video-t2v-720p/transformers/mp_rank_00_model_states_fp8_map.pt) from Huggingface.
@@ -426,7 +454,10 @@ python3 sample_video.py \
--save-path ./results
```
+
+
## 🔗 BibTeX
+
If you find [HunyuanVideo](https://arxiv.org/abs/2412.03603) useful for your research and applications, please cite using this BibTeX:
```BibTeX
@@ -442,22 +473,15 @@ If you find [HunyuanVideo](https://arxiv.org/abs/2412.03603) useful for your res
-## 🧩 Projects that use HunyuanVideo
-
-If you develop/use HunyuanVideo in your projects, welcome to let us know.
-
-- ComfyUI (with support for F8 Inference and Video2Video Generation): [ComfyUI-HunyuanVideoWrapper](https://github.com/kijai/ComfyUI-HunyuanVideoWrapper) by [Kijai](https://github.com/kijai)
-
-- FastVideo (consistency distilled model): [FastVideo](https://github.com/hao-ai-lab/FastVideo) by [Hao AI Lab](https://hao-ai-lab.github.io/)
-
-
-
## Acknowledgements
We would like to thank the contributors to the [SD3](https://huggingface.co/stabilityai/stable-diffusion-3-medium), [FLUX](https://github.com/black-forest-labs/flux), [Llama](https://github.com/meta-llama/llama), [LLaVA](https://github.com/haotian-liu/LLaVA), [Xtuner](https://github.com/InternLM/xtuner), [diffusers](https://github.com/huggingface/diffusers) and [HuggingFace](https://huggingface.co) repositories, for their open research and exploration.
Additionally, we also thank the Tencent Hunyuan Multimodal team for their help with the text encoder.
+
+
## Star History
+
<a href="https://star-history.com/#Tencent/HunyuanVideo&Date">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=Tencent/HunyuanVideo&type=Date&theme=dark" />
diff --git a/README_zh.md b/README_zh.md
index be79793..1454227 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -44,12 +44,25 @@
<video width="70%" src="https://github.com/user-attachments/assets/22440764-0d7e-438e-a44d-d0dad1006d3d" poster="./assets/video_poster.png"> </video>
</div>
+
## 🔥🔥🔥 更新!!
* 2024年12月18日: 🏃‍♂️ 开源 HunyuanVideo [FP8 模型权重](https://huggingface.co/tencent/HunyuanVideo/blob/main/hunyuan-video-t2v-720p/transformers/mp_rank_00_model_states_fp8.pt),节省更多 GPU 显存。
* 2024年12月17日: 🤗 HunyuanVideo已经集成到[Diffusers](https://huggingface.co/docs/diffusers/main/api/pipelines/hunyuan_video)中。
* 2024年12月03日: 🚀 开源 HunyuanVideo 多卡并行推理代码,由[xDiT](https://github.com/xdit-project/xDiT)提供。
* 2024年12月03日: 👋 开源 HunyuanVideo 文生视频的推理代码和模型权重。
+
+
+## 🧩 使用 HunyuanVideo 的项目
+
+如果您的项目中有开发或使用 HunyuanVideo,欢迎告知我们。
+
+- ComfyUI (支持F8推理和Video2Video生成): [ComfyUI-HunyuanVideoWrapper](https://github.com/kijai/ComfyUI-HunyuanVideoWrapper) by [Kijai](https://github.com/kijai)
+
+- FastVideo (一致性蒸馏模型): [FastVideo](https://github.com/hao-ai-lab/FastVideo) by [Hao AI Lab](https://hao-ai-lab.github.io/)
+
+
+
## 📑 开源计划
- HunyuanVideo (文生视频模型)
@@ -66,7 +79,10 @@
- [ ] 推理代码
- [ ] 模型权重
+
+
## 目录
+
- [HunyuanVideo: A Systematic Framework For Large Video Generation Model](#hunyuanvideo-a-systematic-framework-for-large-video-generation-model)
- [🎥 作品展示](#-作品展示)
- [🔥🔥🔥 更新!!](#-更新)
@@ -98,12 +114,16 @@
- [Star 趋势](#star-趋势)
---
+
+
## **摘要**
+
HunyuanVideo 是一个全新的开源视频生成大模型,具有与领先的闭源模型相媲美甚至更优的视频生成表现。为了训练 HunyuanVideo,我们采用了一个全面的框架,集成了数据整理、图像-视频联合模型训练和高效的基础设施以支持大规模模型训练和推理。此外,通过有效的模型架构和数据集扩展策略,我们成功地训练了一个拥有超过 130 亿参数的视频生成模型,使其成为最大的开源视频生成模型之一。
我们在模型结构的设计上做了大量的实验以确保其能拥有高质量的视觉效果、多样的运动、文本-视频对齐和生成稳定性。根据专业人员的评估结果,HunyuanVideo 在综合指标上优于以往的最先进模型,包括 Runway Gen-3、Luma 1.6 和 3 个中文社区表现最好的视频生成模型。**通过开源基础模型和应用模型的代码和权重,我们旨在弥合闭源和开源视频基础模型之间的差距,帮助社区中的每个人都能够尝试自己的想法,促进更加动态和活跃的视频生成生态。**
+
## **HunyuanVideo 的架构**
HunyuanVideo 是一个隐空间模型,训练时它采用了 3D VAE 压缩时间维度和空间维度的特征。文本提示通过一个大语言模型编码后作为条件输入模型,引导模型通过对高斯噪声的多步去噪,输出一个视频的隐空间表示。最后,推理时通过 3D VAE 解码器将隐空间表示解码为视频。
@@ -111,7 +131,9 @@ HunyuanVideo 是一个隐空间模型,训练时它采用了 3D VAE 压缩时
<img src="https://raw.githubusercontent.com/Tencent/HunyuanVideo/refs/heads/main/assets/overall.png" height=300>
</p>
+
## 🎉 **亮点**
+
### **统一的图视频生成架构**
HunyuanVideo 采用了 Transformer 和 Full Attention 的设计用于视频生成。具体来说,我们使用了一个“双流到单流”的混合模型设计用于视频生成。在双流阶段,视频和文本 token 通过并行的 Transformer Block 独立处理,使得每个模态可以学习适合自己的调制机制而不会相互干扰。在单流阶段,我们将视频和文本 token 连接起来并将它们输入到后续的 Transformer Block 中进行有效的多模态信息融合。这种设计捕捉了视觉和语义信息之间的复杂交互,增强了整体模型性能。
@@ -143,6 +165,8 @@ HunyuanVideo 采用了 Transformer 和 Full Attention 的设计用于视频生
Prompt 改写模型可以直接使用 [Hunyuan-Large](https://github.com/Tencent/Tencent-Hunyuan-Large) 部署和推理. 我们开源了 prompt 改写模型的权重,见[这里](https://huggingface.co/Tencent/HunyuanVideo-PromptRewrite).
+
+
## 📈 能力评估
为了评估 HunyuanVideo 的能力,我们选择了四个闭源视频生成模型作为对比。我们总共使用了 1,533 个 prompt,每个 prompt 通过一次推理生成了相同数量的视频样本。为了公平比较,我们只进行了一次推理以避免任何挑选。在与其他方法比较时,我们保持了所有选择模型的默认设置,并确保了视频分辨率的一致性。视频根据三个标准进行评估:文本对齐、运动质量和视觉质量。在 60 多名专业评估人员评估后,HunyuanVideo 在综合指标上表现最好,特别是在运动质量方面表现较为突出。
@@ -174,6 +198,7 @@ Prompt 改写模型可以直接使用 [Hunyuan-Large](https://github.com/Tencent
</table>
</p>
+
## 📜 运行配置
下表列出了运行 HunyuanVideo 模型使用文本生成视频的推荐配置(batch size = 1):
@@ -188,6 +213,8 @@ Prompt 改写模型可以直接使用 [Hunyuan-Large](https://github.com/Tencent
* 运行 720px1280px129f 的最小显存要求是 60GB,544px960px129f 的最小显存要求是 45GB。
* 测试操作系统:Linux
+
+
## 🛠️ 安装和依赖
首先克隆 git 仓库:
@@ -258,7 +285,10 @@ docker run -itd --gpus all --init --net=host --uts=host --ipc=host --name hunyua
下载预训练模型参考[这里](ckpts/README.md)。
+
+
## 🔑 单卡推理
+
我们在下表中列出了支持的高度/宽度/帧数设置。
| 分辨率 | h/w=9:16 | h/w=16:9 | h/w=4:3 | h/w=3:4 | h/w=1:1 |
@@ -308,6 +338,7 @@ python3 gradio_server.py --flow-reverse
| `--save-path` | ./results | 保存路径 |
+
## 🚀 使用 xDiT 实现多卡并行推理
[xDiT](https://github.com/xdit-project/xDiT) 是一个针对多 GPU 集群的扩展推理引擎,用于扩展 Transformers(DiTs)。
@@ -388,6 +419,8 @@ torchrun --nproc_per_node=8 sample_video_parallel.py \
</table>
</p>
+
+
## 🚀 FP8 Inference
使用FP8量化后的HunyuanVideo模型能够帮您节省大概10GB显存。 使用前需要从 Huggingface 下载[FP8权重](https://huggingface.co/tencent/HunyuanVideo/blob/main/hunyuan-video-t2v-720p/transformers/mp_rank_00_model_states_fp8.pt)和每层量化权重的[scale参数](https://huggingface.co/tencent/HunyuanVideo/blob/main/hunyuan-video-t2v-720p/transformers/mp_rank_00_model_states_fp8_map.pt).
@@ -416,7 +449,10 @@ python3 sample_video.py \
--save-path ./results
```
+
+
## 🔗 BibTeX
+
如果您认为 [HunyuanVideo](https://arxiv.org/abs/2412.03603) 给您的研究和应用带来了一些帮助,可以通过下面的方式来引用:
```BibTeX
@@ -431,21 +467,12 @@ python3 sample_video.py \
-## 🧩 使用 HunyuanVideo 的项目
-
-如果您的项目中有开发或使用 HunyuanVideo,欢迎告知我们。
-
-- ComfyUI (支持F8推理和Video2Video生成): [ComfyUI-HunyuanVideoWrapper](https://github.com/kijai/ComfyUI-HunyuanVideoWrapper) by [Kijai](https://github.com/kijai)
-
-- FastVideo (一致性蒸馏模型): [FastVideo](https://github.com/hao-ai-lab/FastVideo) by [Hao AI Lab](https://hao-ai-lab.github.io/)
-
-
-
## 致谢
HunyuanVideo 的开源离不开诸多开源工作,这里我们特别感谢 [SD3](https://huggingface.co/stabilityai/stable-diffusion-3-medium), [FLUX](https://github.com/black-forest-labs/flux), [Llama](https://github.com/meta-llama/llama), [LLaVA](https://github.com/haotian-liu/LLaVA), [Xtuner](https://github.com/InternLM/xtuner), [diffusers](https://github.com/huggingface/diffusers) and [HuggingFace](https://huggingface.co) 的开源工作和探索。另外,我们也感谢腾讯混元多模态团队对 HunyuanVideo 适配多种文本编码器的支持。
+
## Star 趋势
<a href="https://star-history.com/#Tencent/HunyuanVideo&Date">