Giter Club home page Giter Club logo

magictime's Introduction

If you like our project, please give us a star โญ on GitHub for the latest update.

hf_space
arXiv Home Page Dataset zhihu zhihu DOI License GitHub Repo stars

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.

๐Ÿ’ก We also have other video generation project that may interest you โœจ.

Open-Sora-Plan
PKU-Yuan Lab and Tuzhan AI etc.
github github

๐Ÿ“ฃ News

  • โณโณโณ Training a stronger model with the support of Open-Sora-Plan (e.g 257 x 512 ร— 512).
  • โณโณโณ Release the training code of MagicTime.
  • [2024.04.13] ๐Ÿ”ฅ We are compressing the size of the repo and changing the storage location of assets to make it easier for everyone to clone. Please be patient and wait for a while.
  • [2024.04.12] Thanks @Jukka Seppรคnen and Baobao Wang for providing ComfyUI Extension ComfyUI-MagicTimeWrapper. If you find related work, please let us know.
  • [2024.04.11] ๐Ÿ”ฅ We release the Hugging Face Space of MagicTime, you can click here to have a try.
  • [2024.04.10] ๐Ÿ”ฅ We release the inference code and model weight of MagicTime.
  • [2024.04.09] ๐Ÿ”ฅ We release the arXiv paper for MagicTime, and you can click here 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.
  • [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 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, ModelScopeT2V, VideoCrafter, ZeroScope, LaVie, T2V-Zero, Latte and 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, ToonYou and RcnzCartoon.

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 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 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 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 in Hugging Face Spaces.

python app.py

CLI Inference

# For Realistic
python inference_magictime.py --config sample_configs/RealisticVision.yaml --human

# or you can directly run the .sh
sh inference_cli.sh

warning: It is worth noting that even if we use the same seed and prompt but we change a machine, the results will be different.

โš™๏ธ Requirements and Installation

We recommend the requirements as follows.

Environment

git clone https://github.com/PKU-YuanGroup/MagicTime.git
cd MagicTime
conda create -n magictime python=3.10.13
conda activate magictime
pip install -r requirements.txt

Download Base Model and Dreambooth

sh prepare_weights/down_base_model.sh
sh prepare_weights/down_dreambooth.sh

Prepare MagicTime Module

sh prepare_weights/down_magictime_module.sh

๐Ÿ—๏ธ Training & Inference

The training code is coming soon! For inference, some example are shown below:

# For Realistic
python inference_magictime.py --config sample_configs/RealisticVision.yaml
# For ToonYou
python inference_magictime.py --config sample_configs/ToonYou.yaml
# For RcnzCartoon
python inference_magictime.py --config sample_configs/RcnzCartoon.yaml
# or you can directly run the .sh
sh inference.sh

Community Contributions

We found some plugins created by community developers. Thanks for their efforts:

If you find related work, please let us know.

๐Ÿณ 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. Some samples can be found on our Project Page.

๐Ÿ‘ Acknowledgement

  • Animatediff The codebase we built upon and it is a strong U-Net-based text-to-video generation model.

  • 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.

๐Ÿ”’ License

  • The majority of this project is released under the Apache 2.0 license as found in the LICENSE file.
  • The service is a research preview. 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 โญ and citation ๐Ÿ“.

@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

magictime's People

Contributors

eltociear avatar fenglui avatar infaaa avatar linb203 avatar shyuanbest avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.