Add readme
Browse files
README.md
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: creativeml-openrail-m
|
3 |
+
tags:
|
4 |
+
- text-to-video
|
5 |
+
- stable-diffusion
|
6 |
+
- animatediff
|
7 |
+
library_name: diffusers
|
8 |
+
inference: false
|
9 |
+
---
|
10 |
+
# AnimateDiff-Lightning
|
11 |
+
|
12 |
+
<video src='https://huggingface.co/ByteDance/AnimateDiff-Lightning/resolve/main/animatediff_lightning_samples.mp4' width="100%" autoplay muted loop></video>
|
13 |
+
|
14 |
+
AnimateDiff-Lightning is a lightning-fast text-to-video generation model. It can generate 16-frame 512px videos in a few steps. For more information, please refer to our research paper: [AnimateDiff-Lightning: Cross-Model Diffusion Distillation](https://huggingface.co/ByteDance/AnimateDiff-Lightning/resolve/main/animatediff_lightning_report.pdf). We release the model as part of the research.
|
15 |
+
|
16 |
+
Our models are distilled from [AnimateDiff SD1.5 v2](https://huggingface.co/guoyww/animatediff). This repository contains checkpoints for 1-step, 2-step, 4-step, and 8-step distilled models. The generation quality of our 2-step, 4-step, and 8-step model is great. Our 1-step model is only provided for research purposes.
|
17 |
+
|
18 |
+
|
19 |
+
## Recommendation
|
20 |
+
|
21 |
+
AnimateDiff-Lightning produces the best results when used with stylized base models. We recommend using the following base models:
|
22 |
+
|
23 |
+
Realistic
|
24 |
+
- [epiCRealism](https://civitai.com/models/25694)
|
25 |
+
- [Realistic Vision](https://civitai.com/models/4201)
|
26 |
+
- [DreamShaper](https://civitai.com/models/4384)
|
27 |
+
- [AbsoluteReality](https://civitai.com/models/81458)
|
28 |
+
- [MajicMix Realistic](https://civitai.com/models/43331)
|
29 |
+
|
30 |
+
Anime & Cartoon
|
31 |
+
- [ToonYou](https://civitai.com/models/30240)
|
32 |
+
- [IMP](https://civitai.com/models/56680)
|
33 |
+
- [Mistoon Anime](https://civitai.com/models/24149)
|
34 |
+
- [DynaVision](https://civitai.com/models/75549)
|
35 |
+
- [RCNZ Cartoon 3d](https://civitai.com/models/66347)
|
36 |
+
- [MajicMix Reverie](https://civitai.com/models/65055)
|
37 |
+
|
38 |
+
Additionally, feel free to explore different settings. We find using 3 inference steps on the 2-step model produces great results. We find certain base models produces better results with CFG.
|
39 |
+
|
40 |
+
## Diffusers Usage
|
41 |
+
|
42 |
+
```python
|
43 |
+
import torch
|
44 |
+
from diffusers import AnimateDiffPipeline, MotionAdapter, EulerDiscreteScheduler
|
45 |
+
from diffusers.utils import export_to_gif
|
46 |
+
from huggingface_hub import hf_hub_download
|
47 |
+
from safetensors.torch import load_file
|
48 |
+
|
49 |
+
device = "cuda"
|
50 |
+
dtype = torch.float16
|
51 |
+
|
52 |
+
step = 4 # Options: [1,2,4,8]
|
53 |
+
repo = "AnimateDiff-Lightning"
|
54 |
+
ckpt = f"animatediff_lightning_{step}step_diffusers.safetensors"
|
55 |
+
base = "SG161222/Realistic_Vision_V5.1_noVAE" # Choose to your favorite base model.
|
56 |
+
|
57 |
+
adapter = MotionAdapter().to(device, dtype)
|
58 |
+
adapter.load_state_dict(load_file(hf_hub_download(repo ,ckpt), device=device))
|
59 |
+
pipe = AnimateDiffPipeline.from_pretrained(base, motion_adapter=adapter, torch_dtype=dtype).to(device)
|
60 |
+
pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing", beta_schedule="linear")
|
61 |
+
|
62 |
+
output = pipe(prompt="A girl smiling", guidance_scale=1.0, num_inference_steps=step)
|
63 |
+
export_to_gif(output.frames[0], "animation.gif")
|
64 |
+
```
|