CogVideo README

The project's README from github.com/zai-org/CogVideo. As one markdown file: README.md.

CogVideo & CogVideoX

中文阅读

日本語で読む

Experience the CogVideoX-5B model online at 🤗 Huggingface Space or 🤖 ModelScope Space

📚 View the paper and user guide

👋 Join our WeChat and Discord

📍 Visit QingYing and API Platform to experience larger-scale commercial video generation models.

Project Updates

Table of Contents

Jump to a specific section:

Quick Start

Prompt Optimization

Before running the model, please refer to this guide 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.

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: 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.

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: A more detailed explanation of the inference code, mentioning the significance of common parameters.

For more details on quantized inference, please refer to 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.

CogVideoX-5B

CogVideoX-2B

To view the corresponding prompt words for the gallery, please click here

Model Introduction

CogVideoX is an open-source version of the video generation model originating from QingYing. The table below displays the list of video generation models we currently offer, along with their foundational information.

Model Name CogVideoX1.5-5B (Latest) CogVideoX1.5-5B-I2V (Latest) CogVideoX-2B CogVideoX-5B CogVideoX-5B-I2V
Release Date November 8, 2024 November 8, 2024 August 6, 2024 August 27, 2024 September 19, 2024
Video Resolution 1360 * 768 Min(W, H) = 768
768 ≤ Max(W, H) ≤ 1360
Max(W, H) % 16 = 0
720 * 480
Number of Frames Should be 16N + 1 where N <= 10 (default 81) Should be 8N + 1 where N <= 6 (default 49)
Inference Precision BF16 (Recommended), FP16, FP32, FP8*, INT8, Not supported: INT4 FP16*(Recommended), BF16, FP32, FP8*, INT8, Not supported: INT4 BF16 (Recommended), FP16, FP32, FP8*, INT8, Not supported: 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*
Multi-GPU Memory Usage 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
Prompt Language English*
Prompt Token Limit 224 Tokens 226 Tokens
Video Length 5 seconds or 10 seconds 6 seconds
Frame Rate 16 frames / second 8 frames / second
Position Encoding 3d_rope_pos_embed 3d_sincos_pos_embed 3d_rope_pos_embed 3d_rope_pos_embed + learnable_pos_embed
Download Link (Diffusers) 🤗 HuggingFace
🤖 ModelScope
🟣 WiseModel
🤗 HuggingFace
🤖 ModelScope
🟣 WiseModel
🤗 HuggingFace
🤖 ModelScope
🟣 WiseModel
🤗 HuggingFace
🤖 ModelScope
🟣 WiseModel
🤗 HuggingFace
🤖 ModelScope
🟣 WiseModel
Download Link (SAT) 🤗 HuggingFace
🤖 ModelScope
🟣 WiseModel
SAT

Data Explanation

pipe.enable_sequential_cpu_offload()
pipe.vae.enable_slicing()
pipe.vae.enable_tiling()

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:

CogVideo (zai-org/CogVideo)

Searching Database…

13.1K ·GitHub
这是什么?一套开源的文生视频和图生视频模型系列:CogVideoX(2024 年)及其升级版 CogVideoX1.5,前身是 CogVideo(ICLR 2023)——首个基于大型 Transformer 的开源文生视频模型。
我需要在本地安装东西,还是直接打开网站就能试用?两种都可以。你可以在 Hugging Face 或 ModelScope 的在线 Spaces 里试用 CogVideoX-5B,也可以下载权重,在自己的显卡上本地运行推理。项目提供了两套代码:SAT 和 Hugging Face 的 diffusers 版本。
我怎么生成自己的第一个视频?安装 Python 3.10-3.12,然后按照 diffusers 示例运行推理(推荐,因为它支持量化),或者使用 SAT 示例,后者同时包含推理和微调代码。还有 Colab 快速上手教程可用。
它主要有哪些限制——提示词语言、提示词长度、视频时长?提示词必须用英文,长度上限为 224-226 个 token;其他语言请先用大模型翻译成英文。视频时长较短:CogVideoX1.5 在 16 fps 下为 5 秒或 10 秒,CogVideoX-2B/5B 在 8 fps 下为 6 秒。不支持 INT4 精度。
我需要很贵的显卡吗?一般的显卡也能跑:CogVideoX-2B 在老到 GTX 1080 TI 的显卡上就能运行,CogVideoX-5B 只需 RTX 3060。借助 diffusers 的优化,5B 模型大约 5 GB 显存就能装下,用 INT8 量化后约 4.4 GB——免费 Colab 的 T4 显卡就够用了。
较新的 CogVideoX1.5 相比原版增加了什么?于 2024 年 11 月 8 日发布:CogVideoX1.5-5B 能以更高分辨率(1360x768)在 16 fps 下生成 10 秒视频,其 I2V 版本接受任意分辨率的图片作为输入。旧代码只需稍改少量参数即可继续使用。
这个模型系列支持哪些生成任务?三种:文生视频、视频续写和图生视频。I2V 模型把一张图片作为背景输入,并将其与提示词结合,从而获得更强的可控性。
为什么 README 一定要在生成前优化提示词?这些模型是用长提示词训练的,所以提示词的质量直接影响视频效果。指南建议先用 GLM-4 或 GPT-4 这类大模型帮你改写提示词。
我能用自己的素材微调 CogVideoX 吗?可以:有 SAT 微调代码、基于 diffusers 版本且更省显存的 LoRA 微调,还有 cogvideox-factory,它能在单张 RTX 4090 上跨多种分辨率微调 CogVideoX-5B。团队还发布了 CogKit,这是针对该系列的微调与推理框架。
Creator
zai-org
Size
178.4 MB
Stars
13.1K
Age
4y
Commits · 90 Days