From a0e5f1b7fabdb7cb3dfbb54ef8243f419dd34034 Mon Sep 17 00:00:00 2001 From: wehub-resource-sync Date: Mon, 13 Jul 2026 10:45:53 +0000 Subject: [PATCH] docs: make Chinese README the default --- README.md | 428 +++++++++++++++++++++++++----------------------------- 1 file changed, 194 insertions(+), 234 deletions(-) diff --git a/README.md b/README.md index 45440ca..2b67613 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,12 @@ + +> [!NOTE] +> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。 +> [English](./README.en.md) · [原始项目](https://github.com/zai-org/CogVideo) · [上游 README](https://github.com/zai-org/CogVideo/blob/HEAD/README.md) +> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。 + # CogVideo & CogVideoX -[中文阅读](./README_zh.md) +[Read this in English](./README.md) [日本語で読む](./README_ja.md) @@ -8,115 +14,97 @@

-Experience the CogVideoX-5B model online at 🤗 Huggingface Space or 🤖 ModelScope Space +在 🤗 Huggingface Space 🤖 ModelScope Space 在线体验 CogVideoX-5B 模型

-📚 View the paper and user guide +📚 查看 论文使用文档

- 👋 Join our WeChat and Discord + 👋 加入我们的 微信Discord

-📍 Visit QingYing and API Platform to experience larger-scale commercial video generation models. +📍 前往 清影 API平台 体验更大规模的商业版视频生成模型。

-## Project Updates +## 项目更新 -- 🔥🔥 **News**: ```2025/03/24```: We have launched [CogKit](https://github.com/THUDM/CogKit), a fine-tuning and inference framework for the **CogView4** and **CogVideoX** series. This toolkit allows you to fully explore and utilize our multimodal generation models. -- 🔥 **News**: ```2025/02/28```: DDIM Inverse is now supported in `CogVideoX-5B` and `CogVideoX1.5-5B`. Check [here](inference/ddim_inversion.py). -- 🔥 **News**: ```2025/01/08```: We have updated the code for `Lora` fine-tuning based on the `diffusers` version model, which uses less GPU memory. For more details, please see [here](finetune/README.md). -- 🔥 **News**: ```2024/11/15```: We released the `CogVideoX1.5` model in the diffusers version. Only minor parameter adjustments are needed to continue using previous code. -- 🔥 **News**: ```2024/11/08```: We have released the CogVideoX1.5 model. CogVideoX1.5 is an upgraded version of the open-source model CogVideoX. -The CogVideoX1.5-5B series supports 10-second videos with higher resolution, and CogVideoX1.5-5B-I2V supports video generation at any resolution. -The SAT code has already been updated, while the diffusers version is still under adaptation. Download the SAT version code [here](https://huggingface.co/THUDM/CogVideoX1.5-5B-SAT). -- 🔥 **News**: ```2024/10/13```: A more cost-effective fine-tuning framework for `CogVideoX-5B` that works with a single - 4090 GPU, [cogvideox-factory](https://github.com/a-r-r-o-w/cogvideox-factory), has been released. It supports - fine-tuning with multiple resolutions. Feel free to use it! -- 🔥 **News**: ```2024/10/10```: We have updated our technical report. Please - click [here](https://arxiv.org/pdf/2408.06072) to view it. More training details and a demo have been added. To see - the demo, click [here](https://yzy-thu.github.io/CogVideoX-demo/).- 🔥 **News**: ```2024/10/09```: We have publicly - released the [technical documentation](https://zhipu-ai.feishu.cn/wiki/DHCjw1TrJiTyeukfc9RceoSRnCh) for CogVideoX - fine-tuning on Feishu, further increasing distribution flexibility. All examples in the public documentation can be - fully reproduced. -- 🔥 **News**: ```2024/9/19```: We have open-sourced the CogVideoX series image-to-video model **CogVideoX-5B-I2V**. - This model can take an image as a background input and generate a video combined with prompt words, offering greater - controllability. With this, the CogVideoX series models now support three tasks: text-to-video generation, video - continuation, and image-to-video generation. Welcome to try it online - at [Experience](https://huggingface.co/spaces/THUDM/CogVideoX-5B-Space). -- 🔥 ```2024/9/19```: The Caption - model [CogVLM2-Caption](https://huggingface.co/THUDM/cogvlm2-llama3-caption), used in the training process of - CogVideoX to convert video data into text descriptions, has been open-sourced. Welcome to download and use it. -- 🔥 ```2024/8/27```: We have open-sourced a larger model in the CogVideoX series, **CogVideoX-5B**. We have - significantly optimized the model's inference performance, greatly lowering the inference threshold. - You can run **CogVideoX-2B** on older GPUs like `GTX 1080TI`, and **CogVideoX-5B** on desktop GPUs like `RTX 3060`. Please strictly - follow the [requirements](requirements.txt) to update and install dependencies, and refer - to [cli_demo](inference/cli_demo.py) for inference code. Additionally, the open-source license for - the **CogVideoX-2B** model has been changed to the **Apache 2.0 License**. -- 🔥 ```2024/8/6```: We have open-sourced **3D Causal VAE**, used for **CogVideoX-2B**, which can reconstruct videos with - almost no loss. -- 🔥 ```2024/8/6```: We have open-sourced the first model of the CogVideoX series video generation models, **CogVideoX-2B - **. -- 🌱 **Source**: ```2022/5/19```: We have open-sourced the CogVideo video generation model (now you can see it in - the `CogVideo` branch). This is the first open-source large Transformer-based text-to-video generation model. You can - access the [ICLR'23 paper](https://arxiv.org/abs/2205.15868) for technical details. +- 🔥🔥 **News**: ```2025/03/24```: 我们推出了 [CogKit](https://github.com/THUDM/CogKit) 工具,这是一个微调**CogView4**, **CogVideoX** 系列的微调和推理框架,一个工具包,玩转我们的多模态生成模型。 +- 🔥 **News**: ```2025/02/28```: DDIM Inverse 已经在`CogVideoX-5B` 和 `CogVideoX1.5 -5B` 支持,查看 [here](inference/ddim_inversion.py). +- 🔥 **News**: ```2025/01/08```: 我们更新了基于`diffusers`版本模型的`Lora`微调代码,占用显存更低,详情请见[这里](finetune/README_zh.md)。 +- 🔥 **News**: ```2024/11/15```: 我们发布 `CogVideoX1.5` 模型的diffusers版本,仅需调整部分参数即可沿用之前的代码。 +- 🔥 **News**: ```2024/11/08```: 我们发布 `CogVideoX1.5` 模型。CogVideoX1.5 是 CogVideoX 开源模型的升级版本。 +CogVideoX1.5-5B 系列模型支持 **10秒** 长度的视频和更高的分辨率,其中 `CogVideoX1.5-5B-I2V` 支持 **任意分辨率** 的视频生成,SAT代码已经更新。`diffusers`版本还在适配中。SAT版本代码前往 [这里](https://huggingface.co/THUDM/CogVideoX1.5-5B-SAT) 下载。 +- 🔥**News**: ```2024/10/13```: 成本更低,单卡4090可微调 `CogVideoX-5B` + 的微调框架[cogvideox-factory](https://github.com/a-r-r-o-w/cogvideox-factory)已经推出,多种分辨率微调,欢迎使用。 +- 🔥 **News**: ```2024/10/10```: 我们更新了我们的技术报告,请点击 [这里](https://arxiv.org/pdf/2408.06072) + 查看,附上了更多的训练细节和demo,关于demo,点击[这里](https://yzy-thu.github.io/CogVideoX-demo/) 查看。 +- 🔥 **News**: ```2024/10/09```: 我们在飞书[技术文档](https://zhipu-ai.feishu.cn/wiki/DHCjw1TrJiTyeukfc9RceoSRnCh") + 公开CogVideoX微调指导,以进一步增加分发自由度,公开文档中所有示例可以完全复现 +- 🔥 **News**: ```2024/9/19```: 我们开源 CogVideoX 系列图生视频模型 **CogVideoX-5B-I2V** + 。该模型可以将一张图像作为背景输入,结合提示词一起生成视频,具有更强的可控性。 + 至此,CogVideoX系列模型已经支持文本生成视频,视频续写,图片生成视频三种任务。欢迎前往在线[体验](https://huggingface.co/spaces/THUDM/CogVideoX-5B-Space)。 +- 🔥 **News**: ```2024/9/19```: CogVideoX 训练过程中用于将视频数据转换为文本描述的 Caption + 模型 [CogVLM2-Caption](https://huggingface.co/THUDM/cogvlm2-llama3-caption) + 已经开源。欢迎前往下载并使用。 +- 🔥 ```2024/8/27```: 我们开源 CogVideoX 系列更大的模型 **CogVideoX-5B** + 。我们大幅度优化了模型的推理性能,推理门槛大幅降低,您可以在 `GTX 1080TI` 等早期显卡运行 **CogVideoX-2B**,在 `RTX 3060` + 等桌面端甜品卡运行 **CogVideoX-5B** 模型。 请严格按照[要求](requirements.txt) + 更新安装依赖,推理代码请查看 [cli_demo](inference/cli_demo.py)。同时,**CogVideoX-2B** 模型开源协议已经修改为**Apache 2.0 协议**。 +- 🔥 ```2024/8/6```: 我们开源 **3D Causal VAE**,用于 **CogVideoX-2B**,可以几乎无损地重构视频。 +- 🔥 ```2024/8/6```: 我们开源 CogVideoX 系列视频生成模型的第一个模型, **CogVideoX-2B**。 +- 🌱 **Source**: ```2022/5/19```: 我们开源了 CogVideo 视频生成模型(现在你可以在 `CogVideo` 分支中看到),这是首个开源的基于 + Transformer 的大型文本生成视频模型,您可以访问 [ICLR'23 论文](https://arxiv.org/abs/2205.15868) 查看技术细节。 -## Table of Contents +## 目录 -Jump to a specific section: +跳转到指定部分: -- [Quick Start](#quick-start) - - [Prompt Optimization](#prompt-optimization) +- [快速开始](#快速开始) + - [提示词优化](#提示词优化) - [SAT](#sat) - [Diffusers](#diffusers) -- [Gallery](#gallery) +- [视频作品](#视频作品) - [CogVideoX-5B](#cogvideox-5b) - [CogVideoX-2B](#cogvideox-2b) -- [Model Introduction](#model-introduction) -- [Friendly Links](#friendly-links) -- [Project Structure](#project-structure) - - [Quick Start with Colab](#quick-start-with-colab) - - [Inference](#inference) +- [模型介绍](#模型介绍) +- [友情链接](#友情链接) +- [完整项目代码结构](#完整项目代码结构) + - [Colab 快速使用](#colab-快速使用) + - [inference](#inference) - [finetune](#finetune) - [sat](#sat-1) - - [Tools](#tools) + - [tools](#tools) - [CogVideo(ICLR'23)](#cogvideoiclr23) -- [Citation](#citation) -- [Model-License](#model-license) +- [引用](#引用) +- [模型协议](#模型协议) -## Quick Start +## 快速开始 -### Prompt Optimization +### 提示词优化 -Before running the model, please refer to [this guide](inference/convert_demo.py) to see how we use large models like -GLM-4 (or other comparable products, such as GPT-4) to optimize the model. This is crucial because the model is trained -with long prompts, and a good prompt directly impacts the quality of the video generation. +在开始运行模型之前,请参考 [这里](inference/convert_demo.py) 查看我们是怎么使用GLM-4(或者同级别的其他产品,例如GPT-4) +大模型对模型进行优化的,这很重要, +由于模型是在长提示词下训练的,一个好的提示词直接影响了视频生成的质量。 ### SAT -**Please make sure your Python version is between 3.10 and 3.12, inclusive of both 3.10 and 3.12.** - -Follow instructions in [sat_demo](sat/README.md): Contains the inference code and fine-tuning code of SAT weights. It is -recommended to improve based on the CogVideoX model structure. Innovative researchers use this code to better perform -rapid stacking and development. +查看sat文件夹下的 [sat_demo](sat/README.md):包含了 SAT 权重的推理代码和微调代码,推荐基于此代码进行 CogVideoX +模型结构的改进,研究者使用该代码可以更好的进行快速的迭代和开发。 ### Diffusers -**Please make sure your Python version is between 3.10 and 3.12, inclusive of both 3.10 and 3.12.** - ``` pip install -r requirements.txt ``` -Then follow [diffusers_demo](inference/cli_demo.py): A more detailed explanation of the inference code, mentioning the -significance of common parameters. +查看[diffusers_demo](inference/cli_demo.py):包含对推理代码更详细的解释,包括各种关键的参数。 -For more details on quantized inference, please refer -to [diffusers-torchao](https://github.com/sayakpaul/diffusers-torchao/). With Diffusers and TorchAO, quantized inference -is also possible leading to memory-efficient inference as well as speedup in some cases when compiled. A full list of -memory and time benchmarks with various settings on A100 and H100 has been published -at [diffusers-torchao](https://github.com/sayakpaul/diffusers-torchao). +欲了解更多关于量化推理的细节,请参考 [diffusers-torchao](https://github.com/sayakpaul/diffusers-torchao/)。使用 Diffusers +和 TorchAO,量化推理也是可能的,这可以实现内存高效的推理,并且在某些情况下编译后速度有所提升。有关在 A100 和 H100 +上使用各种设置的内存和时间基准测试的完整列表,已发布在 [diffusers-torchao](https://github.com/sayakpaul/diffusers-torchao) +上。 -## Gallery +## 视频作品 ### CogVideoX-5B @@ -170,94 +158,94 @@ at [diffusers-torchao](https://github.com/sayakpaul/diffusers-torchao). -To view the corresponding prompt words for the gallery, please click [here](resources/galary_prompt.md) -## Model Introduction +查看画廊的对应提示词,请点击[这里](resources/galary_prompt.md) -CogVideoX is an open-source version of the video generation model originating -from [QingYing](https://chatglm.cn/video?lang=en?fr=osm_cogvideo). The table below displays the list of video generation -models we currently offer, along with their foundational information. +## 模型介绍 - +CogVideoX是 [清影](https://chatglm.cn/video?fr=osm_cogvideox) 同源的开源版本视频生成模型。 +下表展示我们提供的视频生成模型相关基础信息: + +
- - - + + + - + - - - - - - + + + + + + - + - - - + + + - - - - + + + + - - - - + + + + - + - - - - + + + + - + - + - - - + + + - - - + + + - + - + @@ -265,19 +253,17 @@ models we currently offer, along with their foundational information. - +
Model NameCogVideoX1.5-5B (Latest)CogVideoX1.5-5B-I2V (Latest)模型名CogVideoX1.5-5B (最新)CogVideoX1.5-5B-I2V (最新) CogVideoX-2B CogVideoX-5BCogVideoX-5B-I2VCogVideoX-5B-I2V
Release DateNovember 8, 2024November 8, 2024August 6, 2024August 27, 2024September 19, 2024发布时间2024年11月8日2024年11月8日2024年8月6日2024年8月27日2024年9月19日
Video Resolution视频分辨率 1360 * 768 Min(W, H) = 768
768 ≤ Max(W, H) ≤ 1360
Max(W, H) % 16 = 0
720 * 480
Number of FramesShould be 16N + 1 where N <= 10 (default 81)Should be 8N + 1 where N <= 6 (default 49)帧数必须为 16N + 1 其中 N <= 10 (默认 81)必须为 8N + 1 其中 N <= 6 (默认 49)
Inference PrecisionBF16 (Recommended), FP16, FP32, FP8*, INT8, Not supported: INT4FP16*(Recommended), BF16, FP32, FP8*, INT8, Not supported: INT4BF16 (Recommended), FP16, FP32, FP8*, INT8, Not supported: INT4推理精度BF16(推荐), FP16, FP32,FP8*,INT8,不支持INT4FP16*(推荐), BF16, FP32,FP8*,INT8,不支持INT4BF16(推荐), FP16, FP32,FP8*,INT8,不支持INT4
Single GPU Memory Usage
SAT BF16: 76GB
diffusers BF16: from 10GB*
diffusers INT8(torchao): from 7GB*
SAT FP16: 18GB
diffusers FP16: 4GB minimum*
diffusers INT8 (torchao): 3.6GB minimum*
SAT BF16: 26GB
diffusers BF16 : 5GB minimum*
diffusers INT8 (torchao): 4.4GB minimum*
单GPU显存消耗
SAT BF16: 76GB
diffusers BF16 : 10GB起*
diffusers INT8(torchao): 7G起*
SAT FP16: 18GB
diffusers FP16: 4GB起*
diffusers INT8(torchao): 3.6G起*
SAT BF16: 26GB
diffusers BF16 : 5GB起*
diffusers INT8(torchao): 4.4G起*
Multi-GPU Memory Usage多GPU推理显存消耗 BF16: 24GB* using diffusers
FP16: 10GB* using diffusers
BF16: 15GB* using diffusers
Inference Speed
(Step = 50, FP/BF16)
Single A100: ~1000 seconds (5-second video)
Single H100: ~550 seconds (5-second video)
Single A100: ~90 seconds
Single H100: ~45 seconds
Single A100: ~180 seconds
Single H100: ~90 seconds
推理速度
(Step = 50, FP/BF16)
单卡A100: ~1000秒(5秒视频)
单卡H100: ~550秒(5秒视频)
单卡A100: ~90秒
单卡H100: ~45秒
单卡A100: ~180秒
单卡H100: ~90秒
Prompt Language提示词语言 English*
Prompt Token Limit提示词长度上限 224 Tokens 226 Tokens
Video Length5 seconds or 10 seconds6 seconds视频长度5 秒 或 10 秒6 秒
Frame Rate16 frames / second 8 frames / second 帧率16 帧 / 秒 8 帧 / 秒
Position Encoding位置编码 3d_rope_pos_embed 3d_sincos_pos_embed 3d_rope_pos_embed 3d_rope_pos_embed + learnable_pos_embed
Download Link (Diffusers)下载链接 (Diffusers) 🤗 HuggingFace
🤖 ModelScope
🟣 WiseModel
🤗 HuggingFace
🤖 ModelScope
🟣 WiseModel
🤗 HuggingFace
🤖 ModelScope
🟣 WiseModel
🤗 HuggingFace
🤖 ModelScope
🟣 WiseModel
Download Link (SAT)下载链接 (SAT) 🤗 HuggingFace
🤖 ModelScope
🟣 WiseModel
SAT
-**Data Explanation** +**数据解释** -+ While testing using the diffusers library, all optimizations included in the diffusers library were enabled. This - scheme has not been tested for actual memory usage on devices outside of **NVIDIA A100 / H100** architectures. - Generally, this scheme can be adapted to all **NVIDIA Ampere architecture** and above devices. If optimizations are - disabled, memory consumption will multiply, with peak memory usage being about 3 times the value in the table. - However, speed will increase by about 3-4 times. You can selectively disable some optimizations, including: ++ 使用 diffusers 库进行测试时,启用了全部`diffusers`库自带的优化,该方案未测试在非**NVIDIA A100 / H100** + 外的设备上的实际显存 / 内存占用。通常,该方案可以适配于所有 **NVIDIA 安培架构** + 以上的设备。若关闭优化,显存占用会成倍增加,峰值显存约为表格的3倍。但速度提升3-4倍左右。你可以选择性的关闭部分优化,这些优化包括: ``` pipe.enable_sequential_cpu_offload() @@ -285,152 +271,126 @@ pipe.vae.enable_slicing() pipe.vae.enable_tiling() ``` -+ For multi-GPU inference, the `enable_sequential_cpu_offload()` optimization needs to be disabled. -+ Using INT8 models will slow down inference, which is done to accommodate lower-memory GPUs while maintaining minimal - video quality loss, though inference speed will significantly decrease. -+ The CogVideoX-2B model was trained in `FP16` precision, and all CogVideoX-5B models were trained in `BF16` precision. - We recommend using the precision in which the model was trained for inference. -+ [PytorchAO](https://github.com/pytorch/ao) and [Optimum-quanto](https://github.com/huggingface/optimum-quanto/) can be - used to quantize the text encoder, transformer, and VAE modules to reduce the memory requirements of CogVideoX. This - allows the model to run on free T4 Colabs or GPUs with smaller memory! Also, note that TorchAO quantization is fully - compatible with `torch.compile`, which can significantly improve inference speed. FP8 precision must be used on - devices with NVIDIA H100 and above, requiring source installation of `torch`, `torchao` Python packages. CUDA 12.4 is recommended. -+ The inference speed tests also used the above memory optimization scheme. Without memory optimization, inference speed - increases by about 10%. Only the `diffusers` version of the model supports quantization. -+ The model only supports English input; other languages can be translated into English for use via large model - refinement. ++ 多GPU推理时,需要关闭 `enable_sequential_cpu_offload()` 优化。 ++ 使用 INT8 模型会导致推理速度降低,此举是为了满足显存较低的显卡能正常推理并保持较少的视频质量损失,推理速度大幅降低。 ++ CogVideoX-2B 模型采用 `FP16` 精度训练, 搜有 CogVideoX-5B 模型采用 `BF16` 精度训练。我们推荐使用模型训练的精度进行推理。 ++ [PytorchAO](https://github.com/pytorch/ao) 和 [Optimum-quanto](https://github.com/huggingface/optimum-quanto/) + 可以用于量化文本编码器、Transformer 和 VAE 模块,以降低 CogVideoX 的内存需求。这使得在免费的 T4 Colab 或更小显存的 GPU + 上运行模型成为可能!同样值得注意的是,TorchAO 量化完全兼容 `torch.compile`,这可以显著提高推理速度。在 `NVIDIA H100` + 及以上设备上必须使用 `FP8` 精度,这需要源码安装 `torch`、`torchao` Python 包。建议使用 `CUDA 12.4`。 ++ 推理速度测试同样采用了上述显存优化方案,不采用显存优化的情况下,推理速度提升约10%。 只有`diffusers`版本模型支持量化。 ++ 模型仅支持英语输入,其他语言可以通过大模型润色时翻译为英语。 +## 友情链接 -## Friendly Links +我们非常欢迎来自社区的贡献,并积极的贡献开源社区。以下作品已经对CogVideoX进行了适配,欢迎大家使用: -We highly welcome contributions from the community and actively contribute to the open-source community. The following -works have already been adapted for CogVideoX, and we invite everyone to use them: - -+ [LeMiCa](https://unicomai.github.io/LeMiCa/): a diffusion model inference acceleration solution developed by China Unicom Data Science and Artificial Intelligence Research Institute. By leveraging cache-based techniques and global denoising path optimization, LeMiCa provides efficient inference support for CogVideoX, achieving nearly 2.5x lossless acceleration while maintaining visual consistency and quality. ++ [LeMiCa](https://unicomai.github.io/LeMiCa/): 由中国联通数据科学与人工智能研究院开发的扩散模型推理加速解决方案。它利用基于缓存的技术和全局去噪路径优化,为CogVideoX提供高效的推理支持,在保持视觉一致性和质量的前提下,实现了近2.5倍的无损加速。 + [RIFLEx-CogVideoX](https://github.com/thu-ml/RIFLEx): - RIFLEx extends the video with just one line of code: `freq[k-1]=(2np.pi)/(Ls)`. The framework not only supports training-free inference, but also offers models fine-tuned based on CogVideoX. By fine-tuning the model for just 1,000 steps on original-length videos, RIFLEx significantly enhances its length extrapolation capability. -+ [CogVideoX-Fun](https://github.com/aigc-apps/CogVideoX-Fun): CogVideoX-Fun is a modified pipeline based on the - CogVideoX architecture, supporting flexible resolutions and multiple launch methods. -+ [CogStudio](https://github.com/pinokiofactory/cogstudio): A separate repository for CogVideo's Gradio Web UI, which - supports more functional Web UIs. -+ [Xorbits Inference](https://github.com/xorbitsai/inference): A powerful and comprehensive distributed inference - framework, allowing you to easily deploy your own models or the latest cutting-edge open-source models with just one - click. -+ [ComfyUI-CogVideoXWrapper](https://github.com/kijai/ComfyUI-CogVideoXWrapper) Use the ComfyUI framework to integrate - CogVideoX into your workflow. -+ [VideoSys](https://github.com/NUS-HPC-AI-Lab/VideoSys): VideoSys provides a user-friendly, high-performance - infrastructure for video generation, with full pipeline support and continuous integration of the latest models and - techniques. -+ [AutoDL Space](https://www.codewithgpu.com/i/THUDM/CogVideo/CogVideoX-5b-demo): A one-click deployment Huggingface - Space image provided by community members. -+ [Interior Design Fine-Tuning Model](https://huggingface.co/collections/bertjiazheng/koolcogvideox-66e4762f53287b7f39f8f3ba): - is a fine-tuned model based on CogVideoX, specifically designed for interior design. -+ [xDiT](https://github.com/xdit-project/xDiT): xDiT is a scalable inference engine for Diffusion Transformers (DiTs) - on multiple GPU Clusters. xDiT supports real-time image and video generations services. - [cogvideox-factory](https://github.com/a-r-r-o-w/cogvideox-factory): A cost-effective - fine-tuning framework for CogVideoX, compatible with the `diffusers` version model. Supports more resolutions, and - fine-tuning CogVideoX-5B can be done with a single 4090 GPU. -+ [CogVideoX-Interpolation](https://github.com/feizc/CogvideX-Interpolation): A pipeline based on the modified CogVideoX - structure, aimed at providing greater flexibility for keyframe interpolation generation. -+ [DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio): DiffSynth Studio is a diffusion engine. It has - restructured the architecture, including text encoders, UNet, VAE, etc., enhancing computational performance while - maintaining compatibility with open-source community models. The framework has been adapted for CogVideoX. -+ [CogVideoX-Controlnet](https://github.com/TheDenk/cogvideox-controlnet): A simple ControlNet module code that includes the CogVideoX model. -+ [VideoTuna](https://github.com/VideoVerses/VideoTuna): VideoTuna is the first repo that integrates multiple AI video generation models for text-to-video, image-to-video, text-to-image generation. -+ [ConsisID](https://github.com/PKU-YuanGroup/ConsisID): An identity-preserving text-to-video generation model, bases on CogVideoX-5B, which keep the face consistent in the generated video by frequency decomposition. -+ [A Step by Step Tutorial](https://www.youtube.com/watch?v=5UCkMzP2VLE&ab_channel=SECourses): A step-by-step guide on installing and optimizing the CogVideoX1.5-5B-I2V model in Windows and cloud environments. Special thanks to the [FurkanGozukara](https://github.com/FurkanGozukara) for his effort and support! + RIFLEx 是一个视频长度外推的方法,只需一行代码即可将视频生成长度延伸为原先的二倍。RIFLEx 不仅支持 Training-free 的推理,也提供基于 CogVideoX 进行微调的模型,只需在原有长度视频上微调 1000 步即可大大提高长度外推能力。 ++ [CogVideoX-Fun](https://github.com/aigc-apps/CogVideoX-Fun): + CogVideoX-Fun是一个基于CogVideoX结构修改后的的pipeline,支持自由的分辨率,多种启动方式。 ++ [CogStudio](https://github.com/pinokiofactory/cogstudio): CogVideo 的 Gradio Web UI单独实现仓库,支持更多功能的 Web UI。 ++ [Xorbits Inference](https://github.com/xorbitsai/inference): 性能强大且功能全面的分布式推理框架,轻松一键部署你自己的模型或内置的前沿开源模型。 ++ [ComfyUI-CogVideoXWrapper](https://github.com/kijai/ComfyUI-CogVideoXWrapper) 使用ComfyUI框架,将CogVideoX加入到你的工作流中。 ++ [VideoSys](https://github.com/NUS-HPC-AI-Lab/VideoSys): VideoSys 提供了易用且高性能的视频生成基础设施,支持完整的管道,并持续集成最新的模型和技术。 ++ [AutoDL镜像](https://www.codewithgpu.com/i/THUDM/CogVideo/CogVideoX-5b-demo): 由社区成员提供的一键部署Huggingface + Space镜像。 ++ [室内设计微调模型](https://huggingface.co/collections/bertjiazheng/koolcogvideox-66e4762f53287b7f39f8f3ba) 基于 + CogVideoX的微调模型,它专为室内设计而设计 ++ [xDiT](https://github.com/xdit-project/xDiT): xDiT是一个用于在多GPU集群上对DiTs并行推理的引擎。xDiT支持实时图像和视频生成服务。 ++ [CogVideoX-Interpolation](https://github.com/feizc/CogvideX-Interpolation): 基于 CogVideoX 结构修改的管道,旨在为关键帧插值生成提供更大的灵活性。 ++ [DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio): DiffSynth 工作室是一款扩散引擎。重构了架构,包括文本编码器、UNet、VAE + 等,在保持与开源社区模型兼容性的同时,提升了计算性能。该框架已经适配 CogVideoX。 ++ [CogVideoX-Controlnet](https://github.com/TheDenk/cogvideox-controlnet): 一个包含 CogvideoX 模型的简单 Controlnet 模块的代码。 ++ [VideoTuna](https://github.com/VideoVerses/VideoTuna):VideoTuna 是首个集成多种 AI 视频生成模型的仓库,支持文本转视频、图像转视频、文本转图像生成。 ++ [ConsisID](https://github.com/PKU-YuanGroup/ConsisID): 一种身份保持的文本到视频生成模型,基于 CogVideoX-5B,通过频率分解在生成的视频中保持面部一致性。 ++ [教程](https://www.youtube.com/watch?v=5UCkMzP2VLE&ab_channel=SECourses): 一个关于在Windows和云环境中安装和优化CogVideoX1.5-5B-I2V模型的分步指南。特别感谢[FurkanGozukara](https://github.com/FurkanGozukara)的努力和支持! -## Project Structure -This open-source repository will guide developers to quickly get started with the basic usage and fine-tuning examples -of the **CogVideoX** open-source model. +## 完整项目代码结构 -### Quick Start with Colab +本开源仓库将带领开发者快速上手 **CogVideoX** 开源模型的基础调用方式、微调示例。 -Here provide three projects that can be run directly on free Colab T4 instances: +### Colab 快速使用 + +这里提供了三个能直接在免费的 Colab T4上 运行的项目 + [CogVideoX-5B-T2V-Colab.ipynb](https://colab.research.google.com/drive/1pCe5s0bC_xuXbBlpvIH1z0kfdTLQPzCS?usp=sharing): - CogVideoX-5B Text-to-Video Colab code. + CogVideoX-5B 文字生成视频 Colab 代码。 + [CogVideoX-5B-T2V-Int8-Colab.ipynb](https://colab.research.google.com/drive/1DUffhcjrU-uz7_cpuJO3E_D4BaJT7OPa?usp=sharing): - CogVideoX-5B Quantized Text-to-Video Inference Colab code, which takes about 30 minutes per run. + CogVideoX-5B 文字生成视频量化推理 Colab 代码,运行一次大约需要30分钟。 + [CogVideoX-5B-I2V-Colab.ipynb](https://colab.research.google.com/drive/17CqYCqSwz39nZAX2YyonDxosVKUZGzcX?usp=sharing): - CogVideoX-5B Image-to-Video Colab code. + CogVideoX-5B 图片生成视频 Colab 代码。 + [CogVideoX-5B-V2V-Colab.ipynb](https://colab.research.google.com/drive/1comfGAUJnChl5NwPuO8Ox5_6WCy4kbNN?usp=sharing): - CogVideoX-5B Video-to-Video Colab code. + CogVideoX-5B 视频生成视频 Colab 代码。 -### Inference +### inference -+ [dcli_demo](inference/cli_demo.py): A more detailed inference code explanation, including the significance of - common parameters. All of this is covered here. ++ [cli_demo](inference/cli_demo.py): 更详细的推理代码讲解,常见参数的意义,在这里都会提及。 + [cli_demo_quantization](inference/cli_demo_quantization.py): - Quantized model inference code that can run on devices with lower memory. You can also modify this code to support - running CogVideoX models in FP8 precision. -+ [diffusers_vae_demo](inference/cli_vae_demo.py): Code for running VAE inference separately. -+ [space demo](inference/gradio_composite_demo): The same GUI code as used in the Huggingface Space, with frame - interpolation and super-resolution tools integrated. + 量化模型推理代码,可以在显存较低的设备上运行,也可以基于此代码修改,以支持运行FP8等精度的CogVideoX模型。请注意,FP8 + 仅测试通过,且必须将 `torch-nightly`,`torchao`源代码安装,不建议在生产环境中使用。 ++ [diffusers_vae_demo](inference/cli_vae_demo.py): 单独执行VAE的推理代码。 ++ [space demo](inference/gradio_composite_demo): Huggingface Space同款的 GUI 代码,植入了插帧,超分工具。
-+ [convert_demo](inference/convert_demo.py): How to convert user input into long-form input suitable for CogVideoX. - Since CogVideoX is trained on long texts, we need to transform the input text distribution to match the training data - using an LLM. The script defaults to using GLM-4, but it can be replaced with GPT, Gemini, or any other large language - model. -+ [gradio_web_demo](inference/gradio_composite_demo): A simple Gradio web application demonstrating how to use the - CogVideoX-2B / 5B model to generate videos. Similar to our Huggingface Space, you can use this script to run a simple - web application for video generation. ++ [convert_demo](inference/convert_demo.py): 如何将用户的输入转换成适合 + CogVideoX的长输入。因为CogVideoX是在长文本上训练的,所以我们需要把输入文本的分布通过LLM转换为和训练一致的长文本。脚本中默认使用GLM-4,也可以替换为GPT、Gemini等任意大语言模型。 ++ [gradio_web_demo](inference/gradio_composite_demo/app.py): 与 Huggingface Space 完全相同的代码实现,快速部署 CogVideoX + GUI体验。 ### finetune -+ [finetune_demo](finetune/README.md): Fine-tuning scheme and details of the diffusers version of the CogVideoX model. ++ [train_cogvideox_lora](finetune/README_zh.md): diffusers版本 CogVideoX 模型微调方案和细节。 ### sat -+ [sat_demo](sat/README.md): Contains the inference code and fine-tuning code of SAT weights. It is recommended to - improve based on the CogVideoX model structure. Innovative researchers use this code to better perform rapid stacking - and development. ++ [sat_demo](sat/README_zh.md): 包含了 SAT 权重的推理代码和微调代码,推荐基于 CogVideoX + 模型结构进行改进,创新的研究者使用改代码以更好的进行快速的堆叠和开发。 -### Tools +### tools -This folder contains some tools for model conversion / caption generation, etc. +本文件夹包含了一些工具,用于模型的转换 / Caption 等工作。 -+ [convert_weight_sat2hf](tools/convert_weight_sat2hf.py): Converts SAT model weights to Huggingface model weights. -+ [caption_demo](tools/caption/README.md): Caption tool, a model that understands videos and outputs descriptions in - text. -+ [export_sat_lora_weight](tools/export_sat_lora_weight.py): SAT fine-tuning model export tool, exports the SAT Lora - Adapter in diffusers format. -+ [load_cogvideox_lora](tools/load_cogvideox_lora.py): Tool code for loading the diffusers version of fine-tuned Lora - Adapter. -+ [llm_flux_cogvideox](tools/llm_flux_cogvideox/llm_flux_cogvideox.py): Automatically generate videos using an - open-source local large language model + Flux + CogVideoX. ++ [convert_weight_sat2hf](tools/convert_weight_sat2hf.py): 将 SAT 模型权重转换为 Huggingface 模型权重。 ++ [caption_demo](tools/caption/README_zh.md): Caption 工具,对视频理解并用文字输出的模型。 ++ [export_sat_lora_weight](tools/export_sat_lora_weight.py): SAT微调模型导出工具,将 + SAT Lora Adapter 导出为 diffusers 格式。 ++ [load_cogvideox_lora](tools/load_cogvideox_lora.py): 载入diffusers版微调Lora Adapter的工具代码。 ++ [llm_flux_cogvideox](tools/llm_flux_cogvideox/llm_flux_cogvideox.py): 使用开源本地大语言模型 + Flux + + CogVideoX实现自动化生成视频。 + [parallel_inference_xdit](tools/parallel_inference/parallel_inference_xdit.py): - Supported by [xDiT](https://github.com/xdit-project/xDiT), parallelize the - video generation process on multiple GPUs. + 在多个 GPU 上并行化视频生成过程, + 由[xDiT](https://github.com/xdit-project/xDiT)提供支持。 ++ [cogvideox-factory](https://github.com/a-r-r-o-w/cogvideox-factory): CogVideoX低成文微调框架,适配`diffusers` + 版本模型。支持更多分辨率,单卡4090即可微调 CogVideoX-5B 。 ## CogVideo(ICLR'23) -The official repo for the -paper: [CogVideo: Large-scale Pretraining for Text-to-Video Generation via Transformers](https://arxiv.org/abs/2205.15868) -is on the [CogVideo branch](https://github.com/THUDM/CogVideo/tree/CogVideo) +[CogVideo: Large-scale Pretraining for Text-to-Video Generation via Transformers](https://arxiv.org/abs/2205.15868) +的官方repo位于[CogVideo branch](https://github.com/THUDM/CogVideo/tree/CogVideo)。 -**CogVideo is able to generate relatively high-frame-rate videos.** -A 4-second clip of 32 frames is shown below. +**CogVideo可以生成高帧率视频,下面展示了一个32帧的4秒视频。** ![High-frame-rate sample](https://raw.githubusercontent.com/THUDM/CogVideo/CogVideo/assets/appendix-sample-highframerate.png) ![Intro images](https://raw.githubusercontent.com/THUDM/CogVideo/CogVideo/assets/intro-image.png) + +
- +
+CogVideo的demo网站在[https://models.aminer.cn/cogvideo](https://models.aminer.cn/cogvideo/)。您可以在这里体验文本到视频生成。 +*原始输入为中文。* -The demo for CogVideo is at [https://models.aminer.cn/cogvideo](https://models.aminer.cn/cogvideo/), where you can get -hands-on practice on text-to-video generation. *The original input is in Chinese.* +## 引用 -## Citation - -🌟 If you find our work helpful, please leave us a star and cite our paper. +🌟 如果您发现我们的工作有所帮助,欢迎引用我们的文章,留下宝贵的stars ``` @article{yang2024cogvideox, @@ -447,12 +407,12 @@ hands-on practice on text-to-video generation. *The original input is in Chinese } ``` -## Model-License +## 模型协议 -The code in this repository is released under the [Apache 2.0 License](LICENSE). +本仓库代码使用 [Apache 2.0 协议](LICENSE) 发布。 -The CogVideoX-2B model (including its corresponding Transformers module and VAE module) is released under -the [Apache 2.0 License](LICENSE). +CogVideoX-2B 模型 (包括其对应的Transformers模块,VAE模块) 根据 [Apache 2.0 协议](LICENSE) 许可证发布。 -The CogVideoX-5B model (Transformers module, include I2V and T2V) is released under -the [CogVideoX LICENSE](https://huggingface.co/THUDM/CogVideoX-5b/blob/main/LICENSE). +CogVideoX-5B 模型 (Transformers 模块,包括图生视频,文生视频版本) +根据 [CogVideoX LICENSE](https://huggingface.co/THUDM/CogVideoX-5b/blob/main/LICENSE) +许可证发布。