Model reference · open weights
CogVideoX is an open-weight video model from zai-org. CogVideoX-5b (BF16) weighs 21.5 GB; the smallest configuration that runs it is RTX 4060 Ti 16 GB.
Summary of the zai-org/CogVideoX-2b model card, 2026-10-01. The estimate below is for another build of the family.
What it is
| Released by | zai-org |
|---|---|
| Released | 2024-08-05 |
| Parameters | 1.7B |
| VRAM | 21.5 GB for the weights |
What it runs on
| Card | Weights | Memory |
|---|---|---|
| RTX 3060 12 GB | does not fit | 11.6 GB |
| RTX 4060 Ti 16 GB | fits (encoders offloaded) | 15.4 GB |
| RTX 3090 24 GB | tight | 23.4 GB |
| RTX 4090 24 GB | tight | 23.4 GB |
| RTX 5090 32 GB | fits | 31.0 GB |
| L40S 48 GB | fits | 44.0 GB |
| A100 80 GB | fits | 78.2 GB |
| H100 80 GB | fits | 78.1 GB |
| RTX PRO 6000 Blackwell 96 GB | fits | 93.8 GB |
| DGX Spark (GB10) 128 GB unified | fits | 107 GB |
| H200 141 GB | fits | 138 GB |
| B200 180 GB | fits | 176 GB |
Builds
| Build | Params | Precision | Weights | Smallest setup |
|---|---|---|---|---|
| CogVideoX-2b ↗ | 1.7B | FP16 | 13.8 GB | RTX 3060 12 GB |
| CogVideoX-5b (above) ↗ | 5.6B | BF16 | 21.5 GB | RTX 4060 Ti 16 GB |
From the model card
📍 Visit QingYing and API Platform to experience commercial video generation models.
.video-container {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
}
.video-item {
width: 45%;
margin-bottom: 20px;
transition: transform 0.3s;
}
.video-item:hover {
transform: scale(1.1);
}
.caption {
text-align: center;
margin-top: 10px;
font-size: 11px;
}
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.
Data Explanation
diffusers library, all optimizations provided by the diffusers library were enabled. This
solution has not been tested for actual VRAM/memory usage on devices other than NVIDIA A100 / H100. Generally,
this solution can be adapted to all devices with NVIDIA Ampere architecture and above. If the optimizations are
disabled, VRAM usage will increase significantly, with peak VRAM usage being about 3 times higher than the table
shows. However, speed will increase by 3-4 times. You can selectively disable some optimizations, including:pipe.enable_model_cpu_offload()
pipe.enable_sequential_cpu_offload()
pipe.vae.enable_slicing()
pipe.vae.enable_tiling()
enable_model_cpu_offload() optimization needs to be disabled.FP16 precision, and the 5B model is trained with BF16 precision. We recommend using
the precision the model was trained with for inference.torch.compile, which can significantly improve inference speed. FP8
precision must be used on devices with NVIDIA H100 or above, which requires installing
the torch, torchao, diffusers, and accelerate Python packages from source. CUDA 12.4 is recommended.diffusers version of the model supports quantization.Note
This model supports deployment using the huggingface diffusers library. You can deploy it by following these steps.
We recommend that you visit our GitHub and check out the relevant prompt optimizations and conversions to get a better experience.
# diffusers>=0.30.1
# transformers>=0.44.0
# accelerate>=0.33.0 (suggest install from source)
# imageio-ffmpeg>=0.5.1
pip install --upgrade transformers accelerate diffusers imageio-ffmpeg
import torch
from diffusers import CogVideoXPipeline
from diffusers.utils import export_to_video
prompt = "A panda, dressed in a small, red jacket and a tiny hat, sits on a wooden stool in a serene bamboo forest. The panda's fluffy paws strum a miniature acoustic guitar, producing soft, melodic tunes. Nearby, a few other pandas gather, watching curiously and some clapping in rhythm. Sunlight filters through the tall bamboo, casting a gentle glow on the scene. The panda's face is expressive, showing concentration and joy as it plays. The background includes a small, flowing stream and vibrant green foliage, enhancing the peaceful and magical atmosphere of this unique musical performance."
pipe = CogVideoXPipeline.from_pretrained(
"THUDM/CogVideoX-2b",
torch_dtype=torch.float16
)
pipe.enable_model_cpu_offload()
pipe.enable_sequential_cpu_offload()
pipe.vae.enable_slicing()
pipe.vae.enable_tiling()
video = pipe(
prompt=prompt,
num_videos_per_prompt=1,
num_inference_steps=50,
num_frames=49,
guidance_scale=6,
generator=torch.Generator(device="cuda").manual_seed(42),
).frames[0]
export_to_video(video, "output.mp4", fps=8)
PytorchAO and Optimum-quanto can be
used to quantize the Text Encoder, Transformer and VAE modules to lower the memory requirement of CogVideoX. This makes
it possible to run the model on free-tier T4 Colab or smaller VRAM GPUs as well! It is also worth noting that TorchAO
quantization is fully compatible with torch.compile, which allows for much faster inference speed.
# To get started, PytorchAO needs to be installed from the GitHub source and PyTorch Nightly.
# Source and nightly installation is only required until next release.
import torch
from diffusers import AutoencoderKLCogVideoX, CogVideoXTransformer3DModel, CogVideoXPipeline
from diffusers.utils import export_to_video
+ from transformers import T5EncoderModel
+ from torchao.quantization import quantize_, int8_weight_only, int8_dynamic_activation_int8_weight
+ quantization = int8_wQuoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.
Running it yourself
Rent a machine by the hour. Runs as it is with diffusers, on the machine, in Python.
# on your rented machine: pip install diffusers transformers accelerate ftfy
import torch
from diffusers import DiffusionPipeline
from diffusers.utils import export_to_video
pipe = DiffusionPipeline.from_pretrained("zai-org/CogVideoX-2b", torch_dtype=torch.bfloat16).to("cuda")
frames = pipe(prompt="a drone shot over a forest at sunrise").frames[0]
export_to_video(frames, "/workspace/out.mp4", fps=16)