license: other
license_name: cogvideox
license_link: https://huggingface.co/THUDM/CogVideoX-2b/blob/main/LICENSE
language:
- en
tags:
- cogvideox
- video-generation
- thudm
inference: false
CogVideoX-2B
📄 中文阅读 | 🌐 Github(with PDF paper) | 📜 arxiv (coming soon)
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 (Current Repos) |
---|---|
Supported Prompt Language | English |
GPU Memory Required for Inference | 36GB (will be optimized before the PR is merged) |
GPU Memory Required for Fine-tuning (bs=1) | 42GB |
Prompt Length | 226 Tokens |
Video Length | 6 seconds |
Frames Per Second | 8 frames |
Resolution | 720 * 480 |
Positional Embeddings | Sinusoidal |
Quantized Inference | Not Supported |
Multi-card 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
pip install git+https://github.com/huggingface/diffusers.git@878f609aa5ce4a78fea0f048726889debde1d7e8#egg=diffusers # Still in PR
- 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
).to("cuda")
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.