--- license: apache-2.0 title: MagicTime sdk: gradio emoji: 🚀 colorFrom: green colorTo: gray short_description: 'MagicTime: Time-lapse Video Generation Models as Metamorphic' ---

MagicTime: Time-lapse Video Generation Models as Metamorphic Simulators

If you like our project, please give us a star ⭐ on GitHub for the latest update.
[![hf_space](https://img.shields.io/badge/🤗-Open%20In%20Spaces-blue.svg)](https://pku-yuangroup.github.io/MagicTime/) [![arXiv](https://img.shields.io/badge/Arxiv-2404.05014-b31b1b.svg?logo=arXiv)](https://arxiv.org/abs/2404.05014) [![Home Page](https://img.shields.io/badge/Project--blue.svg)](https://pku-yuangroup.github.io/MagicTime/) [![Dataset](https://img.shields.io/badge/Dataset--green)](https://drive.google.com/drive/folders/1WsomdkmSp3ql3ImcNsmzFuSQ9Qukuyr8?usp=sharing) [![zhihu](https://img.shields.io/badge/-Twitter@AK%20-black?logo=twitter&logoColor=1D9BF0)](https://twitter.com/_akhaliq/status/1777538468043792473) [![zhihu](https://img.shields.io/badge/-Twitter@Jinfa%20Huang%20-black?logo=twitter&logoColor=1D9BF0)](https://twitter.com/vhjf36495872/status/1777525817087553827?s=61&t=r2HzCsU2AnJKbR8yKSprKw) [![License](https://img.shields.io/badge/License-Apache%202.0-yellow)](https://github.com/PKU-YuanGroup/MagicTime/blob/main/LICENSE) ![GitHub Repo stars](https://img.shields.io/github/stars/PKU-YuanGroup/MagicTime)
This repository is the official implementation of MagicTime, a metamorphic video generation pipeline based on the given prompts. The main idea is to enhance the capacity of video generation models to accurately depict the real world through our proposed methods and dataset.
## 📣 News * ⏳⏳⏳ Training a stronger model with the support of [Open-Sora-Plan](https://github.com/PKU-YuanGroup/Open-Sora-Plan) (e.g 257 x 512 × 512). * ⏳⏳⏳ Release the training code of MagicTime. * **[2024.04.10]** 🔥 We release the inference code, huggingface space and model weight of MagicTime. * **[2024.04.09]** 🔥 We release the arXiv paper for MagicTime, and you can click [here](https://arxiv.org/abs/2404.05014) to see more details. * **[2024.04.08]** 🔥 We released the subset of ChronoMagic dataset used to train MagicTime. The dataset includes 2,265 metamorphic video-text pairs and can be downloaded at [Google Drive](https://drive.google.com/drive/folders/1WsomdkmSp3ql3ImcNsmzFuSQ9Qukuyr8?usp=sharing). * **[2024.04.08]** 🔥 **All codes & datasets** are coming soon! Stay tuned 👀! ## 😮 Highlights MagicTime shows excellent performance in **metamorphic video generation**. ### Metamorphic Videos vs. General Videos Compared to general videos, metamorphic videos contain physical knowledge, long persistence, and strong variation, making them difficult to generate. We show compressed .gif on github, which loses some quality. The general videos are generated by the [Animatediff](https://github.com/guoyww/AnimateDiff) and **MagicTime**.
Type
"Bean sprouts grow and mature from seeds"
"[...] construction in a Minecraft virtual environment"
"Cupcakes baking in an oven [...]"
"[...] transitioning from a tightly closed bud to a fully bloomed state [...]"
General Videos MakeLongVideo MakeLongVideo MakeLongVideo MakeLongVideo
Metamorphic Videos ModelScopeT2V ModelScopeT2V ModelScopeT2V ModelScopeT2V
### Gallery We showcase some metamorphic videos generated by **MagicTime**, [MakeLongVideo](https://github.com/xuduo35/MakeLongVideo), [ModelScopeT2V](https://github.com/modelscope), [VideoCrafter](https://github.com/AILab-CVC/VideoCrafter?tab=readme-ov-file), [ZeroScope](https://huggingface.co/cerspense/zeroscope_v2_576w), [LaVie](https://github.com/Vchitect/LaVie), [T2V-Zero](https://github.com/Picsart-AI-Research/Text2Video-Zero), [Latte](https://github.com/Vchitect/Latte) and [Animatediff](https://github.com/guoyww/AnimateDiff) below.
Method
"cherry blossoms transitioning [...]"
"dough balls baking process [...]"
"an ice cube is melting [...]"
"a simple modern house's construction [...]"
MakeLongVideo MakeLongVideo MakeLongVideo MakeLongVideo MakeLongVideo
ModelScopeT2V ModelScopeT2V ModelScopeT2V ModelScopeT2V ModelScopeT2V
VideoCrafter VideoCrafter VideoCrafter VideoCrafter VideoCrafter
ZeroScope ZeroScope ZeroScope ZeroScope ZeroScope
LaVie LaVie LaVie LaVie LaVie
T2V-Zero T2V-Zero T2V-Zero T2V-Zero T2V-Zero
Latte Latte Latte Latte Latte
Animatediff Animatediff Animatediff Animatediff Animatediff
Ours Ours Ours Ours Ours
We show more metamorphic videos generated by **MagicTime** with the help of [Realistic](https://civitai.com/models/4201/realistic-vision-v20), [ToonYou](https://civitai.com/models/30240/toonyou) and [RcnzCartoon](https://civitai.com/models/66347/rcnz-cartoon-3d).
Realistic Realistic Realistic
"[...] bean sprouts grow and mature from seeds"
"dough [...] swells and browns in the oven [...]"
"the construction [...] in Minecraft [...]"
RcnzCartoon RcnzCartoon RcnzCartoon
"a bud transforms into a yellow flower"
"time-lapse of a plant germinating [...]"
"[...] a modern house being constructed in Minecraft [...]"
ToonYou ToonYou ToonYou
"an ice cube is melting"
"bean plant sprouts grow and mature from the soil"
"time-lapse of delicate pink plum blossoms [...]"
Prompts are trimmed for display, see [here](https://github.com/PKU-YuanGroup/MagicTime/blob/main/__assets__/promtp_unet.txt) for full prompts. ### Integrate into DiT-based Architecture The mission of this project is to help reproduce Sora and provide high-quality video-text data and data annotation pipelines, to support [Open-Sora-Plan](https://github.com/PKU-YuanGroup/Open-Sora-Plan) or other DiT-based T2V models. To this end, we take an initial step to integrate our MagicTime scheme into the DiT-based Framework. Specifically, our method supports the Open-Sora-Plan v1.0.0 for fine-tuning. We first scale up with additional metamorphic landscape time-lapse videos in the same annotation framework to get the ChronoMagic-Landscape dataset. Then, we fine-tune the Open-Sora-Plan v1.0.0 with the ChronoMagic-Landscape dataset to get the MagicTime-DiT model. The results are as follows (**257×512×512 (10s)**):
OpenSora OpenSora OpenSora OpenSora
"Time-lapse of a coastal landscape [...]"
"Display the serene beauty of twilight [...]"
"Sunrise Splendor: Capture the breathtaking moment [...]"
"Nightfall Elegance: Embrace the tranquil beauty [...]"
OpenSora OpenSora OpenSora OpenSora
"The sun descending below the horizon [...]"
"[...] daylight fades into the embrace of the night [...]"
"Time-lapse of the dynamic formations of clouds [...]"
"Capture the dynamic formations of clouds [...]"
Prompts are trimmed for display, see [here](https://github.com/PKU-YuanGroup/MagicTime/blob/main/__assets__/promtp_opensora.txt) for full prompts. ## 🤗 Demo ### Gradio Web UI Highly recommend trying out our web demo by the following command, which incorporates all features currently supported by MagicTime. We also provide [online demo](https://github.com/PKU-YuanGroup/MagicTime) in Huggingface Spaces. ```bash python app.py ``` ## ⚙️ Requirements and Installation We recommend the requirements as follows. ```bash git clone https://github.com/PKU-YuanGroup/MagicTime.git cd MagicTime conda env create -f environment.yml conda activate magictime ``` ## 🗝️ Training & Inference The training code is coming soon! For inference, some example are shown below: ``` # For [Realistic](https://civitai.com/models/4201/realistic-vision-v20) python inference_magictime.py --config sample_configs/RealisticVision.yaml # For [ToonYou](https://civitai.com/models/30240/toonyou) python inference_magictime.py --config sample_configs/ToonYou.yaml # For [RcnzCartoon](https://civitai.com/models/66347/rcnz-cartoon-3d) python inference_magictime.py --config sample_configs/RcnzCartoon.yaml # or you can directly run the .sh sh inference.sh ``` ## 🐳 ChronoMagic Dataset ChronoMagic with 2265 metamorphic time-lapse videos, each accompanied by a detailed caption. We released the subset of ChronoMagic used to train MagicTime. The dataset can be downloaded at [Google Drive](https://drive.google.com/drive/folders/1WsomdkmSp3ql3ImcNsmzFuSQ9Qukuyr8?usp=sharing). Some samples can be found on our Project Page. ## 👍 Acknowledgement * [Animatediff](https://github.com/guoyww/AnimateDiff/tree/main) The codebase we built upon and it is a strong U-Net-based text-to-video generation model. * [Open-Sora-Plan](https://github.com/PKU-YuanGroup/Open-Sora-Plan) The codebase we built upon and it is a simple and scalable DiT-based text-to-video generation repo, to reproduce [Sora](https://openai.com/sora). ## 🔒 License * The majority of this project is released under the Apache 2.0 license as found in the [LICENSE](https://github.com/PKU-YuanGroup/MagicTime/blob/main/LICENSE) file. * The service is a research preview intended for non-commercial use only. Please contact us if you find any potential violations. ## ✏️ Citation If you find our paper and code useful in your research, please consider giving a star :star: and citation :pencil:. ```BibTeX @misc{yuan2024magictime, title={MagicTime: Time-lapse Video Generation Models as Metamorphic Simulators}, author={Shenghai Yuan and Jinfa Huang and Yujun Shi and Yongqi Xu and Ruijie Zhu and Bin Lin and Xinhua Cheng and Li Yuan and Jiebo Luo}, year={2024}, eprint={2404.05014}, archivePrefix={arXiv}, primaryClass={cs.CV} } ``` ## 🤝 Contributors