Add GitHub repository link to model card
Browse filesThis PR improves the model card by adding a direct link to the original GitHub repository, making it easier for users to find the source code.
README.md
CHANGED
@@ -1,20 +1,21 @@
|
|
1 |
---
|
|
|
|
|
|
|
2 |
license: mit
|
3 |
-
|
4 |
-
- image-to-video
|
5 |
-
- text-to-video
|
6 |
tags:
|
7 |
- video-generation
|
8 |
- video diffusion transformer
|
9 |
- audio-driven avatar animation
|
10 |
-
|
11 |
-
-
|
12 |
-
|
13 |
-
library_name: diffusers
|
14 |
---
|
|
|
15 |
# StableAvatar
|
16 |
|
17 |
-
<a href='https://francis-rings.github.io/StableAvatar'><img src='https://img.shields.io/badge/Project-Page-Green'></a> <a href='https://arxiv.org/abs/2508.08248'><img src='https://img.shields.io/badge/Paper-Arxiv-red'></a> <a href='https://huggingface.co/FrancisRing/StableAvatar/tree/main'><img src='https://img.shields.io/badge/HuggingFace-Model-orange'></a> <a href='https://www.youtube.com/watch?v=6lhvmbzvv3Y'><img src='https://img.shields.io/badge/YouTube-Watch-red?style=flat-square&logo=youtube'></a> <a href='https://www.bilibili.com/video/BV1hUt9z4EoQ'><img src='https://img.shields.io/badge/Bilibili-Watch-blue?style=flat-square&logo=bilibili'></a>
|
18 |
|
19 |
StableAvatar: Infinite-Length Audio-Driven Avatar Video Generation
|
20 |
<br/>
|
@@ -78,10 +79,13 @@ StableAvatar: Infinite-Length Audio-Driven Avatar Video Generation
|
|
78 |
</p>
|
79 |
|
80 |
Current diffusion models for audio-driven avatar video generation struggle to synthesize long videos with natural audio synchronization and identity consistency. This paper presents StableAvatar, the first end-to-end video diffusion transformer that synthesizes infinite-length high-quality videos without post-processing. Conditioned on a reference image and audio, StableAvatar integrates tailored training and inference modules to enable infinite-length video generation.
|
81 |
-
We observe that the main reason preventing existing models from generating long videos lies in their audio modeling. They typically rely on third-party off-the-shelf extractors to obtain audio embeddings, which are then directly injected into the diffusion model via cross-attention. Since current diffusion backbones lack any audio-related priors, this approach causes severe latent distribution error accumulation across video clips, leading the latent distribution of subsequent segments to drift away from the optimal distribution gradually.
|
82 |
-
To address this, StableAvatar introduces a novel Time-step-aware Audio Adapter that prevents error accumulation via time-step-aware modulation. During inference, we propose a novel Audio Native Guidance Mechanism to further enhance the audio synchronization by leveraging the diffusion’s own evolving joint audio-latent prediction as a dynamic guidance signal. To enhance the smoothness of the infinite-length videos, we introduce a Dynamic Weighted Sliding-window Strategy that fuses latent over time. Experiments on benchmarks show the effectiveness of StableAvatar both qualitatively and quantitatively.
|
83 |
|
84 |
## News
|
|
|
|
|
|
|
|
|
85 |
* `[2025-8-11]`:🔥 The project page, code, technical report and [a basic model checkpoint](https://huggingface.co/FrancisRing/StableAvatar/tree/main) are released. Further lora training codes, the evaluation dataset and StableAvatar-pro will be released very soon. Stay tuned!
|
86 |
|
87 |
## 🛠️ To-Do List
|
@@ -90,9 +94,9 @@ To address this, StableAvatar introduces a novel Time-step-aware Audio Adapter t
|
|
90 |
- [x] Data Pre-Processing Code (Audio Extraction)
|
91 |
- [x] Data Pre-Processing Code (Vocal Separation)
|
92 |
- [x] Training Code
|
93 |
-
- [
|
94 |
-
- [
|
95 |
-
- [
|
96 |
- [ ] Inference Code with Audio Native Guidance
|
97 |
- [ ] StableAvatar-pro
|
98 |
|
@@ -109,6 +113,15 @@ pip install -r requirements.txt
|
|
109 |
pip install flash_attn
|
110 |
```
|
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
### 🧱 Download weights
|
113 |
If you encounter connection issues with Hugging Face, you can utilize the mirror endpoint by setting the environment variable: `export HF_ENDPOINT=https://hf-mirror.com`.
|
114 |
Please download weights manually as follows:
|
@@ -152,7 +165,7 @@ python audio_extractor.py --video_path="path/test/video.mp4" --saved_audio_path=
|
|
152 |
As noisy background music may negatively impact the performance of StableAvatar to some extents, you can further separate the vocal from the audio file for better lip synchronization.
|
153 |
Given the path to an audio file (.wav), you can run the following command to extract the corresponding vocal signals:
|
154 |
```
|
155 |
-
pip install audio-separator
|
156 |
python vocal_seperator.py --audio_separator_model_file="path/StableAvatar/checkpoints/Kim_Vocal_2.onnx" --audio_file_path="path/test/audio.wav" --saved_vocal_path="path/test/vocal.wav"
|
157 |
```
|
158 |
|
@@ -169,6 +182,11 @@ Prompts are also very important. It is recommended to `[Description of first fra
|
|
169 |
Notably, the recommended `--sample_steps` range is [30-50], more steps bring higher quality. The recommended `--overlap_window_length` range is [5-15], as longer overlapping length results in higher quality and slower inference speed.
|
170 |
"--sample_text_guide_scale" and "--sample_audio_guide_scale" are Classify-Free-Guidance scale of text prompt and audio. The recommended range for prompt and audio cfg is `[3-6]`. You can increase the audio cfg to facilitate the lip synchronization with audio.
|
171 |
|
|
|
|
|
|
|
|
|
|
|
172 |
We provide 6 cases in different resolution settings in `path/StableAvatar/examples` for validation. ❤️❤️Please feel free to try it out and enjoy the endless entertainment of infinite-length avatar video generation❤️❤️!
|
173 |
|
174 |
#### 💡Tips
|
@@ -178,6 +196,11 @@ We provide 6 cases in different resolution settings in `path/StableAvatar/exampl
|
|
178 |
Setting `--GPU_memory_mode` to `model_cpu_offload` can significantly cut GPU memory usage, reducing it by roughly half compared to `model_full_load` mode.
|
179 |
|
180 |
- If you have multiple Gpus, you can run Multi-GPU inference to speed up by modifying "--ulysses_degree" and "--ring_degree" in `inference.sh`. For example, if you have 8 GPUs, you can set `--ulysses_degree=4` and `--ring_degree=2`. Notably, you have to ensure ulysses_degree*ring_degree=total GPU number/world-size. Moreover, you can also add `--fsdp_dit` in `inference.sh` to activate FSDP in DiT to further reduce GPU memory consumption.
|
|
|
|
|
|
|
|
|
|
|
181 |
|
182 |
The video synthesized by StableAvatar is without audio. If you want to obtain the high quality MP4 file with audio, we recommend you to leverage ffmpeg on the <b>output_path</b> as follows:
|
183 |
```
|
@@ -380,8 +403,34 @@ We utilize deepspeed stage-2 to train Wan2.1-14B-based StableAvatar. The GPU con
|
|
380 |
The deepspeed optimization configuration and deepspeed scheduler configuration are in `path/StableAvatar/deepspeed_config/zero_stage2_config.json`.
|
381 |
Notably, we observe that Wan2.1-1.3B-based StableAvatar is already capable of synthesizing infinite-length high quality avatar videos. The Wan2.1-14B backbone significantly increase the inference latency and GPU memory consumption during training, indicating limited efficiency in terms of performance-to-resource ratio.
|
382 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
If you want to train 720P Wan2.1-1.3B-based or Wan2.1-14B-based StableAvatar, you can directly modify the height and width of the dataloader (480p-->720p) in `train_1B_square.py`/`train_1B_vec_rec.py`/`train_14B.py`.
|
384 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
385 |
### 🧱 VRAM requirement and Runtime
|
386 |
|
387 |
For the 5s video (480x832, fps=25), the basic model (--GPU_memory_mode="model_full_load") requires approximately 18GB VRAM and finishes in 3 minutes on a 4090 GPU.
|
|
|
1 |
---
|
2 |
+
base_model:
|
3 |
+
- Wan-AI/Wan2.1-T2V-14B
|
4 |
+
library_name: diffusers
|
5 |
license: mit
|
6 |
+
pipeline_tag: image-to-video
|
|
|
|
|
7 |
tags:
|
8 |
- video-generation
|
9 |
- video diffusion transformer
|
10 |
- audio-driven avatar animation
|
11 |
+
task_categories:
|
12 |
+
- image-to-video
|
13 |
+
- text-to-video
|
|
|
14 |
---
|
15 |
+
|
16 |
# StableAvatar
|
17 |
|
18 |
+
<a href='https://francis-rings.github.io/StableAvatar'><img src='https://img.shields.io/badge/Project-Page-Green'></a> <a href='https://arxiv.org/abs/2508.08248'><img src='https://img.shields.io/badge/Paper-Arxiv-red'></a> <a href='https://github.com/Francis-Rings/StableAvatar'><img src='https://img.shields.io/badge/GitHub-Code-blue?logo=github'></a> <a href='https://huggingface.co/FrancisRing/StableAvatar/tree/main'><img src='https://img.shields.io/badge/HuggingFace-Model-orange'></a> <a href='https://www.youtube.com/watch?v=6lhvmbzvv3Y'><img src='https://img.shields.io/badge/YouTube-Watch-red?style=flat-square&logo=youtube'></a> <a href='https://www.bilibili.com/video/BV1hUt9z4EoQ'><img src='https://img.shields.io/badge/Bilibili-Watch-blue?style=flat-square&logo=bilibili'></a>
|
19 |
|
20 |
StableAvatar: Infinite-Length Audio-Driven Avatar Video Generation
|
21 |
<br/>
|
|
|
79 |
</p>
|
80 |
|
81 |
Current diffusion models for audio-driven avatar video generation struggle to synthesize long videos with natural audio synchronization and identity consistency. This paper presents StableAvatar, the first end-to-end video diffusion transformer that synthesizes infinite-length high-quality videos without post-processing. Conditioned on a reference image and audio, StableAvatar integrates tailored training and inference modules to enable infinite-length video generation.
|
82 |
+
We observe that the main reason preventing existing models from generating long videos lies in their audio modeling. They typically rely on third-party off-the-shelf extractors to obtain audio embeddings, which are then directly injected into the diffusion model via cross-attention. Since current diffusion backbones lack any audio-related priors, this approach causes severe latent distribution error accumulation across video clips, leading the latent distribution of subsequent segments to drift away from the optimal distribution gradually. To address this, StableAvatar introduces a novel Time-step-aware Audio Adapter that prevents error accumulation via time-step-aware modulation. During inference, we propose a novel Audio Native Guidance Mechanism to further enhance the audio synchronization by leveraging the diffusion’s own evolving joint audio-latent prediction as a dynamic guidance signal. To enhance the smoothness of the infinite-length videos, we introduce a Dynamic Weighted Sliding-window Strategy that fuses latent over time. Experiments on benchmarks show the effectiveness of StableAvatar both qualitatively and quantitatively.
|
|
|
83 |
|
84 |
## News
|
85 |
+
* `[2025-8-16]`:🔥 We release the finetuning codes and lora training/finetuning codes! Other codes will be public as soon as possible. Stay tuned!
|
86 |
+
* `[2025-8-15]`:🔥 StableAvatar can run on Gradio Interface. Thanks @[gluttony-10](https://space.bilibili.com/893892) for the contribution!
|
87 |
+
* `[2025-8-15]`:🔥 StableAvatar can run on [ComfyUI](https://github.com/smthemex/ComfyUI_StableAvatar). Thanks @[smthemex](https://github.com/smthemex) for the contribution.
|
88 |
+
* `[2025-8-13]`:🔥 Added changes to run StableAvatar on the new Blackwell series Nvidia chips, including the RTX 6000 Pro.
|
89 |
* `[2025-8-11]`:🔥 The project page, code, technical report and [a basic model checkpoint](https://huggingface.co/FrancisRing/StableAvatar/tree/main) are released. Further lora training codes, the evaluation dataset and StableAvatar-pro will be released very soon. Stay tuned!
|
90 |
|
91 |
## 🛠️ To-Do List
|
|
|
94 |
- [x] Data Pre-Processing Code (Audio Extraction)
|
95 |
- [x] Data Pre-Processing Code (Vocal Separation)
|
96 |
- [x] Training Code
|
97 |
+
- [x] Full Finetuning Code
|
98 |
+
- [x] Lora Training Code
|
99 |
+
- [x] Lora Finetuning Code
|
100 |
- [ ] Inference Code with Audio Native Guidance
|
101 |
- [ ] StableAvatar-pro
|
102 |
|
|
|
113 |
pip install flash_attn
|
114 |
```
|
115 |
|
116 |
+
### 🧱 Environment setup for Blackwell series chips
|
117 |
+
|
118 |
+
```
|
119 |
+
pip install torch==2.7.0 torchvision==0.22.0 torchaudio==2.7.0 --index-url https://download.pytorch.org/whl/cu128
|
120 |
+
pip install -r requirements.txt
|
121 |
+
# Optional to install flash_attn to accelerate attention computation
|
122 |
+
pip install flash_attn
|
123 |
+
```
|
124 |
+
|
125 |
### 🧱 Download weights
|
126 |
If you encounter connection issues with Hugging Face, you can utilize the mirror endpoint by setting the environment variable: `export HF_ENDPOINT=https://hf-mirror.com`.
|
127 |
Please download weights manually as follows:
|
|
|
165 |
As noisy background music may negatively impact the performance of StableAvatar to some extents, you can further separate the vocal from the audio file for better lip synchronization.
|
166 |
Given the path to an audio file (.wav), you can run the following command to extract the corresponding vocal signals:
|
167 |
```
|
168 |
+
pip install audio-separator[gpu]
|
169 |
python vocal_seperator.py --audio_separator_model_file="path/StableAvatar/checkpoints/Kim_Vocal_2.onnx" --audio_file_path="path/test/audio.wav" --saved_vocal_path="path/test/vocal.wav"
|
170 |
```
|
171 |
|
|
|
182 |
Notably, the recommended `--sample_steps` range is [30-50], more steps bring higher quality. The recommended `--overlap_window_length` range is [5-15], as longer overlapping length results in higher quality and slower inference speed.
|
183 |
"--sample_text_guide_scale" and "--sample_audio_guide_scale" are Classify-Free-Guidance scale of text prompt and audio. The recommended range for prompt and audio cfg is `[3-6]`. You can increase the audio cfg to facilitate the lip synchronization with audio.
|
184 |
|
185 |
+
Additionally, you can also run the following command to launch a Gradio interface:
|
186 |
+
```
|
187 |
+
python app.py
|
188 |
+
```
|
189 |
+
|
190 |
We provide 6 cases in different resolution settings in `path/StableAvatar/examples` for validation. ❤️❤️Please feel free to try it out and enjoy the endless entertainment of infinite-length avatar video generation❤️❤️!
|
191 |
|
192 |
#### 💡Tips
|
|
|
196 |
Setting `--GPU_memory_mode` to `model_cpu_offload` can significantly cut GPU memory usage, reducing it by roughly half compared to `model_full_load` mode.
|
197 |
|
198 |
- If you have multiple Gpus, you can run Multi-GPU inference to speed up by modifying "--ulysses_degree" and "--ring_degree" in `inference.sh`. For example, if you have 8 GPUs, you can set `--ulysses_degree=4` and `--ring_degree=2`. Notably, you have to ensure ulysses_degree*ring_degree=total GPU number/world-size. Moreover, you can also add `--fsdp_dit` in `inference.sh` to activate FSDP in DiT to further reduce GPU memory consumption.
|
199 |
+
You can fun the following command:
|
200 |
+
```
|
201 |
+
bash multiple_gpu_inference.sh
|
202 |
+
```
|
203 |
+
In my setting, 4 GPUs are utilized for inference.
|
204 |
|
205 |
The video synthesized by StableAvatar is without audio. If you want to obtain the high quality MP4 file with audio, we recommend you to leverage ffmpeg on the <b>output_path</b> as follows:
|
206 |
```
|
|
|
403 |
The deepspeed optimization configuration and deepspeed scheduler configuration are in `path/StableAvatar/deepspeed_config/zero_stage2_config.json`.
|
404 |
Notably, we observe that Wan2.1-1.3B-based StableAvatar is already capable of synthesizing infinite-length high quality avatar videos. The Wan2.1-14B backbone significantly increase the inference latency and GPU memory consumption during training, indicating limited efficiency in terms of performance-to-resource ratio.
|
405 |
|
406 |
+
You can also run the following commands to perform lora training:
|
407 |
+
```
|
408 |
+
# Training StableAvatar-1.3B on a mixed resolution setting (480x832 and 832x480) in a single machine
|
409 |
+
bash train_1B_rec_vec_lora.sh
|
410 |
+
# Training StableAvatar-1.3B on a mixed resolution setting (480x832 and 832x480) in multiple machines
|
411 |
+
bash train_1B_rec_vec_lora_64.sh
|
412 |
+
# Lora-Training StableAvatar-14B on a mixed resolution setting (480x832, 832x480, and 512x512) in multiple machines
|
413 |
+
bash train_14B_lora.sh
|
414 |
+
```
|
415 |
+
You can modify `--rank` and `--network_alpha` to control the quality of your lora training/finetuning.
|
416 |
+
|
417 |
If you want to train 720P Wan2.1-1.3B-based or Wan2.1-14B-based StableAvatar, you can directly modify the height and width of the dataloader (480p-->720p) in `train_1B_square.py`/`train_1B_vec_rec.py`/`train_14B.py`.
|
418 |
|
419 |
+
### 🧱 Model Finetuning
|
420 |
+
Regarding fully finetuning StableAvatar, you can add `--transformer_path="path/StableAvatar/checkpoints/StableAvatar-1.3B/transformer3d-square.pt"` to the `train_1B_rec_vec.sh` or `train_1B_rec_vec_64.sh`:
|
421 |
+
```
|
422 |
+
# Finetuning StableAvatar on a mixed resolution setting (480x832 and 832x480) in a single machine
|
423 |
+
bash train_1B_rec_vec.sh
|
424 |
+
# Finetuning StableAvatar on a mixed resolution setting (480x832 and 832x480) in multiple machines
|
425 |
+
bash train_1B_rec_vec_64.sh
|
426 |
+
```
|
427 |
+
In terms of lora finetuning StableAvatar, you can add `--transformer_path="path/StableAvatar/checkpoints/StableAvatar-1.3B/transformer3d-square.pt"` to the `train_1B_rec_vec_lora.sh`:
|
428 |
+
```
|
429 |
+
# Lora-Finetuning StableAvatar-1.3B on a mixed resolution setting (480x832 and 832x480) in a single machine
|
430 |
+
bash train_1B_rec_vec_lora.sh
|
431 |
+
```
|
432 |
+
You can modify `--rank` and `--network_alpha` to control the quality of your lora training/finetuning.
|
433 |
+
|
434 |
### 🧱 VRAM requirement and Runtime
|
435 |
|
436 |
For the 5s video (480x832, fps=25), the basic model (--GPU_memory_mode="model_full_load") requires approximately 18GB VRAM and finishes in 3 minutes on a 4090 GPU.
|