HunyuanVideo: A Systematic Framework For Large Video Generation Model
update readme after merge xdit
Tian Qi3f59a8186fd6
diff --git a/README.md b/README.mdindex bc75daa..9e15a4c 100644--- a/README.md+++ b/README.md@@ -38,7 +38,7 @@ This repo contains PyTorch model definitions, pre-trained weights and inference/The video is heavily compressed due to compliance of GitHub policy. The high quality version can be downloaded from [here](https://aivideo.hunyuan.tencent.com/download/HunyuanVideo/material/demo.mov).## 🔥🔥🔥 News!!-* Dec 6, 2024: 🤗 We release the parallel inference code for HunyuanVideo powered by [xDiT](https://github.com/xdit-project/xDiT).+* 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.## 📑 Open-source Plan@@ -46,20 +46,20 @@ The video is heavily compressed due to compliance of GitHub policy. The high qua- HunyuanVideo (Text-to-Video Model)- [x] Inference- [x] Checkpoints- - [x] Multi-gpus Sequence Parallel inference+ - [x] Multi-gpus Sequence Parallel inference (Faster inference speed on more gpus)- [ ] Penguin Video Benchmark- [ ] Web Demo (Gradio)- [ ] ComfyUI- [ ] Diffusers- - [ ] Multi-gpus PipeFuison inference (Low Memory Requirmenets)+ - [ ] Multi-gpus PipeFusion inference (Low memory requirmenets)- HunyuanVideo (Image-to-Video Model)- [ ] Inference- [ ] Checkpoints## Contents-- [HunyuanVideo: A Systematic Framework For Large Video Generation Model](#hunyuanvideo--a-systematic-framework-for-large-video-generation-model)+- [HunyuanVideo: A Systematic Framework For Large Video Generation Model](#hunyuanvideo-a-systematic-framework-for-large-video-generation-model)- [🎥 Demo](#-demo)- - [🔥🔥🔥 News!!](#-news!!)+ - [🔥🔥🔥 News!!](#-news)- [📑 Open-source Plan](#-open-source-plan)- [Contents](#contents)- [**Abstract**](#abstract)@@ -71,14 +71,19 @@ The video is heavily compressed due to compliance of GitHub policy. The high qua- [**Prompt Rewrite**](#prompt-rewrite)- [📈 Comparisons](#-comparisons)- [📜 Requirements](#-requirements)- - [🛠️ Dependencies and Installation](#-dependencies-and-installation)+ - [🛠️ Dependencies and Installation](#️-dependencies-and-installation)- [Installation Guide for Linux](#installation-guide-for-linux)- [🧱 Download Pretrained Models](#-download-pretrained-models)- - [🔑 Inference](#-inference)+ - [🔑 Single-gpu Inference](#-single-gpu-inference)- [Using Command Line](#using-command-line)- [More Configurations](#more-configurations)+ - [🚀 Parallel Inference on Multiple GPUs by xDiT](#-parallel-inference-on-multiple-gpus-by-xdit)+ - [Install Dependencies Compatible with xDiT](#install-dependencies-compatible-with-xdit)+ - [Using Command Line](#using-command-line-1)- [🔗 BibTeX](#-bibtex)+ - [🧩 Projects that use HunyuanVideo](#-projects-that-use-hunyuanvideo)- [Acknowledgements](#acknowledgements)+ - [Star History](#star-history)---## **Abstract**@@ -168,10 +173,10 @@ To evaluate the performance of HunyuanVideo, we selected five strong baselines fThe following table shows the requirements for running HunyuanVideo model (batch size = 1) to generate videos:-| Model | Setting<br/>(height/width/frame) | Denoising step | GPU Peak Memory |-|:------------:|:--------------------------------:|:--------------:|:----------------:|-| HunyuanVideo | 720px1280px129f | 50 | 60GB |-| HunyuanVideo | 544px960px129f | 50 | 45GB |+| Model | Setting<br/>(height/width/frame) | GPU Peak Memory |+|:------------:|:--------------------------------:|:----------------:|+| HunyuanVideo | 720px1280px129f | 60GB |+| HunyuanVideo | 544px960px129f | 45GB |* An NVIDIA GPU with CUDA support is required.* The model is tested on a single 80G GPU.@@ -226,7 +231,7 @@ docker run -itd --gpus all --init --net=host --uts=host --ipc=host --name hunyuaThe details of download pretrained models are shown [here](ckpts/README.md).-## 🔑 Inference+## 🔑 Single-gpu InferenceWe 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 |@@ -267,15 +272,15 @@ 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+## 🚀 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.-It has successfully provide low latency parallel infernece solution for a varitey of DiTs models, including mochi-1, CogVideoX, Flux.1, SD3, etc. This repo adoped the [Unified Sequence Parallelism (USP)](https://arxiv.org/abs/2405.07719) APIs for parallel inference of the HunyuanVideo model.+It has successfully provided low-latency parallel inference solutions for a variety of DiTs models, including mochi-1, CogVideoX, Flux.1, SD3, etc. This repo adopted the [Unified Sequence Parallelism (USP)](https://arxiv.org/abs/2405.07719) APIs for parallel inference of the HunyuanVideo model.### Install Dependencies Compatible with xDiT```-# 1. create a black conda environment+# 1. Create a black conda environmentconda create -n hunyuanxdit python==3.10.9conda activate hunyuanxditdiff --git a/README_zh.md b/README_zh.mdindex 04a9ea4..0976a99 100644--- a/README_zh.md+++ b/README_zh.md@@ -46,18 +46,18 @@- HunyuanVideo (文生视频模型)- [x] 推理代码- [x] 模型权重- - [x] Penguin Video 基准测试集- - [x] 多GPU序列并行推理- - [ ] Gradio+ - [x] 多GPU序列并行推理(GPU 越多,推理速度越快)+ - [ ] Penguin Video 基准测试集+ - [ ] Web Demo (Gradio)- [ ] ComfyUI- [ ] Diffusers- - [ ] 多GPU PipeFuison并行推理 (低显存需求)+ - [ ] 多GPU PipeFusion并行推理 (更低显存需求)- HunyuanVideo (图生视频模型)- [ ] 推理代码- [ ] 模型权重## 目录-- [HunyuanVideo: A Systematic Framework For Large Video Generation Model](#hunyuanvideo--a-systematic-framework-for-large-video-generation-model)+- [HunyuanVideo: A Systematic Framework For Large Video Generation Model](#hunyuanvideo-a-systematic-framework-for-large-video-generation-model)- [🎥 作品展示](#-作品展示)- [🔥🔥🔥 更新!!](#-更新)- [📑 开源计划](#-开源计划)@@ -71,14 +71,19 @@- [**Prompt 改写**](#prompt-改写)- [📈 能力评估](#-能力评估)- [📜 运行配置](#-运行配置)- - [🛠️ 安装和依赖](#-安装和依赖)+ - [🛠️ 安装和依赖](#️-安装和依赖)- [Linux 安装指引](#linux-安装指引)- [🧱 下载预训练模型](#-下载预训练模型)- [🔑 推理](#-推理)- [使用命令行](#使用命令行)- [更多配置](#更多配置)+ - [🚀 使用 xDiT 实现多卡并行推理](#-使用-xdit-实现多卡并行推理)+ - [安装与 xDiT 兼容的依赖项](#安装与-xdit-兼容的依赖项)+ - [使用命令行](#使用命令行-1)- [🔗 BibTeX](#-bibtex)+ - [🧩 使用 HunyuanVideo 的项目](#-使用-hunyuanvideo-的项目)- [致谢](#致谢)+ - [Star 趋势](#star-趋势)---## **摘要**@@ -161,10 +166,10 @@ Prompt 改写模型可以直接使用 [Hunyuan-Large](https://github.com/Tencent下表列出了运行 HunyuanVideo 模型使用文本生成视频的推荐配置(batch size = 1):-| 模型 | 分辨率<br/>(height/width/frame) | 去噪步数 | 峰值显存 |-|:--------------:|:--------------------------------:|:--------------:|:----------------:|-| HunyuanVideo | 720px1280px129f | 30 | 60G |-| HunyuanVideo | 544px960px129f | 30 | 45G |+| 模型 | 分辨率<br/>(height/width/frame) | 峰值显存 |+|:--------------:|:--------------------------------:|:----------------:|+| HunyuanVideo | 720px1280px129f | 60G |+| HunyuanVideo | 544px960px129f | 45G |* 本项目适用于使用 NVIDIA GPU 和支持 CUDA 的设备* 模型在单张 80G GPU 上测试@@ -186,16 +191,17 @@ cd HunyuanVideo我们推理使用 CUDA 11.8 或 12.0+ 的版本。```shell-# 1. 准备 conda 环境+# 1. Prepare conda environmentconda env create -f environment.yml-# 2. 激活环境+# 2. Activate the environmentconda activate HunyuanVideo-# 3. 安装 pip 依赖+# 3. Install pip dependenciespython -m pip install -r requirements.txt-# 4. 安装 flash attention v2 用于加速 (要求 CUDA 11.8 或更高)+# 4. Install flash attention v2 for acceleration (requires CUDA 11.8 or above)+python -m pip install ninjapython -m pip install git+https://github.com/Dao-AILab/[email protected]```@@ -256,7 +262,7 @@ python3 sample_video.py \| `--save-path` | ./results | 保存路径 |-## 使用 xDiT 实现多卡并行推理+## 🚀 使用 xDiT 实现多卡并行推理[xDiT](https://github.com/xdit-project/xDiT) 是一个针对多 GPU 集群的扩展推理引擎,用于扩展 Transformers(DiTs)。它成功为各种 DiT 模型(包括 mochi-1、CogVideoX、Flux.1、SD3 等)提供了低延迟的并行推理解决方案。该存储库采用了 [Unified Sequence Parallelism (USP)](https://arxiv.org/abs/2405.07719) API 用于混元视频模型的并行推理。@@ -331,6 +337,29 @@ torchrun --nproc_per_node=8 sample_video_parallel.py \</details>+<p align="center">+<table align="center">+<thead>+<tr>+ <th colspan="4">在 8xGPU上生成1280x720 (129 帧 50 步)的时耗 (秒) </th>+</tr>+<tr>+ <th>1</th>+ <th>4</th>+ <th>8</th>+</tr>+</thead>+<tbody>+<tr>+ <th>1904.08</th>+ <th>514.08</th>+ <th>337.58</th>+</tr>++</tbody>+</table>+</p>+## 🔗 BibTeX如果您认为 [HunyuanVideo](https://arxiv.org/abs/2412.03603) 给您的研究和应用带来了一些帮助,可以通过下面的方式来引用: