Open-Sora: Democratizing Efficient Video Production for All
Python
[doc] resolved conflict in readme
FrankLeeeee7ba29d343961
diff --cc README.mdindex ae74a43,45b0da8..e82186c--- a/README.md+++ b/README.md@@@ -22,18 -22,19 +22,18 @@@ With Open-Sora, our goal is to foster i[[中文文档]](/docs/zh_CN/README.md) [[潞晨云部署视频教程]](https://www.bilibili.com/video/BV141421R7Ag)-<h4>Open-Sora is still at an early stage and under active development.</h4>-## 📰 News- * **[2024.06.17]** 🔥 We released **Open-Sora 1.2**, which includes **3D-VAE**, **rectified flow**, and **score condition**. The video quality is greatly improved. [[checkpoints]](#open-sora-10-model-weights) [[report]](/docs/report_03.md)--* **[2024.04.25]** 🤗 We released the [Gradio demo for Open-Sora](https://huggingface.co/spaces/hpcai-tech/open-sora) on Hugging Face Spaces.- * **[2024.04.25]** We released **Open-Sora 1.1**, which supports **2s~15s, 144p to 720p, any aspect ratio** text-to-image, **text-to-video, image-to-video, video-to-video, infinite time** generation. In addition, a full video processing pipeline is released. [[checkpoints]]() [[report]](/docs/report_02.md)-* **[2024.04.25]** 🔥 We released **Open-Sora 1.1**, which supports **2s~15s, 144p to 720p, any aspect ratio** text-to-image, **text-to-video, image-to-video, video-to-video, infinite time** generation. In addition, a full video processing pipeline is released. [[checkpoints]]() [[report]](/docs/report_02.md)--* **[2024.03.18]** We released **Open-Sora 1.0**, a fully open-source project for video generation.++- **[2024.06.17]** 🔥 We released **Open-Sora 1.2**, which includes **3D-VAE**, **rectified flow**, and **score condition**. The video quality is greatly improved. [[checkpoints]](#open-sora-10-model-weights) [[report]](/docs/report_03.md)++- **[2024.04.25]** 🤗 We released the [Gradio demo for Open-Sora](https://huggingface.co/spaces/hpcai-tech/open-sora) on Hugging Face Spaces.++- **[2024.04.25]** We released **Open-Sora 1.1**, which supports **2s~15s, 144p to 720p, any aspect ratio** text-to-image, **text-to-video, image-to-video, video-to-video, infinite time** generation. In addition, a full video processing pipeline is released. [[checkpoints]]() [[report]](/docs/report_02.md)++- **[2024.03.18]** We released **Open-Sora 1.0**, a fully open-source project for video generation.Open-Sora 1.0 supports a full pipeline of video data preprocessing, training with<a href="https://github.com/hpcaitech/ColossalAI"><img src="assets/readme/colossal_ai.png" width="8%" ></a>acceleration,inference, and more. Our model can produce 2s 512x512 videos with only 3 days training. [[checkpoints]](#open-sora-10-model-weights)- [[blog]](https://hpc-ai.com/blog/open-sora-v1.0) [[report]](docs/report_01.md)-* **[2024.03.04]** Open-Sora provides training with 46% cost reduction.+ [[blog]](https://hpc-ai.com/blog/open-sora-v1.0) [[report]](/docs/report_01.md)- * **[2024.03.04]** Open-Sora provides training with 46% cost reduction.++- **[2024.03.04]** Open-Sora provides training with 46% cost reduction.[[blog]](https://hpc-ai.com/blog/open-sora)## 🎥 Latest Demo@@@ -75,23 -71,19 +75,23 @@@ see [here](/assets/texts/t2v_samples.tx## 🔆 New Features/Updates- * 📍 **Open-Sora 1.2** released. Model weights are available [here](#model-weights). See our **[report 1.2](docs/report_03.md)** for more details.- * ✅ Support rectified flow scheduling.- * ✅ Support more conditioning including fps, aesthetic score, motion strength and camera motion.- * ✅ Trained our 3D-VAE for temporal dimension compression.- * 📍 **Open-Sora 1.1** released. Model weights are available [here](#model-weights). It is trained on **0s~15s, 144p to 720p, various aspect ratios** videos. See our **[report 1.1](/docs/report_02.md)** for more discussions.-* 📍 **Open-Sora 1.1** released. Model weights are available [here](). It is trained on **0s~15s, 144p to 720p, various aspect ratios** videos. See our **[report 1.1](docs/report_02.md)** for more discussions.--* 🔧 **Data processing pipeline v1.1** is released. An automatic [processing pipeline](#data-processing) from raw videos to (text, video clip) pairs is provided, including scene cutting $\rightarrow$ filtering(aesthetic, optical flow, OCR, etc.) $\rightarrow$ captioning $\rightarrow$ managing. With this tool, you can easily build your video dataset.--* ✅ Improved ST-DiT architecture includes rope positional encoding, qk norm, longer text length, etc.--* ✅ Support training with any resolution, aspect ratio, and duration (including images).--* ✅ Support image and video conditioning and video editing, and thus support animating images, connecting videos, etc.--* 📍 **Open-Sora 1.0** released. Model weights are available [here](#model-weights). With only 400K video clips and 200 H800++- 📍 **Open-Sora 1.2** released. Model weights are available [here](#model-weights). See our **[report 1.2](docs/report_03.md)** for more details.++- ✅ Support rectified flow scheduling.++- ✅ Support more conditioning including fps, aesthetic score, motion strength and camera motion.++- ✅ Trained our 3D-VAE for temporal dimension compression.++- 📍 **Open-Sora 1.1** released. Model weights are available [here](#model-weights). It is trained on **0s~15s, 144p to 720p, various aspect ratios** videos. See our **[report 1.1](/docs/report_02.md)** for more discussions.++- 🔧 **Data processing pipeline v1.1** is released. An automatic [processing pipeline](#data-processing) from raw videos to (text, video clip) pairs is provided, including scene cutting $\rightarrow$ filtering(aesthetic, optical flow, OCR, etc.) $\rightarrow$ captioning $\rightarrow$ managing. With this tool, you can easily build your video dataset.++- ✅ Improved ST-DiT architecture includes rope positional encoding, qk norm, longer text length, etc.++- ✅ Support training with any resolution, aspect ratio, and duration (including images).++- ✅ Support image and video conditioning and video editing, and thus support animating images, connecting videos, etc.++- 📍 **Open-Sora 1.0** released. Model weights are available [here](#model-weights). With only 400K video clips and 200 H800days (compared with 152M samples in Stable Video Diffusion), we are able to generate 2s 512×512 videos. See our **[report 1.0](docs/report_01.md)** for more discussions.--* ✅ Three-stage training from an image diffusion model to a video diffusion model. We provide the weights for each++- ✅ Three-stage training from an image diffusion model to a video diffusion model. We provide the weights for eachstage.--* ✅ Support training acceleration including accelerated transformer, faster T5 and VAE, and sequence parallelism.++- ✅ Support training acceleration including accelerated transformer, faster T5 and VAE, and sequence parallelism.Open-Sora improves **55%** training speed when training on 64x512x512 videos. Details locatesat [acceleration.md](docs/acceleration.md).--* 🔧 **Data preprocessing pipeline v1.0**,++- 🔧 **Data preprocessing pipeline v1.0**,including [downloading](tools/datasets/README.md), [video cutting](tools/scene_cut/README.md),and [captioning](tools/caption/README.md) tools. Our data collection plan can be foundat [datasets.md](docs/datasets.md).@@@ -99,18 -91,18 +99,18 @@@<details><summary>View more</summary>--* ✅ We find VQ-VAE from [VideoGPT](https://wilson1yan.github.io/videogpt/index.html) has a low quality and thus adopt a++- ✅ We find VQ-VAE from [VideoGPT](https://wilson1yan.github.io/videogpt/index.html) has a low quality and thus adopt abetter VAE from [Stability-AI](https://huggingface.co/stabilityai/sd-vae-ft-mse-original). We also find patching inthe time dimension deteriorates the quality. See our **[report](docs/report_01.md)** for more discussions.--* ✅ We investigate different architectures including DiT, Latte, and our proposed STDiT. Our **STDiT** achieves a better++- ✅ We investigate different architectures including DiT, Latte, and our proposed STDiT. Our **STDiT** achieves a bettertrade-off between quality and speed. See our **[report](docs/report_01.md)** for more discussions.--* ✅ Support clip and T5 text conditioning.--* ✅ By viewing images as one-frame videos, our project supports training DiT on both images and videos (e.g., ImageNet &++- ✅ Support clip and T5 text conditioning.++- ✅ By viewing images as one-frame videos, our project supports training DiT on both images and videos (e.g., ImageNet &UCF101). See [commands.md](docs/commands.md) for more instructions.--* ✅ Support inference with official weights++- ✅ Support inference with official weightsfrom [DiT](https://github.com/facebookresearch/DiT), [Latte](https://github.com/Vchitect/Latte),and [PixArt](https://pixart-alpha.github.io/).--* ✅ Refactor the codebase. See [structure.md](docs/structure.md) to learn the project structure and how to use the++- ✅ Refactor the codebase. See [structure.md](docs/structure.md) to learn the project structure and how to use theconfig files.</details>@@@ -120,40 -112,38 +120,40 @@@<details><summary>View more</summary>- * [x] Training Video-VAE and adapt our model to new VAE.- * [x] Scaling model parameters and dataset size.- * [x] Incoporate a better scheduler (rectified flow).--* [x] Evaluation pipeline.--* [x] Complete the data processing pipeline (including dense optical flow, aesthetics scores, text-image similarity, etc.). See [the dataset](/docs/datasets.md) for more information--* [x] Support image and video conditioning.--* [x] Support variable aspect ratios, resolutions, durations.++- [x] Training Video-VAE and adapt our model to new VAE.++- [x] Scaling model parameters and dataset size.++- [x] Incoporate a better scheduler (rectified flow).++- [x] Evaluation pipeline.++- [x] Complete the data processing pipeline (including dense optical flow, aesthetics scores, text-image similarity, etc.). See [the dataset](/docs/datasets.md) for more information++- [x] Support image and video conditioning.++- [x] Support variable aspect ratios, resolutions, durations.</details>## Contents--* [Installation](#installation)--* [Model Weights](#model-weights)- * [Gradio Demo](#gradio-demo)--* [Inference](#inference)--* [Data Processing](#data-processing)--* [Training](#training)--* [Evaluation](#evaluation)- * [VAE Training & Evaluation](#vae-training--evaluation)--* [Contribution](#contribution)- * [Citation](#citation)--* [Acknowledgement](#acknowledgement)++- [Installation](#installation)++- [Model Weights](#model-weights)++- [Gradio Demo](#gradio-demo)++- [Inference](#inference)++- [Data Processing](#data-processing)++- [Training](#training)++- [Evaluation](#evaluation)++- [VAE Training & Evaluation](#vae-training--evaluation)++- [Contribution](#contribution)++- [Citation](#citation)++- [Acknowledgement](#acknowledgement)Other useful documents and links are listed below.- * Report: [report 1.2](docs/report_03.md), [report 1.1](docs/report_02.md), [report 1.0](docs/report_01.md), [acceleration.md](docs/acceleration.md)-* Report: [report 1.1](docs/report_02.md), [report 1.0](docs/report_01.md), [acceleration.md](docs/acceleration.md)--* Repo structure: [structure.md](docs/structure.md)--* Config file explanation: [config.md](docs/config.md)--* Useful commands: [commands.md](docs/commands.md)--* Data processing pipeline and dataset: [datasets.md](docs/datasets.md)--* Each data processing tool's README: [dataset conventions and management](/tools/datasets/README.md), [scene cutting](/tools/scene_cut/README.md), [scoring](/tools/scoring/README.md), [caption](/tools/caption/README.md)- * Evaluation: [eval/README.md](/eval/README.md)-* Evaluation: [eval](/eval/README.md)--* Gallery: [gallery](https://hpcaitech.github.io/Open-Sora/)++- Report: [report 1.2](docs/report_03.md), [report 1.1](docs/report_02.md), [report 1.0](docs/report_01.md), [acceleration.md](docs/acceleration.md)++- Repo structure: [structure.md](docs/structure.md)++- Config file explanation: [config.md](docs/config.md)++- Useful commands: [commands.md](docs/commands.md)++- Data processing pipeline and dataset: [datasets.md](docs/datasets.md)++- Each data processing tool's README: [dataset conventions and management](/tools/datasets/README.md), [scene cutting](/tools/scene_cut/README.md), [scoring](/tools/scoring/README.md), [caption](/tools/caption/README.md)++- Evaluation: [eval/README.md](/eval/README.md)++- Gallery: [gallery](https://hpcaitech.github.io/Open-Sora/)## Installation@@@ -470,50 -333,7 +470,50 @@@ For training other models and advanced## Evaluation-See [here](eval/README.md) for more instructions.+We support evaluation based on:+- * Validation loss- * VBench score- * VBench-i2v score- * Batch generation for human evaluation++- Validation loss++- VBench score++- VBench-i2v score++- Batch generation for human evaluation++All the evaluation code is released in `eval` folder. Check the [README](/eval/README.md) for more details. Our [report](/docs/report_03.md#evaluation) also provides more information about the evaluation during training. The following table shows Open-Sora 1.2 greatly improves Open-Sora 1.0.++| Model | Total Score | Quality Score | Semantic Score |+| -------------- | ----------- | ------------- | -------------- |+| Open-Sora V1.0 | 75.91% | 78.81% | 64.28% |+| Open-Sora V1.2 | 79.23% | 80.71% | 73.30% |++## VAE Training & Evaluation++We train a VAE pipeline that consists of a spatial VAE followed by a temporal VAE.+For more details, refer to [VAE Documentation](docs/vae.md).+Before you run the following commands, follow our [Installation Documentation](docs/installation.md) to install the required dependencies for VAE and Evaluation.++If you want to train your own VAE, we need to prepare data in the csv following the [data processing](#data-processing) pipeline, then run the following commands.+Note that you need to adjust the number of trained epochs (`epochs`) in the config file accordingly with respect to your own csv data size.++```bash+# stage 1 training, 380k steps, 8 GPUs+torchrun --nnodes=1 --nproc_per_node=8 scripts/train_vae.py configs/vae/train/stage1.py --data-path YOUR_CSV_PATH+# stage 2 training, 260k steps, 8 GPUs+torchrun --nnodes=1 --nproc_per_node=8 scripts/train_vae.py configs/vae/train/stage2.py --data-path YOUR_CSV_PATH+# stage 3 training, 540k steps, 24 GPUs+torchrun --nnodes=3 --nproc_per_node=8 scripts/train_vae.py configs/vae/train/stage3.py --data-path YOUR_CSV_PATH+```++To evaluate the VAE performance, you need to run VAE inference first to generate the videos, then calculate scores on the generated videos:++```bash+# video generation+torchrun --standalone --nnodes=1 --nproc_per_node=1 scripts/inference_vae.py configs/vae/inference/video.py --ckpt-path YOUR_VAE_CKPT_PATH --data-path YOUR_CSV_PATH --save-dir YOUR_VIDEO_DIR+# the original videos will be saved to `YOUR_VIDEO_DIR_ori`+# the reconstructed videos through the pipeline will be saved to `YOUR_VIDEO_DIR_rec`+# the reconstructed videos through the spatial VAE only will be saved to `YOUR_VIDEO_DIR_spatial`++# score calculation+python eval/vae/eval_common_metric.py --batch_size 2 --real_video_dir YOUR_VIDEO_DIR_ori --generated_video_dir YOUR_VIDEO_DIR_rec --device cuda --sample_fps 24 --crop_size 256 --resolution 256 --num_frames 17 --sample_rate 1 --metric ssim psnr lpips flolpips+```## Contribution@@@ -527,35 -347,19 +527,35 @@@ If you wish to contribute to this proje## Acknowledgement-* [ColossalAI](https://github.com/hpcaitech/ColossalAI): A powerful large model parallel acceleration and optimization+Here we only list a few of the projects. For other works and datasets, please refer to our report.+- * [ColossalAI](https://github.com/hpcaitech/ColossalAI): A powerful large model parallel acceleration and optimization++- [ColossalAI](https://github.com/hpcaitech/ColossalAI): A powerful large model parallel acceleration and optimizationsystem.--* [DiT](https://github.com/facebookresearch/DiT): Scalable Diffusion Models with Transformers.--* [OpenDiT](https://github.com/NUS-HPC-AI-Lab/OpenDiT): An acceleration for DiT training. We adopt valuable acceleration++- [DiT](https://github.com/facebookresearch/DiT): Scalable Diffusion Models with Transformers.++- [OpenDiT](https://github.com/NUS-HPC-AI-Lab/OpenDiT): An acceleration for DiT training. We adopt valuable accelerationstrategies for training progress from OpenDiT.--* [PixArt](https://github.com/PixArt-alpha/PixArt-alpha): An open-source DiT-based text-to-image model.--* [Latte](https://github.com/Vchitect/Latte): An attempt to efficiently train DiT for video.--* [StabilityAI VAE](https://huggingface.co/stabilityai/sd-vae-ft-mse-original): A powerful image VAE model.--* [CLIP](https://github.com/openai/CLIP): A powerful text-image embedding model.--* [T5](https://github.com/google-research/text-to-text-transfer-transformer): A powerful text encoder.--* [LLaVA](https://github.com/haotian-liu/LLaVA): A powerful image captioning model based on [Mistral-7B](https://huggingface.co/mistralai/Mistral-7B-v0.1) and [Yi-34B](https://huggingface.co/01-ai/Yi-34B).- * [PLLaVA](https://github.com/magic-research/PLLaVA): A powerful video captioning model.- * [MiraData](https://github.com/mira-space/MiraData): A large-scale video dataset with long durations and structured caption.--We are grateful for their exceptional work and generous contribution to open source.++- [PixArt](https://github.com/PixArt-alpha/PixArt-alpha): An open-source DiT-based text-to-image model.++- [Latte](https://github.com/Vchitect/Latte): An attempt to efficiently train DiT for video.++- [StabilityAI VAE](https://huggingface.co/stabilityai/sd-vae-ft-mse-original): A powerful image VAE model.++- [CLIP](https://github.com/openai/CLIP): A powerful text-image embedding model.++- [T5](https://github.com/google-research/text-to-text-transfer-transformer): A powerful text encoder.++- [LLaVA](https://github.com/haotian-liu/LLaVA): A powerful image captioning model based on [Mistral-7B](https://huggingface.co/mistralai/Mistral-7B-v0.1) and [Yi-34B](https://huggingface.co/01-ai/Yi-34B).++- [PLLaVA](https://github.com/magic-research/PLLaVA): A powerful video captioning model.++- [MiraData](https://github.com/mira-space/MiraData): A large-scale video dataset with long durations and structured caption.++We are grateful for their exceptional work and generous contribution to open source. Special thanks go to the authors of [MiraData](https://github.com/mira-space/MiraData) and [Rectified Flow](https://github.com/gnobitab/RectifiedFlow) for their valuable advice and help. We wish to express gratitude towards AK for sharing this project on social media and Hugging Face for providing free GPU resources for our online Gradio demo.++## Citation++```bibtex+@software{opensora,+ author = {Zangwei Zheng and Xiangyu Peng and Tianji Yang and Chenhui Shen and Shenggui Li and Hongxin Liu and Yukun Zhou and Tianyi Li and Yang You},+ title = {Open-Sora: Democratizing Efficient Video Production for All},+ month = {March},+ year = {2024},+ url = {https://github.com/hpcaitech/Open-Sora}+}+```## Star History