From d57553d520d1ca58341e8052fba73b6a0626bcd4 Mon Sep 17 00:00:00 2001 From: Nyx Date: Thu, 7 Mar 2024 20:55:02 +1000 Subject: [PATCH] [docs] Modify README.md to fix translation error in name "CloseGPT" Former-commit-id: dd36043df4b0408e592a82f9046f6d654a5375c3 --- README.md | 460 +++++++++++++++++++++++++++--------------------------- 1 file changed, 230 insertions(+), 230 deletions(-) diff --git a/README.md b/README.md index f5c9a6d75..d08b7055d 100644 --- a/README.md +++ b/README.md @@ -1,230 +1,230 @@ -# Open-Sora Plan - -[[Project Page]](https://pku-yuangroup.github.io/Open-Sora-Plan/) [[ไธญๆ–‡ไธป้กต]](https://pku-yuangroup.github.io/Open-Sora-Plan/blog_cn.html) [[Discord]](https://discord.gg/fqpmStRX) [[Wechat Group]](https://github.com/PKU-YuanGroup/Open-Sora-Plan/issues/53#issuecomment-1980312563) - -## ๐Ÿ’ช Goal -This project aims to create a simple and scalable repo, to reproduce [Sora](https://openai.com/sora) (OpenAI, but we prefer to call it "CloseAI" ) and build knowledge about Video-VQVAE (VideoGPT) + DiT at scale. However, we have limited resources, we deeply wish all open-source community can contribute to this project. Pull request are welcome!!! - -ๆœฌ้กน็›ฎๅธŒๆœ›้€š่ฟ‡ๅผ€ๆบ็คพๅŒบ็š„ๅŠ›้‡ๅค็ŽฐSora๏ผŒ็”ฑๅŒ—ๅคง-ๅ…”ๅฑ•AIGC่”ๅˆๅฎž้ชŒๅฎคๅ…ฑๅŒๅ‘่ตท๏ผŒๅฝ“ๅ‰ๆˆ‘ไปฌ่ต„ๆบๆœ‰้™ไป…ๆญๅปบไบ†ๅŸบ็ก€ๆžถๆž„๏ผŒๆ— ๆณ•่ฟ›่กŒๅฎŒๆ•ด่ฎญ็ปƒ๏ผŒๅธŒๆœ›้€š่ฟ‡ๅผ€ๆบ็คพๅŒบ้€ๆญฅๅขžๅŠ ๆจกๅ—ๅนถ็ญน้›†่ต„ๆบ่ฟ›่กŒ่ฎญ็ปƒ๏ผŒๅฝ“ๅ‰็‰ˆๆœฌ็ฆป็›ฎๆ ‡ๅทฎ่ทๅทจๅคง๏ผŒไป้œ€ๆŒ็ปญๅฎŒๅ–„ๅ’Œๅฟซ้€Ÿ่ฟญไปฃ๏ผŒๆฌข่ฟŽPull request๏ผ๏ผ๏ผ - -Project stages: -- Primary -1. Setup the codebase and train a un-conditional model on landscape dataset. -2. Train models that boost resolution and duration. - -- Extensions -3. Conduct text2video experiments on landscape dataset. -4. Train the 1080p model on video2text dataset. -5. Control model with more condition. - - -
- - -
- - -## ๐Ÿ“ฐ News - -**[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), welcome to pull request. - -**[2024.03.04]** We re-organize and modulize our codes and 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, 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) and clarify several issues. - -**[2024.03.01]** Training codes are available now! Learn more in our [project page](https://pku-yuangroup.github.io/Open-Sora-Plan/). Please feel free to watch ๐Ÿ‘€ this repository for the latest updates. - - -## โœŠ Todo - -#### Setup the codebase and train a unconditional model on landscape dataset -- [x] Fix typo & Update readme. ๐Ÿค Thanks to [@mio2333](https://github.com/mio2333), [@CreamyLong](https://github.com/CreamyLong), [@chg0901](https://github.com/chg0901) -- [x] Setup repo-structure. -- [ ] Add docker file. โŒ› [WIP] -- [ ] Enable type hints for functions. ๐Ÿ™ **[Need your contribution]** -- [x] Add Video-VQGAN 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 [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) -- [x] Add sampling script. -- [x] Incorporate [SiT](https://github.com/willisma/SiT). ๐Ÿค Thanks to [@khan-yin](https://github.com/khan-yin) -- [ ] Add eavluation scripts (FVD, CLIP score). ๐Ÿ™ **[Need your contribution]** - -#### Train models that boost resolution and duration -- [ ] Add [PI](https://arxiv.org/abs/2306.15595) to support out-of-domain size. ๐Ÿ™ **[Need your contribution]** -- [ ] Add 2D RoPE to improve generalization ability as [FiT](https://github.com/whlzy/FiT). ๐Ÿ™ **[Need your contribution]** -- [x] Extract 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. -- [ ] Joint training with images. ๐Ÿ™ **[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. -- [ ] Finish data loading, pre-processing utils. โŒ› [WIP] -- [ ] Add CLIP and T5 support. โŒ› [WIP] -- [ ] Add text2image training script. โŒ› [WIP] -- [ ] Add prompt captioner. ๐Ÿ™ **[Need your contribution]** ๐Ÿš€ **[Require more computation]** - -#### Train the 1080p model on video2text dataset -- [ ] Looking for a suitable dataset, welcome to discuss and recommend. ๐Ÿ™ **[Need your contribution]** -- [ ] Finish data loading, pre-processing utils. โŒ› [WIP] -- [ ] Support memory friendly training. - - [x] Add flash-attention2 from pytorch. - - [x] Add xformers. - - [x] Support mixed precision training. - - [x] Add gradient checkpoint. - - [x] Support for ReBased and Ring attention. ๐Ÿค Thanks to [@kabachuha](https://github.com/kabachuha) - - [ ] Train using the deepspeed engine. ๐Ÿ™ **[Need your contribution]** - - [ ] Integrate with [Colossal-AI](https://github.com/PKU-YuanGroup/Open-Sora-Plan/issues/59#issue-2170735221), cheaper, faster, and more efficient. ๐Ÿ™ **[Need your contribution]** -- [ ] Train with text condition. Here we could conduct different experiments: - - [ ] Train with T5 conditioning. ๐Ÿš€ **[Require more computation]** - - [ ] Train with CLIP conditioning. ๐Ÿš€ **[Require more computation]** - - [ ] Train with CLIP + T5 conditioning (probably costly during training and experiments). ๐Ÿš€ **[Require more computation]** - -#### Control model with more condition -- [ ] Load pretrained weight from [PixArt-ฮฑ](https://github.com/PixArt-alpha/PixArt-alpha). โŒ› [WIP] -- [ ] Incorporating [ControlNet](https://github.com/lllyasviel/ControlNet). ๐Ÿ™ **[Need your contribution]** - -## ๐Ÿ“‚ 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 -โ”‚ย ย  โ”œโ”€โ”€ sample -โ”‚ย ย  โ”œโ”€โ”€ train -> Training code -โ”‚ย ย  โ””โ”€โ”€ utils -``` - -## ๐Ÿ› ๏ธ Requirements and Installation - -The recommended requirements are as follows. - -* Python >= 3.8 -* CUDA Version >= 11.7 -* Install required packages: - -``` -git clone https://github.com/PKU-YuanGroup/Open-Sora-Plan -cd Open-Sora-Plan -conda create -n opensora python=3.8 -y -conda activate opensora -pip install -e . -``` - -## ๐Ÿ—๏ธ Usage - -### Datasets -Refer to [Data.md](docs/Data.md) - - -### Video-VQVAE (VideoGPT) - -#### Training - -To train VQVAE, run the script: - -``` -scripts/train_vqvae.sh -``` - -You can modify the training parameters within the script. For training parameters, please refer to [transformers.TrainingArguments](https://huggingface.co/docs/transformers/v4.38.2/en/main_classes/trainer#transformers.TrainingArguments). Other parameters are explained as follows: - -##### VQ-VAE Specific Settings - -* `--embedding_dim`: number of dimensions for codebooks embeddings -* `--n_codes 2048`: number of codes in the codebook -* `--n_hiddens 240`: number of hidden features in the residual blocks -* `--n_res_layers 4`: number of residual blocks -* `--downsample "4,4,4"`: T H W downsampling stride of the encoder - -##### Dataset Settings -* `--data_path `: path to an `hdf5` file or a folder containing `train` and `test` folders with subdirectories of videos -* `--resolution 128`: spatial resolution to train on -* `--sequence_length 16`: temporal resolution, or video clip length - -#### Reconstructing - -```Python -python examples/rec_video.py --video-path "assets/origin_video_0.mp4" --rec-path "rec_video_0.mp4" --num-frames 500 --sample-rate 1 -``` -```Python -python examples/rec_video.py --video-path "assets/origin_video_1.mp4" --rec-path "rec_video_1.mp4" --resolution 196 --num-frames 600 --sample-rate 1 -``` - -We present four reconstructed videos in this demonstration, arranged from left to right as follows: - -| **3s 596x336** | **10s 256x256** | **18s 196x196** | **24s 168x96** | -| --- | --- | --- | --- | -| | | | | - -#### Others - -Please refer to the document [VQVAE](docs/VQVAE.md). - -### VideoDiT (DiT) - -#### Training -``` -sh scripts/train.sh -``` - -

- -

- -#### Sampling -``` -sh scripts/sample.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](docs/Contribution_Guidelines.md) - - -## ๐Ÿ‘ Acknowledgement -* [Latte](https://github.com/Vchitect/Latte): The **main codebase** we built upon and it is an wonderful video gererated model. -* [DiT](https://github.com/facebookresearch/DiT): Scalable Diffusion Models with Transformers. -* [VideoGPT](https://github.com/wilson1yan/VideoGPT): Video Generation using VQ-VAE and Transformers. -* [FiT](https://github.com/whlzy/FiT): Flexible Vision Transformer for Diffusion Model. -* [Positional Interpolation](https://arxiv.org/abs/2306.15595): Extending Context Window of Large Language Models via Positional Interpolation. - - -## ๐Ÿ”’ License -* The service is a research preview intended for non-commercial use only. See [LICENSE](LICENSE) for details. - - -## โœจ Star History - -[![Star History](https://api.star-history.com/svg?repos=PKU-YuanGroup/Open-Sora-Plan)](https://star-history.com/#PKU-YuanGroup/Open-Sora-Plan&Date) +# Open-Sora Plan + +[[Project Page]](https://pku-yuangroup.github.io/Open-Sora-Plan/) [[ไธญๆ–‡ไธป้กต]](https://pku-yuangroup.github.io/Open-Sora-Plan/blog_cn.html) [[Discord]](https://discord.gg/fqpmStRX) [[Wechat Group]](https://github.com/PKU-YuanGroup/Open-Sora-Plan/issues/53#issuecomment-1980312563) + +## ๐Ÿ’ช Goal +This project aims to create a simple and scalable repo, to reproduce [Sora](https://openai.com/sora) (OpenAI, but we prefer to call it "ClosedAI" ) and build knowledge about Video-VQVAE (VideoGPT) + DiT at scale. However, we have limited resources, we deeply wish all open-source community can contribute to this project. Pull request are welcome!!! + +ๆœฌ้กน็›ฎๅธŒๆœ›้€š่ฟ‡ๅผ€ๆบ็คพๅŒบ็š„ๅŠ›้‡ๅค็ŽฐSora๏ผŒ็”ฑๅŒ—ๅคง-ๅ…”ๅฑ•AIGC่”ๅˆๅฎž้ชŒๅฎคๅ…ฑๅŒๅ‘่ตท๏ผŒๅฝ“ๅ‰ๆˆ‘ไปฌ่ต„ๆบๆœ‰้™ไป…ๆญๅปบไบ†ๅŸบ็ก€ๆžถๆž„๏ผŒๆ— ๆณ•่ฟ›่กŒๅฎŒๆ•ด่ฎญ็ปƒ๏ผŒๅธŒๆœ›้€š่ฟ‡ๅผ€ๆบ็คพๅŒบ้€ๆญฅๅขžๅŠ ๆจกๅ—ๅนถ็ญน้›†่ต„ๆบ่ฟ›่กŒ่ฎญ็ปƒ๏ผŒๅฝ“ๅ‰็‰ˆๆœฌ็ฆป็›ฎๆ ‡ๅทฎ่ทๅทจๅคง๏ผŒไป้œ€ๆŒ็ปญๅฎŒๅ–„ๅ’Œๅฟซ้€Ÿ่ฟญไปฃ๏ผŒๆฌข่ฟŽPull request๏ผ๏ผ๏ผ + +Project stages: +- Primary +1. Setup the codebase and train a un-conditional model on landscape dataset. +2. Train models that boost resolution and duration. + +- Extensions +3. Conduct text2video experiments on landscape dataset. +4. Train the 1080p model on video2text dataset. +5. Control model with more condition. + + +
+ + +
+ + +## ๐Ÿ“ฐ News + +**[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), welcome to pull request. + +**[2024.03.04]** We re-organize and modulize our codes and 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, 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) and clarify several issues. + +**[2024.03.01]** Training codes are available now! Learn more in our [project page](https://pku-yuangroup.github.io/Open-Sora-Plan/). Please feel free to watch ๐Ÿ‘€ this repository for the latest updates. + + +## โœŠ Todo + +#### Setup the codebase and train a unconditional model on landscape dataset +- [x] Fix typo & Update readme. ๐Ÿค Thanks to [@mio2333](https://github.com/mio2333), [@CreamyLong](https://github.com/CreamyLong), [@chg0901](https://github.com/chg0901) +- [x] Setup repo-structure. +- [ ] Add docker file. โŒ› [WIP] +- [ ] Enable type hints for functions. ๐Ÿ™ **[Need your contribution]** +- [x] Add Video-VQGAN 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 [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) +- [x] Add sampling script. +- [x] Incorporate [SiT](https://github.com/willisma/SiT). ๐Ÿค Thanks to [@khan-yin](https://github.com/khan-yin) +- [ ] Add eavluation scripts (FVD, CLIP score). ๐Ÿ™ **[Need your contribution]** + +#### Train models that boost resolution and duration +- [ ] Add [PI](https://arxiv.org/abs/2306.15595) to support out-of-domain size. ๐Ÿ™ **[Need your contribution]** +- [ ] Add 2D RoPE to improve generalization ability as [FiT](https://github.com/whlzy/FiT). ๐Ÿ™ **[Need your contribution]** +- [x] Extract 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. +- [ ] Joint training with images. ๐Ÿ™ **[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. +- [ ] Finish data loading, pre-processing utils. โŒ› [WIP] +- [ ] Add CLIP and T5 support. โŒ› [WIP] +- [ ] Add text2image training script. โŒ› [WIP] +- [ ] Add prompt captioner. ๐Ÿ™ **[Need your contribution]** ๐Ÿš€ **[Require more computation]** + +#### Train the 1080p model on video2text dataset +- [ ] Looking for a suitable dataset, welcome to discuss and recommend. ๐Ÿ™ **[Need your contribution]** +- [ ] Finish data loading, pre-processing utils. โŒ› [WIP] +- [ ] Support memory friendly training. + - [x] Add flash-attention2 from pytorch. + - [x] Add xformers. + - [x] Support mixed precision training. + - [x] Add gradient checkpoint. + - [x] Support for ReBased and Ring attention. ๐Ÿค Thanks to [@kabachuha](https://github.com/kabachuha) + - [ ] Train using the deepspeed engine. ๐Ÿ™ **[Need your contribution]** + - [ ] Integrate with [Colossal-AI](https://github.com/PKU-YuanGroup/Open-Sora-Plan/issues/59#issue-2170735221), cheaper, faster, and more efficient. ๐Ÿ™ **[Need your contribution]** +- [ ] Train with text condition. Here we could conduct different experiments: + - [ ] Train with T5 conditioning. ๐Ÿš€ **[Require more computation]** + - [ ] Train with CLIP conditioning. ๐Ÿš€ **[Require more computation]** + - [ ] Train with CLIP + T5 conditioning (probably costly during training and experiments). ๐Ÿš€ **[Require more computation]** + +#### Control model with more condition +- [ ] Load pretrained weight from [PixArt-ฮฑ](https://github.com/PixArt-alpha/PixArt-alpha). โŒ› [WIP] +- [ ] Incorporating [ControlNet](https://github.com/lllyasviel/ControlNet). ๐Ÿ™ **[Need your contribution]** + +## ๐Ÿ“‚ 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 +โ”‚ย ย  โ”œโ”€โ”€ sample +โ”‚ย ย  โ”œโ”€โ”€ train -> Training code +โ”‚ย ย  โ””โ”€โ”€ utils +``` + +## ๐Ÿ› ๏ธ Requirements and Installation + +The recommended requirements are as follows. + +* Python >= 3.8 +* CUDA Version >= 11.7 +* Install required packages: + +``` +git clone https://github.com/PKU-YuanGroup/Open-Sora-Plan +cd Open-Sora-Plan +conda create -n opensora python=3.8 -y +conda activate opensora +pip install -e . +``` + +## ๐Ÿ—๏ธ Usage + +### Datasets +Refer to [Data.md](docs/Data.md) + + +### Video-VQVAE (VideoGPT) + +#### Training + +To train VQVAE, run the script: + +``` +scripts/train_vqvae.sh +``` + +You can modify the training parameters within the script. For training parameters, please refer to [transformers.TrainingArguments](https://huggingface.co/docs/transformers/v4.38.2/en/main_classes/trainer#transformers.TrainingArguments). Other parameters are explained as follows: + +##### VQ-VAE Specific Settings + +* `--embedding_dim`: number of dimensions for codebooks embeddings +* `--n_codes 2048`: number of codes in the codebook +* `--n_hiddens 240`: number of hidden features in the residual blocks +* `--n_res_layers 4`: number of residual blocks +* `--downsample "4,4,4"`: T H W downsampling stride of the encoder + +##### Dataset Settings +* `--data_path `: path to an `hdf5` file or a folder containing `train` and `test` folders with subdirectories of videos +* `--resolution 128`: spatial resolution to train on +* `--sequence_length 16`: temporal resolution, or video clip length + +#### Reconstructing + +```Python +python examples/rec_video.py --video-path "assets/origin_video_0.mp4" --rec-path "rec_video_0.mp4" --num-frames 500 --sample-rate 1 +``` +```Python +python examples/rec_video.py --video-path "assets/origin_video_1.mp4" --rec-path "rec_video_1.mp4" --resolution 196 --num-frames 600 --sample-rate 1 +``` + +We present four reconstructed videos in this demonstration, arranged from left to right as follows: + +| **3s 596x336** | **10s 256x256** | **18s 196x196** | **24s 168x96** | +| --- | --- | --- | --- | +| | | | | + +#### Others + +Please refer to the document [VQVAE](docs/VQVAE.md). + +### VideoDiT (DiT) + +#### Training +``` +sh scripts/train.sh +``` + +

+ +

+ +#### Sampling +``` +sh scripts/sample.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](docs/Contribution_Guidelines.md) + + +## ๐Ÿ‘ Acknowledgement +* [Latte](https://github.com/Vchitect/Latte): The **main codebase** we built upon and it is an wonderful video gererated model. +* [DiT](https://github.com/facebookresearch/DiT): Scalable Diffusion Models with Transformers. +* [VideoGPT](https://github.com/wilson1yan/VideoGPT): Video Generation using VQ-VAE and Transformers. +* [FiT](https://github.com/whlzy/FiT): Flexible Vision Transformer for Diffusion Model. +* [Positional Interpolation](https://arxiv.org/abs/2306.15595): Extending Context Window of Large Language Models via Positional Interpolation. + + +## ๐Ÿ”’ License +* The service is a research preview intended for non-commercial use only. See [LICENSE](LICENSE) for details. + + +## โœจ Star History + +[![Star History](https://api.star-history.com/svg?repos=PKU-YuanGroup/Open-Sora-Plan)](https://star-history.com/#PKU-YuanGroup/Open-Sora-Plan&Date)