2023-11-10 11:57:39 +08:00
# A beta-version of motion module for SDXL
Now you can generate high-resolution videos on SDXL **with/without ** personalized models. Checkpoint with better quality would be available soon. Stay tuned.
2023-11-03 09:49:15 +08:00
2023-11-10 11:57:39 +08:00
## Somethings Important
- Generate videos with high-resolution (we provide recommended ones) as SDXL usually leads to worse quality for low-resolution images.
- Follow and slightly adjust the hyperparameters (e.g., #sampling steps, #guidance scale) of various personalized SDXL since these models are carefully tuned to various extent.
2023-09-25 11:39:05 +08:00
## Model Zoo
<details open>
<summary>Motion Modules</summary>
| Name | Parameter | Storage Space |
|----------------------|-----------|---------------|
2023-11-10 11:57:39 +08:00
| mm_sdxl_v10_beta.ckpt | 238 M | 0.9 GB |
2023-09-25 11:39:05 +08:00
</details>
<details open>
2023-11-10 11:57:39 +08:00
<summary>Recommended Resolution</summary>
| Resolution | Aspect Ratio |
|----------------------|-----------|
| 768x1344 | 9:16 |
| 832x1216 | 2:3 |
| 1024x1024 | 1:1 |
| 1216x832 | 3:2 |
| 1344x768 | 16:9 |
2023-09-25 11:39:05 +08:00
</details>
2023-11-10 11:57:39 +08:00
## Gallery
We demonstrate some results with our model. The GIFs below are **manually downsampled ** after generation for fast loading.
**Original SDXL**
<table class="center">
<tr>
<td><img src="__assets__/animations/model_original/01.gif"></td>
<td><img src="__assets__/animations/model_original/02.gif"></td>
</tr>
</table>
**LoRA**
<table class="center">
<tr>
<td><img src="__assets__/animations/model_01/01.gif"></td>
<td><img src="__assets__/animations/model_01/02.gif"></td>
<td><img src="__assets__/animations/model_01/03.gif"></td>
</tr>
</table>
<p style="margin-left: 2em; margin-top: -1em">Model: <a href="https://civitai.com/models/122606?modelVersionId=169718">DynaVision</a><p>
<table class="center">
<tr>
<td><img src="__assets__/animations/model_02/01.gif"></td>
<td><img src="__assets__/animations/model_02/02.gif"></td>
</tr>
</table>
<p style="margin-left: 2em; margin-top: -1em">Model: <a href="https://civitai.com/models/112902/dreamshaper-xl10?modelVersionId=126688">DreamShaper</a><p>
<table class="center">
<tr>
<td><img src="__assets__/animations/model_03/01.gif"></td>
<td><img src="__assets__/animations/model_03/02.gif"></td>
<td><img src="__assets__/animations/model_03/03.gif"></td>
</tr>
</table>
<p style="margin-left: 2em; margin-top: -1em">Model: <a href="https://civitai.com/models/128397/deepblue-xl?modelVersionId=189102">DeepBlue</a><p>
## Inference Example
Inference at recommended resolution of 16 frames usually requires ~13GB VRAM.
### Step-1: Prepare Environment
2023-07-20 12:58:29 -07:00
2023-11-10 11:57:39 +08:00
```
git clone https://github.com/guoyww/AnimateDiff.git
cd AnimateDiff
git checkout sdxl
2023-07-16 10:40:59 +08:00
2023-07-20 12:58:29 -07:00
2023-11-10 11:57:39 +08:00
conda env create -f environment.yaml
conda activate animatediff_xl
```
2023-07-16 10:40:59 +08:00
2023-11-10 11:57:39 +08:00
### Step-2: Download Base T2I & Motion Module Checkpoints
We provide a beta version of motion module on SDXL. You can download the base model of SDXL 1.0 and Motion Module following instructions below.
```
git lfs install
git clone https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0 models/StableDiffusion/
2023-07-20 12:58:29 -07:00
2023-11-10 11:57:39 +08:00
bash download_bashscripts/0-MotionModule.sh
```
You may also directly download the motion module checkpoints from [Google Drive](https://drive.google.com/file/d/1EK_D9hDOPfJdK4z8YDB8JYvPracNx2SX/view?usp=share_link
) / [HuggingFace](https://huggingface.co/guoyww/animatediff/blob/main/mm_sdxl_v10_beta.ckpt
) / [CivitAI ](https://civitai.com/models/108836/animatediff-motion-modules ), then put them in `models/Motion_Module/` folder.
2023-07-20 12:58:29 -07:00
2023-11-10 11:57:39 +08:00
### Step-3: Download Personalized SDXL (you can skip this if generating videos on the original SDXL)
You may run the following bash scripts to download the LoRA checkpoint from CivitAI.
```
bash download_bashscripts/1-DynaVision.sh
bash download_bashscripts/2-DreamShaper.sh
bash download_bashscripts/3-DeepBlue.sh
```
2023-07-20 12:58:29 -07:00
2023-11-10 11:57:39 +08:00
### Step-4: Generate Videos
Run the following commands to generate videos of **original SDXL ** .
```
python -m scripts.animate --exp_config configs/prompts/1-original_sdxl.yaml --H 1024 --W 1024 --L 16 --xformers
```
Run the following commands to generate videos of **personalized SDXL ** . DO NOT skip Step-3.
```
python -m scripts.animate --config configs/prompts/2-DynaVision.yaml --H 1024 --W 1024 --L 16 --xformers
python -m scripts.animate --config configs/prompts/3-DreamShaper.yaml --H 1024 --W 1024 --L 16 --xformers
python -m scripts.animate --config configs/prompts/4-DeepBlue.yaml --H 1024 --W 1024 --L 16 --xformers
```
The results will automatically be saved to `samples/` folder.
2023-07-20 12:58:29 -07:00
2023-11-10 11:57:39 +08:00
## Customized Inference
To generate videos with a new Checkpoint/LoRA model, you may create a new config `.yaml` file in the following format:
```
2023-07-20 12:58:29 -07:00
2023-11-10 11:57:39 +08:00
motion_module_path: "models/Motion_Module/mm_sdxl_v10_beta.ckpt" # Specify the Motion Module
2023-07-20 12:58:29 -07:00
2023-11-10 11:57:39 +08:00
# We support 3 types of T2I models.
# 1. Checkpoint: a safetensors model contains UNet, Text_Encoders, VAE.
# 2. LoRA: a safetensors model contains only the LoRA modules.
# 3. You can convert the Checkpoint into a folder with the same structure as SDXL_1.0 base model.
2023-07-16 10:40:59 +08:00
2023-11-10 11:57:39 +08:00
ckpt_path: "YOUR_CKPT_PATH" # path to the checkpoint type model from CivitAI.
lora_path: "YOUR_LORA_PATH" # path to the LORA type model from CivitAI.
base_model_path: "YOUR_BASE_MODEL_PATH" # path to the folder converted from a checkpoint
2023-07-16 10:40:59 +08:00
2023-07-18 16:41:22 +08:00
2023-11-10 11:57:39 +08:00
steps: 50
guidance_scale: 8.5
2023-07-13 17:40:54 +08:00
2023-11-10 11:57:39 +08:00
seed: -1 # You can specify seed for each prompt.
2023-07-09 22:40:48 +08:00
2023-11-10 11:57:39 +08:00
prompt:
- "[positive prompt]"
2023-07-10 13:52:01 +08:00
2023-11-10 11:57:39 +08:00
n_prompt:
- "[negative prompt]"
```
Then run the following commands.
```
python -m scripts.animate --exp_config [path to the personalized config] --L [video frames] --H [Height of the videos] --W [Width of the videos] --xformers
```