license: other
license_name: cogvideox
license_link: https://huggingface.co/THUDM/CogVideoX-2b/blob/main/LICENSE
language:
- en
tags:
- cogvideox
- video-generation
- thudm
- text-to-video
inference: false
CogVideoX-2B
Demo Show
Model Introduction
CogVideoX is an open-source video generation model that shares the same origins as 清影. The table below provides a list of the video generation models we currently offer, along with their basic information.
Model Name | CogVideoX-2B |
---|---|
Prompt Language | English |
Single GPU Inference (FP16) | 23.9GB |
Multi GPUs Inference (FP16) | 20GB minimum per GPU using diffusers |
GPU Memory Required for Fine-tuning(bs=1) | 40GB |
Prompt Max Length | 226 Tokens |
Video Length | 6 seconds |
Frames Per Second | 8 frames |
Resolution | 720 * 480 |
Quantized Inference | Not Supported |
Note Using SAT model cost 18GB for inference. Check our github.
Quick Start 🤗
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.
- Install the required dependencies
pip install --upgrade opencv-python transformers diffusers # Must using diffusers>=0.30.0
- Run the code
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()
prompt_embeds, _ = pipe.encode_prompt(
prompt=prompt,
do_classifier_free_guidance=True,
num_videos_per_prompt=1,
max_sequence_length=226,
device="cuda",
dtype=torch.float16,
)
video = pipe(
num_inference_steps=50,
guidance_scale=6,
prompt_embeds=prompt_embeds,
).frames[0]
export_to_video(video, "output.mp4", fps=8)
Using a single A100 GPU, generating a video with the above configuration takes approximately 90 seconds
If the generated model appears “all green” and not viewable in the default MAC player, it is a normal phenomenon (due to OpenCV saving video issues). Simply use a different player to view the video.
Explore the Model
Welcome to our github, where you will find:
- More detailed technical details and code explanation.
- Optimization and conversion of prompt words.
- Reasoning and fine-tuning of SAT version models, and even pre-release.
- Project update log dynamics, more interactive opportunities.
- CogVideoX toolchain to help you better use the model.
Model License
This model is released under the CogVideoX LICENSE.
Citation
The technical report is still being written, stay tuned.