Open-Sora Plan
![GitHub repo size](https://img.shields.io/github/repo-size/PKU-YuanGroup/Open-Sora-Plan?style=flat&logo=github&logoColor=whitesmoke&label=Repo%20Size)
v1.0.0 badge
[![Twitter](https://img.shields.io/badge/-Twitter@LinBin46984-black?logo=twitter&logoColor=1D9BF0)](https://x.com/LinBin46984/status/1763476690385424554?s=20)
[![hf_space](https://img.shields.io/badge/๐ค-Open%20In%20Spaces-blue.svg)](https://huggingface.co/spaces/LanguageBind/Open-Sora-Plan-v1.0.0)
[![hf_space](https://img.shields.io/badge/๐ค-Open%20In%20Spaces-blue.svg)](https://huggingface.co/spaces/fffiloni/Open-Sora-Plan-v1-0-0)
[![Replicate demo and cloud API](https://replicate.com/camenduru/open-sora-plan-512x512/badge)](https://replicate.com/camenduru/open-sora-plan-512x512)
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/camenduru/Open-Sora-Plan-jupyter/blob/main/Open_Sora_Plan_jupyter.ipynb)
We are thrilled to present Open-Sora-Plan v1.1.0, which significantly enhances video generation quality and text control capabilities. See our report. We show compressed .gif on GitHub, which loses some quality.
Thanks to HUAWEI Ascend Team for supporting us. In the second stage, we used Huawei Ascend computing power for training. This stage's training and inference were fully supported by Huawei. Models trained on Huawei Ascend can also be loaded into GPUs and generate videos of the same quality.
็ฎๅๅทฒ็ปๆฏๆไฝฟ็จๅฝไบงAI่ฎก็ฎ็ณป็ป(ๅไธบๆ่
พ๏ผๆๅพ
ๆดๅคๅฝไบง็ฎๅ่ฏ็)่ฟ่กๅฎๆด็่ฎญ็ปๅๆจ็ใๅจ้กน็ฎ็ฌฌไบ้ถๆฎต๏ผๆๆ่ฎญ็ปๅๆจ็ไปปๅกๅฎๅ
จ็ฑๅไธบๆ่
พ่ฎก็ฎ็ณป็ปๆฏๆใๆญคๅค๏ผๅบไบๅไธบๆ่
พ็512ๅก้็พค่ฎญ็ปๅบ็ๆจกๅ๏ผไนๅฏไปฅๆ ็ผๅฐๅจGPUไธ่ฟ่ก๏ผๅนถไฟๆ็ธๅ็่ง้ข่ดจ้ใ่ฏฆ็ปไฟกๆฏ่ฏทๅ่ๆไปฌ็hw branch.
221ร512ร512 Text-to-Video Generation
3D animation of a small, round, fluffy creature with big, expressive eyes explores ... |
A single drop of liquid metal falls from a floating orb, landing on a mirror-like ... |
The video presents an abstract composition centered around a hexagonal shape adorned ... |
|
|
|
A drone camera circles around a beautiful historic church built on a rocky outcropping ... |
Aerial view of Santorini during the blue hour, showcasing the stunning architecture ... |
An aerial shot of a lighthouse standing tall on a rocky cliff, its beacon cutting ... |
|
|
|
A snowy forest landscape with a dirt road running through it. The road is flanked by ... |
Drone shot along the Hawaii jungle coastline, sunny day. Kayaks in the water. |
The camera rotates around a large stack of vintage televisions all showing different ... |
|
|
|
65ร512ร512 Text-to-Video Generation
In an ornate, historical hall, a massive tidal wave peaks and begins to crash. Two ... |
A Shiba Inu dog wearing a beret and black turtleneck. |
A painting of a boat on water comes to life, with waves crashing and the boat becoming ... |
|
|
|
A person clad in a space suit with a helmet and equipped with a chest light and arm ... |
3D animation of a small, round, fluffy creature with big, expressive eyes explores a ... |
In a studio, there is a painting depicting a ship sailing through the rough sea. |
|
|
|
A robot dog trots down a deserted alley at night, its metallic paws clinking softly ... |
A lone surfer rides a massive wave, skillfully maneuvering through the surf. The water ... |
A solitary cheetah sprints across the savannah, its powerful muscles propelling it ... |
|
|
|
65ร512ร512 Video Editing
512ร512 Text-to-Image Generation
๐ฐ News
[2024.05.27] ๐๐๐ We are launching Open-Sora Plan v1.1.0, which significantly improves video quality and length, and is fully open source! Please check out our latest report. Thanks to ShareGPT4Video's capability to annotate long videos.
[2024.04.09] ๐ Excited to share our latest exploration on metamorphic time-lapse video generation: MagicTime, which learns real-world physics knowledge from time-lapse videos. Here is the dataset for train (updating): Open-Sora-Dataset.
[2024.04.07] ๐ฅ๐ฅ๐ฅ Today, we are thrilled to present Open-Sora-Plan v1.0.0, which significantly enhances video generation quality and text control capabilities. See our report. Thanks to HUAWEI NPU for supporting us.
[2024.03.27] ๐๐๐ We release the report of VideoCausalVAE, which supports both images and videos. We present our reconstructed video in this demonstration as follows. The text-to-video model is on the way.
View more
**[2024.03.10]** ๐๐๐ This repo supports training a latent size of 225ร90ร90 (tรhรw), which means we are able to **train 1 minute of 1080P video with 30FPS** (2ร interpolated frames and 2ร super resolution) under class-condition.
**[2024.03.08]** We support the training code of text condition with 16 frames of 512x512. The code is mainly borrowed from [Latte](https://github.com/Vchitect/Latte).
**[2024.03.07]** We support training with 128 frames (when sample rate = 3, which is about 13 seconds) of 256x256, or 64 frames (which is about 6 seconds) of 512x512.
**[2024.03.05]** See our latest [todo](https://github.com/PKU-YuanGroup/Open-Sora-Plan?tab=readme-ov-file#todo), pull requests are welcome.
**[2024.03.04]** We re-organize and modulize our code to make it easy to [contribute](https://github.com/PKU-YuanGroup/Open-Sora-Plan?tab=readme-ov-file#how-to-contribute-to-the-open-sora-plan-community) to the project, to contribute please see the [Repo structure](https://github.com/PKU-YuanGroup/Open-Sora-Plan?tab=readme-ov-file#repo-structure).
**[2024.03.03]** We open some [discussions](https://github.com/PKU-YuanGroup/Open-Sora-Plan/discussions) to clarify several issues.
**[2024.03.01]** Training code is available now! Learn more on our [project page](https://pku-yuangroup.github.io/Open-Sora-Plan/). Please feel free to watch ๐ this repository for the latest updates.
๐ช Goal
This project aims to create a simple and scalable repo, to reproduce Sora (OpenAI, but we prefer to call it "ClosedAI" ). We wish the open-source community can contribute to this project. Pull requests are welcome!!!
ๆฌ้กน็ฎๅธๆ้่ฟๅผๆบ็คพๅบ็ๅ้ๅค็ฐSora๏ผ็ฑๅๅคง-ๅ
ๅฑAIGC่ๅๅฎ้ชๅฎคๅ
ฑๅๅ่ตท๏ผๅฝๅ็ๆฌ็ฆป็ฎๆ ๅทฎ่ทไป็ถ่พๅคง๏ผไป้ๆ็ปญๅฎๅๅๅฟซ้่ฟญไปฃ๏ผๆฌข่ฟPull request๏ผ๏ผ๏ผ
Project stages:
-
Primary
- Setup the codebase and train an un-conditional model on a landscape dataset.
- Train models that boost resolution and duration.
-
Extensions
- Conduct text2video experiments on landscape dataset.
- Train the 1080p model on video2text dataset.
- Control model with more conditions.
โ Todo
#### Setup the codebase and train an unconditional model on landscape dataset
- [x] Fix typos & Update readme. ๐ค Thanks to [@mio2333](https://github.com/mio2333), [@CreamyLong](https://github.com/CreamyLong), [@chg0901](https://github.com/chg0901), [@Nyx-177](https://github.com/Nyx-177), [@HowardLi1984](https://github.com/HowardLi1984), [@sennnnn](https://github.com/sennnnn), [@Jason-fan20](https://github.com/Jason-fan20)
- [x] Setup environment. ๐ค Thanks to [@nameless1117](https://github.com/nameless1117)
- [ ] Add docker file. โ [WIP] ๐ค Thanks to [@Mon-ius](https://github.com/Mon-ius), [@SimonLeeGit](https://github.com/SimonLeeGit)
- [ ] Enable type hints for functions. ๐ค Thanks to [@RuslanPeresy](https://github.com/RuslanPeresy), ๐ **[Need your contribution]**
- [x] Resume from checkpoint.
- [x] Add Video-VQVAE model, which is borrowed from [VideoGPT](https://github.com/wilson1yan/VideoGPT).
- [x] Support variable aspect ratios, resolutions, durations training on [DiT](https://github.com/facebookresearch/DiT).
- [x] Support Dynamic mask input inspired by [FiT](https://github.com/whlzy/FiT).
- [x] Add class-conditioning on embeddings.
- [x] Incorporating [Latte](https://github.com/Vchitect/Latte) as main codebase.
- [x] Add VAE model, which is borrowed from [Stable Diffusion](https://github.com/CompVis/latent-diffusion).
- [x] Joint dynamic mask input with VAE.
- [ ] Add VQVAE from [VQGAN](https://github.com/CompVis/taming-transformers). ๐ **[Need your contribution]**
- [ ] Make the codebase ready for the cluster training. Add SLURM scripts. ๐ **[Need your contribution]**
- [x] Refactor VideoGPT. ๐ค Thanks to [@qqingzheng](https://github.com/qqingzheng), [@luo3300612](https://github.com/luo3300612), [@sennnnn](https://github.com/sennnnn)
- [x] Add sampling script.
- [ ] Add DDP sampling script. โ [WIP]
- [x] Use accelerate on multi-node. ๐ค Thanks to [@sysuyy](https://github.com/sysuyy)
- [x] Incorporate [SiT](https://github.com/willisma/SiT). ๐ค Thanks to [@khan-yin](https://github.com/khan-yin)
- [x] Add evaluation scripts (FVD, CLIP score). ๐ค Thanks to [@rain305f](https://github.com/rain305f)
#### Train models that boost resolution and duration
- [x] Add [PI](https://arxiv.org/abs/2306.15595) to support out-of-domain size. ๐ค Thanks to [@jpthu17](https://github.com/jpthu17)
- [x] Add 2D RoPE to improve generalization ability as [FiT](https://github.com/whlzy/FiT). ๐ค Thanks to [@jpthu17](https://github.com/jpthu17)
- [x] Compress KV according to [PixArt-sigma](https://pixart-alpha.github.io/PixArt-sigma-project).
- [x] Support deepspeed for videogpt training. ๐ค Thanks to [@sennnnn](https://github.com/sennnnn)
- [x] Train a **low dimension** Video-AE, whether it is VAE or VQVAE.
- [x] Extract offline feature.
- [x] Train with offline feature.
- [x] Add frame interpolation model. ๐ค Thanks to [@yunyangge](https://github.com/yunyangge)
- [x] Add super resolution model. ๐ค Thanks to [@Linzy19](https://github.com/Linzy19)
- [x] Add accelerate to automatically manage training.
- [x] Joint training with images.
- [ ] Implement [MaskDiT](https://github.com/Anima-Lab/MaskDiT) technique for fast training. ๐ **[Need your contribution]**
- [ ] Incorporate [NaViT](https://arxiv.org/abs/2307.06304). ๐ **[Need your contribution]**
- [ ] Add [FreeNoise](https://github.com/arthur-qiu/FreeNoise-LaVie) support for training-free longer video generation. ๐ **[Need your contribution]**
#### Conduct text2video experiments on landscape dataset.
- [x] Load pretrained weights from [Latte](https://github.com/Vchitect/Latte).
- [ ] Implement [PeRFlow](https://github.com/magic-research/piecewise-rectified-flow) for improving the sampling process. ๐ **[Need your contribution]**
- [x] Finish data loading, pre-processing utils.
- [x] Add T5 support.
- [x] Add CLIP support. ๐ค Thanks to [@Ytimed2020](https://github.com/Ytimed2020)
- [x] Add text2image training script.
- [ ] Add prompt captioner.
- [ ] Collect training data.
- [ ] Need video-text pairs with caption. ๐ **[Need your contribution]**
- [ ] Extract multi-frame descriptions by large image-language models. ๐ค Thanks to [@HowardLi1984](https://github.com/HowardLi1984)
- [ ] Extract video description by large video-language models. ๐ **[Need your contribution]**
- [ ] Integrate captions to get a dense caption by using a large language model, such as GPT-4. ๐ค Thanks to [@HowardLi1984](https://github.com/HowardLi1984)
- [ ] Train a captioner to refine captions. ๐ **[Require more computation]**
#### Train the 1080p model on video2text dataset
- [ ] Looking for a suitable dataset, welcome to discuss and recommend. ๐ **[Need your contribution]**
- [ ] Add synthetic video created by game engines or 3D representations. ๐ **[Need your contribution]**
- [x] Finish data loading, and pre-processing utils.
- [x] Support memory friendly training.
- [x] Add flash-attention2 from pytorch.
- [x] Add xformers. ๐ค Thanks to [@jialin-zhao](https://github.com/jialin-zhao)
- [x] Support mixed precision training.
- [x] Add gradient checkpoint.
- [x] Support for ReBased and Ring attention. ๐ค Thanks to [@kabachuha](https://github.com/kabachuha)
- [x] Train using the deepspeed engine. ๐ค Thanks to [@sennnnn](https://github.com/sennnnn)
- [ ] Train with a text condition. Here we could conduct different experiments: ๐ **[Require more computation]**
- [x] Train with T5 conditioning.
- [ ] Train with CLIP conditioning.
- [ ] Train with CLIP + T5 conditioning (probably costly during training and experiments).
- [ ] Support Chinese. โ [WIP]
#### Control model with more condition
- [ ] Incorporating [ControlNet](https://github.com/lllyasviel/ControlNet). โ [WIP] ๐ **[Need your contribution]**
- [ ] Incorporating [ReVideo](https://github.com/MC-E/ReVideo). โ [WIP]
๐ Repo structure (WIP)
โโโ README.md
โโโ docs
โ โโโ Data.md -> Datasets description.
โ โโโ Contribution_Guidelines.md -> Contribution guidelines description.
โโโ scripts -> All scripts.
โโโ opensora
โย ย โโโ dataset
โย ย โโโ models
โย ย โย ย โโโ ae -> Compress videos to latents
โย ย โย ย โย ย โโโ imagebase
โย ย โย ย โย ย โย ย โโโ vae
โย ย โย ย โย ย โย ย โโโ vqvae
โย ย โย ย โย ย โโโ videobase
โย ย โย ย โย ย โโโ vae
โย ย โย ย โย ย โโโ vqvae
โย ย โย ย โโโ captioner
โย ย โย ย โโโ diffusion -> Denoise latents
โย ย โย ย โย ย โโโ diffusion
โย ย โย ย โย ย โโโ dit
โย ย โย ย โย ย โโโ latte
โย ย โย ย โย ย โโโ unet
โย ย โย ย โโโ frame_interpolation
โย ย โย ย โโโ super_resolution
โย ย โย ย โโโ text_encoder
โย ย โโโ sample
โย ย โโโ train -> Training code
โย ย โโโ utils
๐ ๏ธ Requirements and Installation
- Clone this repository and navigate to Open-Sora-Plan folder
git clone https://github.com/PKU-YuanGroup/Open-Sora-Plan
cd Open-Sora-Plan
- Install required packages
conda create -n opensora python=3.8 -y
conda activate opensora
pip install -e .
- Install additional packages for training cases
pip install -e ".[train]"
pip install flash-attn --no-build-isolation
- Install optional requirements such as static type checking:
pip install -e '.[dev]'
๐๏ธ Usage
๐ค Demo
Gradio Web UI ![](https://img.shields.io/github/stars/gradio-app/gradio)
Highly recommend trying out our web demo by the following command. We also provide online demo
.
v1.0.0
Highly recommend trying out our web demo by the following command. We also provide [online demo](https://huggingface.co/spaces/LanguageBind/Open-Sora-Plan-v1.0.0) [![hf_space](https://img.shields.io/badge/๐ค-Open%20In%20Spaces-blue.svg)](https://huggingface.co/spaces/LanguageBind/Open-Sora-Plan-v1.0.0) and [![hf_space](https://img.shields.io/badge/๐ค-Open%20In%20Spaces-blue.svg)](https://huggingface.co/spaces/fffiloni/Open-Sora-Plan-v1-0-0) in Huggingface Spaces.
๐ค Enjoying the [![Replicate demo and cloud API](https://replicate.com/camenduru/open-sora-plan-512x512/badge)](https://replicate.com/camenduru/open-sora-plan-512x512) and [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/camenduru/Open-Sora-Plan-jupyter/blob/main/Open_Sora_Plan_jupyter.ipynb), created by [@camenduru](https://github.com/camenduru), who generously supports our research!
For the 65 frames.
python -m opensora.serve.gradio_web_server --version 65x512x512
For the 221 frames.
python -m opensora.serve.gradio_web_server --version 221x512x512
CLI Inference
sh scripts/text_condition/sample_video.sh
Datasets
Refer to Data.md
Evaluation
Refer to the document EVAL.md.
CausalVideoVAE
Reconstructing
Example:
python examples/rec_imvi_vae.py --video_path test_video.mp4 --rec_path output_video.mp4 --fps 24 --resolution 512 --crop_size 512 --num_frames 128 --sample_rate 1 --ae CausalVAEModel_4x8x8 --model_path pretrained_488_release --enable_tiling --enable_time_chunk
Parameter explanation:
--enable_tiling
: This parameter is a flag to enable a tiling conv.
Training and Eval
Please refer to the document CausalVideoVAE.
VideoGPT VQVAE
Please refer to the document VQVAE.
Video Diffusion Transformer
Training
sh scripts/text_condition/train_videoae_65x512x512.sh
sh scripts/text_condition/train_videoae_221x512x512.sh
sh scripts/text_condition/train_videoae_513x512x512.sh
๐ก How to Contribute to the Open-Sora Plan Community
We greatly appreciate your contributions to the Open-Sora Plan open-source community and helping us make it even better than it is now!
For more details, please refer to the Contribution Guidelines
๐ Acknowledgement
- Latte: The main codebase we built upon and it is an wonderful video generated model.
- PixArt-alpha: Fast Training of Diffusion Transformer for Photorealistic Text-to-Image Synthesis.
- ShareGPT4Video: Improving Video Understanding and Generation with Better Captions.
- VideoGPT: Video Generation using VQ-VAE and Transformers.
- DiT: Scalable Diffusion Models with Transformers.
- FiT: Flexible Vision Transformer for Diffusion Model.
- Positional Interpolation: Extending Context Window of Large Language Models via Positional Interpolation.
๐ License
โ๏ธ Citing
BibTeX
@software{pku_yuan_lab_and_tuzhan_ai_etc_2024_10948109,
author = {PKU-Yuan Lab and Tuzhan AI etc.},
title = {Open-Sora-Plan},
month = apr,
year = 2024,
publisher = {GitHub},
doi = {10.5281/zenodo.10948109},
url = {https://doi.org/10.5281/zenodo.10948109}
}
Latest DOI
![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10948109.svg)
๐ค Community contributors