匿名用户2024年07月31日
30阅读
所属分类aipytorch
开源地址https://modelscope.cn/models/Shanghai_AI_Laboratory/animatediff
授权协议apache-2.0

作品详情

This model repo is for AnimateDiff.

AnimateDiff

This repository is the official implementation of AnimateDiff. It is a plug-and-play module turning most community models into animation generators, without the need of additional training.

AnimateDiff: Animate Your Personalized Text-to-Image Diffusion Models without Specific Tuning
Yuwei Guo, Ceyuan Yang, Anyi Rao, Yaohui Wang, Yu Qiao, Dahua Lin, Bo Dai (Corresponding Author)

We developed four versions of AnimateDiff: v1, v2 and v3 for Stable Diffusion V1.5; sdxl-beta for Stable Diffusion XL.

Next

  • [ ] Update to latest diffusers version
  • [ ] Update Gradio demo
  • [ ] Release training scripts
  • [x] Release AnimateDiff v3 and SparseCtrl

Setup repository and conda environment

git clone https://github.com/guoyww/AnimateDiff.git
cd AnimateDiff

conda env create -f environment.yaml
conda activate animatediff

Download Stable Diffusion V1.5

git lfs install
git clone https://huggingface.co/runwayml/stable-diffusion-v1-5 models/StableDiffusion/

Prepare Community Models

Manually download the community .safetensors models from CivitAI, and save them to models/DreamBooth_LoRA. We recommand RealisticVision V5.1 and ToonYou Beta6.

Prepare AnimateDiff Modules

Manually download the AnimateDiff modules. The download links can be found in each version's model zoo, as provided in the following. Save the modules to models/Motion_Module.

[2023.12] AnimateDiff v3 and SparseCtrl

In this version, we did the image model finetuning through Domain Adapter LoRA for more flexiblity at inference time.

Additionally, we implement two (RGB image/scribble) SparseCtrl Encoders, which can take abitary number of condition maps to control the generation process.

  • Explanation: Domain Adapter is a LoRA module trained on static frames of the training video dataset. This process is done before training the motion module, and helps the motion module focus on motion modeling, as shown in the figure below. At inference, By adjusting the LoRA scale of the Domain Adapter, some visual attributes of the training video, e.g., the watermarks, can be removed. To utilize the SparseCtrl encoder, it's necessary to use a full Domain Adapter in the pipeline.

Technical details of SparseCtrl can be found in this research paper:

SparseCtrl: Adding Sparse Controls to Text-to-Video Diffusion Models
Yuwei Guo, Ceyuan Yang, Anyi Rao, Maneesh Agrawala, Dahua Lin, Bo Dai (Corresponding Author)

Inference

Here we provide three demo inference scripts. The corresponding AnimateDiff modules and community models need to be downloaded in advance. Put motion module in models/Motion_Module; put SparseCtrl encoders in models/SparseCtrl.

# under general T2V setting
python -m scripts.animate --config configs/prompts/v3/v3-1-T2V.yaml

# image animation (on RealisticVision)
python -m scripts.animate --config configs/prompts/v3/v3-2-animation-RealisticVision.yaml

# sketch-to-animation and storyboarding (on RealisticVision)
python -m scripts.animate --config configs/prompts/v3/v3-3-sketch-RealisticVision.yaml

Limitations

  1. Small fickering is noticable. To be solved in future versions;
  2. To stay compatible with comunity models, there is no specific optimizations for general T2V, leading to limited visual quality under this setting;
  3. (Style Alignment) For usage such as image animation/interpolation, it's recommanded to use images generated by the same community model.

[2023.11] AnimateDiff SDXL-Beta

Release the Motion Module (beta version) on SDXL, available at [Google Drive](https://drive.google.com/file/d/1EKD9hDOPfJdK4z8YDB8JYvPracNx2SX/view?usp=sharelink ) / [HuggingFace](https://huggingface.co/guoyww/animatediff/blob/main/mmsdxlv10_beta.ckpt ) / CivitAI. High resolution videos (i.e., 1024x1024x16 frames with various aspect ratios) could be produced with/without personalized models. Inference usually requires ~13GB VRAM and tuned hyperparameters (e.g., #sampling steps), depending on the chosen personalized models.

Checkout to the branch sdxl for more details of the inference. More checkpoints with better-quality would be available soon. Stay tuned. Examples below are manually downsampled for fast loading.

[2023.09] AnimateDiff v2

In this version, the motion module is trained upon larger resolution and batch size. We observe this significantly helps improve the sample quality.

Moreover, we support MotionLoRA for eight basic camera movements.

  • Release MotionLoRA and its model zoo, enabling camera movement controls! Please download the MotionLoRA models (74 MB per model, available at Google Drive / HuggingFace / CivitAI ) and save them to the models/MotionLoRA folder. Example:
  python -m scripts.animate --config configs/prompts/v2/5-RealisticVision-MotionLoRA.yaml
  • New Motion Module release! mm_sd_v15_v2.ckpt was trained on larger resolution & batch size, and gains noticeable quality improvements. Check it out at Google Drive / HuggingFace / CivitAI and use it with configs/inference/inference-v2.yaml. Example:
  python -m scripts.animate --config configs/prompts/v2/5-RealisticVision.yaml

[2023.07] AnimateDiff v1

Inference

Here we provide several demo inference scripts. The corresponding AnimateDiff modules and community models need to be downloaded in advance. See ANIMATEDIFF for detailed setup.

python -m scripts.animate --config configs/prompts/1-ToonYou.yaml
python -m scripts.animate --config configs/prompts/3-RcnzCartoon.yaml

Community Contributions

User Interface developed by community:

Gradio Demo

We created a Gradio demo to make AnimateDiff easier to use. To launch the demo, please run the following commands:

conda activate animatediff
python app.py

By default, the demo will run at localhost:7860.

Common Issues

Installation

Please ensure the installation of xformer that is applied to reduce the inference memory.

Various resolution or number of frames Currently, we recommend users to generate animation with 16 frames and 512 resolution that are aligned with our training settings. Notably, various resolution/frames may affect the quality more or less.

How to use it without any coding

1) Get lora models: train lora model with A1111 based on a collection of your own favorite images (e.g., tutorials English, Japanese, Chinese) or download Lora models from Civitai.

2) Animate lora models: using gradio interface or A1111 (e.g., tutorials English, Japanese, Chinese)

3) Be creative togther with other techniques, such as, super resolution, frame interpolation, music generation, etc.

Animating a given image

We totally agree that animating a given image is an appealing feature, which we would try to support officially in future. For now, you may enjoy other efforts from the talesofai.

Contributions from community Contributions are always welcome!! The dev branch is for community contributions. As for the main branch, we would like to align it with the original technical report :)

Training and inference

Please refer to ANIMATEDIFF for the detailed setup.

BibTeX

@article{guo2023animatediff,
  title={AnimateDiff: Animate Your Personalized Text-to-Image Diffusion Models without Specific Tuning},
  author={Guo, Yuwei and Yang, Ceyuan and Rao, Anyi and Wang, Yaohui and Qiao, Yu and Lin, Dahua and Dai, Bo},
  journal={arXiv preprint arXiv:2307.04725},
  year={2023}
}

@article{guo2023sparsectrl,
  title={SparseCtrl: Adding Sparse Controls to Text-to-Video Diffusion Models},
  author={Guo, Yuwei and Yang, Ceyuan and Rao, Anyi and Agrawala, Maneesh and Lin, Dahua and Dai, Bo},
  journal={arXiv preprint arXiv:2311.16933},
  year={2023}
}

Disclaimer

This project is released for academic use. We disclaim responsibility for user-generated content. Users are solely liable for their actions. The project contributors are not legally affiliated with, nor accountable for, users' behaviors. Use the generative model responsibly, adhering to ethical and legal standards.

Contact Us

Yuwei Guo: guoyuwei@pjlab.org.cn
Ceyuan Yang: yangceyuan@pjlab.org.cn
Bo Dai: daibo@pjlab.org.cn

Acknowledgements

Codebase built upon Tune-a-Video.

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论