Spanicin commited on
Commit
c18a0c8
·
verified ·
1 Parent(s): 2589745

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +6 -400
README.md CHANGED
@@ -1,400 +1,6 @@
1
- <h1 align='center'>Hallo: Hierarchical Audio-Driven Visual Synthesis for Portrait Image Animation</h1>
2
-
3
- <div align='center'>
4
- <a href='https://github.com/xumingw' target='_blank'>Mingwang Xu</a><sup>1*</sup>&emsp;
5
- <a href='https://github.com/crystallee-ai' target='_blank'>Hui Li</a><sup>1*</sup>&emsp;
6
- <a href='https://github.com/subazinga' target='_blank'>Qingkun Su</a><sup>1*</sup>&emsp;
7
- <a href='https://github.com/NinoNeumann' target='_blank'>Hanlin Shang</a><sup>1</sup>&emsp;
8
- <a href='https://github.com/AricGamma' target='_blank'>Liwei Zhang</a><sup>1</sup>&emsp;
9
- <a href='https://github.com/cnexah' target='_blank'>Ce Liu</a><sup>3</sup>&emsp;
10
- </div>
11
- <div align='center'>
12
- <a href='https://jingdongwang2017.github.io/' target='_blank'>Jingdong Wang</a><sup>2</sup>&emsp;
13
- <a href='https://yoyo000.github.io/' target='_blank'>Yao Yao</a><sup>4</sup>&emsp;
14
- <a href='https://sites.google.com/site/zhusiyucs/home' target='_blank'>Siyu Zhu</a><sup>1</sup>&emsp;
15
- </div>
16
-
17
- <div align='center'>
18
- <sup>1</sup>Fudan University&emsp; <sup>2</sup>Baidu Inc&emsp; <sup>3</sup>ETH Zurich&emsp; <sup>4</sup>Nanjing University
19
- </div>
20
-
21
- <br>
22
- <div align='center'>
23
- <a href='https://github.com/fudan-generative-vision/hallo'><img src='https://img.shields.io/github/stars/fudan-generative-vision/hallo?style=social'></a>
24
- <a href='https://fudan-generative-vision.github.io/hallo/#/'><img src='https://img.shields.io/badge/Project-HomePage-Green'></a>
25
- <a href='https://arxiv.org/pdf/2406.08801'><img src='https://img.shields.io/badge/Paper-Arxiv-red'></a>
26
- <a href='https://huggingface.co/fudan-generative-ai/hallo'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20HuggingFace-Model-yellow'></a>
27
- <a href='https://huggingface.co/spaces/fffiloni/tts-hallo-talking-portrait'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20HuggingFace-Demo-yellow'></a>
28
- <a href='https://www.modelscope.cn/models/fudan-generative-vision/Hallo/summary'><img src='https://img.shields.io/badge/Modelscope-Model-purple'></a>
29
- <a href='assets/wechat.jpeg'><img src='https://badges.aleen42.com/src/wechat.svg'></a>
30
- </div>
31
-
32
- <br>
33
-
34
- ## 📸 Showcase
35
-
36
-
37
- https://github.com/fudan-generative-vision/hallo/assets/17402682/9d1a0de4-3470-4d38-9e4f-412f517f834c
38
-
39
- ### 🎬 Honoring Classic Films
40
-
41
- <table class="center">
42
- <tr>
43
- <td style="text-align: center"><b>Devil Wears Prada</b></td>
44
- <td style="text-align: center"><b>Green Book</b></td>
45
- <td style="text-align: center"><b>Infernal Affairs</b></td>
46
- </tr>
47
- <tr>
48
- <td style="text-align: center"><a target="_blank" href="https://cdn.aondata.work/video/short_movie/Devil_Wears_Prada-480p.mp4"><img src="https://cdn.aondata.work/img/short_movie/Devil_Wears_Prada_GIF.gif"></a></td>
49
- <td style="text-align: center"><a target="_blank" href="https://cdn.aondata.work/video/short_movie/Green_Book-480p.mp4"><img src="https://cdn.aondata.work/img/short_movie/Green_Book_GIF.gif"></a></td>
50
- <td style="text-align: center"><a target="_blank" href="https://cdn.aondata.work/video/short_movie/无间道-480p.mp4"><img src="https://cdn.aondata.work/img/short_movie/Infernal_Affairs_GIF.gif"></a></td>
51
- </tr>
52
- <tr>
53
- <td style="text-align: center"><b>Patch Adams</b></td>
54
- <td style="text-align: center"><b>Tough Love</b></td>
55
- <td style="text-align: center"><b>Shawshank Redemption</b></td>
56
- </tr>
57
- <tr>
58
- <td style="text-align: center"><a target="_blank" href="https://cdn.aondata.work/video/short_movie/Patch_Adams-480p.mp4"><img src="https://cdn.aondata.work/img/short_movie/Patch_Adams_GIF.gif"></a></td>
59
- <td style="text-align: center"><a target="_blank" href="https://cdn.aondata.work/video/short_movie/Tough_Love-480p.mp4"><img src="https://cdn.aondata.work/img/short_movie/Tough_Love_GIF.gif"></a></td>
60
- <td style="text-align: center"><a target="_blank" href="https://cdn.aondata.work/video/short_movie/Shawshank-480p.mp4"><img src="https://cdn.aondata.work/img/short_movie/Shawshank_GIF.gif"></a></td>
61
- </tr>
62
- </table>
63
-
64
- Explore [more examples](https://fudan-generative-vision.github.io/hallo).
65
-
66
- ## 📰 News
67
-
68
- - **`2024/06/28`**: 🎉🎉🎉 We are proud to announce the release of our model training code. Try your own training data. Here is [tutorial](#training).
69
- - **`2024/06/21`**: 🚀🚀🚀 Cloned a Gradio demo on [🤗Huggingface space](https://huggingface.co/spaces/fudan-generative-ai/hallo).
70
- - **`2024/06/20`**: 🌟🌟🌟 Received numerous contributions from the community, including a [Windows version](https://github.com/sdbds/hallo-for-windows), [ComfyUI](https://github.com/AIFSH/ComfyUI-Hallo), [WebUI](https://github.com/fudan-generative-vision/hallo/pull/51), and [Docker template](https://github.com/ashleykleynhans/hallo-docker).
71
- - **`2024/06/15`**: ✨✨✨ Released some images and audios for inference testing on [🤗Huggingface](https://huggingface.co/datasets/fudan-generative-ai/hallo_inference_samples).
72
- - **`2024/06/15`**: 🎉🎉🎉 Launched the first version on 🫡[GitHub](https://github.com/fudan-generative-vision/hallo).
73
-
74
- ## 🤝 Community Resources
75
-
76
- Explore the resources developed by our community to enhance your experience with Hallo:
77
-
78
- - [TTS x Hallo Talking Portrait Generator](https://huggingface.co/spaces/fffiloni/tts-hallo-talking-portrait) - Check out this awesome Gradio demo by [@Sylvain Filoni](https://huggingface.co/fffiloni)! With this tool, you can conveniently prepare portrait image and audio for Hallo.
79
- - [Demo on Huggingface](https://huggingface.co/spaces/multimodalart/hallo) - Check out this easy-to-use Gradio demo by [@multimodalart](https://huggingface.co/multimodalart).
80
- - [hallo-webui](https://github.com/daswer123/hallo-webui) - Explore the WebUI created by [@daswer123](https://github.com/daswer123).
81
- - [hallo-for-windows](https://github.com/sdbds/hallo-for-windows) - Utilize Hallo on Windows with the guide by [@sdbds](https://github.com/sdbds).
82
- - [ComfyUI-Hallo](https://github.com/AIFSH/ComfyUI-Hallo) - Integrate Hallo with the ComfyUI tool by [@AIFSH](https://github.com/AIFSH).
83
- - [hallo-docker](https://github.com/ashleykleynhans/hallo-docker) - Docker image for Hallo by [@ashleykleynhans](https://github.com/ashleykleynhans).
84
- - [RunPod Template](https://runpod.io/console/deploy?template=aeyibwyvzy&ref=2xxro4syy) - Deploy Hallo to RunPod by [@ashleykleynhans](https://github.com/ashleykleynhans).
85
- - [JoyHallo](https://jdh-algo.github.io/JoyHallo/) - JoyHallo extends the capabilities of Hallo, enabling it to support Mandarin
86
-
87
- Thanks to all of them.
88
-
89
- Join our community and explore these amazing resources to make the most out of Hallo. Enjoy and elevate their creative projects!
90
-
91
- ## 🔧️ Framework
92
-
93
- ![abstract](assets/framework_1.jpg)
94
- ![framework](assets/framework_2.jpg)
95
-
96
- ## ⚙️ Installation
97
-
98
- - System requirement: Ubuntu 20.04/Ubuntu 22.04, Cuda 12.1
99
- - Tested GPUs: A100
100
-
101
- Create conda environment:
102
-
103
- ```bash
104
- conda create -n hallo python=3.10
105
- conda activate hallo
106
- ```
107
-
108
- Install packages with `pip`
109
-
110
- ```bash
111
- pip install -r requirements.txt
112
- pip install .
113
- ```
114
-
115
- Besides, ffmpeg is also needed:
116
- ```bash
117
- apt-get install ffmpeg
118
- ```
119
-
120
- ## 🗝️️ Usage
121
-
122
- The entry point for inference is `scripts/inference.py`. Before testing your cases, two preparations need to be completed:
123
-
124
- 1. [Download all required pretrained models](#download-pretrained-models).
125
- 2. [Prepare source image and driving audio pairs](#prepare-inference-data).
126
- 3. [Run inference](#run-inference).
127
-
128
- ### 📥 Download Pretrained Models
129
-
130
- You can easily get all pretrained models required by inference from our [HuggingFace repo](https://huggingface.co/fudan-generative-ai/hallo).
131
-
132
- Clone the pretrained models into `${PROJECT_ROOT}/pretrained_models` directory by cmd below:
133
-
134
- ```shell
135
- git lfs install
136
- git clone https://huggingface.co/fudan-generative-ai/hallo pretrained_models
137
- ```
138
-
139
- Or you can download them separately from their source repo:
140
-
141
- - [hallo](https://huggingface.co/fudan-generative-ai/hallo/tree/main/hallo): Our checkpoints consist of denoising UNet, face locator, image & audio proj.
142
- - [audio_separator](https://huggingface.co/huangjackson/Kim_Vocal_2): Kim\_Vocal\_2 MDX-Net vocal removal model. (_Thanks to [KimberleyJensen](https://github.com/KimberleyJensen)_)
143
- - [insightface](https://github.com/deepinsight/insightface/tree/master/python-package#model-zoo): 2D and 3D Face Analysis placed into `pretrained_models/face_analysis/models/`. (_Thanks to deepinsight_)
144
- - [face landmarker](https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/1/face_landmarker.task): Face detection & mesh model from [mediapipe](https://ai.google.dev/edge/mediapipe/solutions/vision/face_landmarker#models) placed into `pretrained_models/face_analysis/models`.
145
- - [motion module](https://github.com/guoyww/AnimateDiff/blob/main/README.md#202309-animatediff-v2): motion module from [AnimateDiff](https://github.com/guoyww/AnimateDiff). (_Thanks to [guoyww](https://github.com/guoyww)_).
146
- - [sd-vae-ft-mse](https://huggingface.co/stabilityai/sd-vae-ft-mse): Weights are intended to be used with the diffusers library. (_Thanks to [stablilityai](https://huggingface.co/stabilityai)_)
147
- - [StableDiffusion V1.5](https://huggingface.co/runwayml/stable-diffusion-v1-5): Initialized and fine-tuned from Stable-Diffusion-v1-2. (_Thanks to [runwayml](https://huggingface.co/runwayml)_)
148
- - [wav2vec](https://huggingface.co/facebook/wav2vec2-base-960h): wav audio to vector model from [Facebook](https://huggingface.co/facebook/wav2vec2-base-960h).
149
-
150
- Finally, these pretrained models should be organized as follows:
151
-
152
- ```text
153
- ./pretrained_models/
154
- |-- audio_separator/
155
- | |-- download_checks.json
156
- | |-- mdx_model_data.json
157
- | |-- vr_model_data.json
158
- | `-- Kim_Vocal_2.onnx
159
- |-- face_analysis/
160
- | `-- models/
161
- | |-- face_landmarker_v2_with_blendshapes.task # face landmarker model from mediapipe
162
- | |-- 1k3d68.onnx
163
- | |-- 2d106det.onnx
164
- | |-- genderage.onnx
165
- | |-- glintr100.onnx
166
- | `-- scrfd_10g_bnkps.onnx
167
- |-- motion_module/
168
- | `-- mm_sd_v15_v2.ckpt
169
- |-- sd-vae-ft-mse/
170
- | |-- config.json
171
- | `-- diffusion_pytorch_model.safetensors
172
- |-- stable-diffusion-v1-5/
173
- | `-- unet/
174
- | |-- config.json
175
- | `-- diffusion_pytorch_model.safetensors
176
- `-- wav2vec/
177
- `-- wav2vec2-base-960h/
178
- |-- config.json
179
- |-- feature_extractor_config.json
180
- |-- model.safetensors
181
- |-- preprocessor_config.json
182
- |-- special_tokens_map.json
183
- |-- tokenizer_config.json
184
- `-- vocab.json
185
- ```
186
-
187
- ### 🛠️ Prepare Inference Data
188
-
189
- Hallo has a few simple requirements for input data:
190
-
191
- For the source image:
192
-
193
- 1. It should be cropped into squares.
194
- 2. The face should be the main focus, making up 50%-70% of the image.
195
- 3. The face should be facing forward, with a rotation angle of less than 30° (no side profiles).
196
-
197
- For the driving audio:
198
-
199
- 1. It must be in WAV format.
200
- 2. It must be in English since our training datasets are only in this language.
201
- 3. Ensure the vocals are clear; background music is acceptable.
202
-
203
- We have provided [some samples](examples/) for your reference.
204
-
205
- ### 🎮 Run Inference
206
-
207
- Simply to run the `scripts/inference.py` and pass `source_image` and `driving_audio` as input:
208
-
209
- ```bash
210
- python scripts/inference.py --source_image examples/reference_images/1.jpg --driving_audio examples/driving_audios/1.wav
211
- ```
212
-
213
- Animation results will be saved as `${PROJECT_ROOT}/.cache/output.mp4` by default. You can pass `--output` to specify the output file name. You can find more examples for inference at [examples folder](https://github.com/fudan-generative-vision/hallo/tree/main/examples).
214
-
215
- For more options:
216
-
217
- ```shell
218
- usage: inference.py [-h] [-c CONFIG] [--source_image SOURCE_IMAGE] [--driving_audio DRIVING_AUDIO] [--output OUTPUT] [--pose_weight POSE_WEIGHT]
219
- [--face_weight FACE_WEIGHT] [--lip_weight LIP_WEIGHT] [--face_expand_ratio FACE_EXPAND_RATIO]
220
-
221
- options:
222
- -h, --help show this help message and exit
223
- -c CONFIG, --config CONFIG
224
- --source_image SOURCE_IMAGE
225
- source image
226
- --driving_audio DRIVING_AUDIO
227
- driving audio
228
- --output OUTPUT output video file name
229
- --pose_weight POSE_WEIGHT
230
- weight of pose
231
- --face_weight FACE_WEIGHT
232
- weight of face
233
- --lip_weight LIP_WEIGHT
234
- weight of lip
235
- --face_expand_ratio FACE_EXPAND_RATIO
236
- face region
237
- ```
238
-
239
- ## Training
240
-
241
- ### Prepare Data for Training
242
-
243
- The training data, which utilizes some talking-face videos similar to the source images used for inference, also needs to meet the following requirements:
244
-
245
- 1. It should be cropped into squares.
246
- 2. The face should be the main focus, making up 50%-70% of the image.
247
- 3. The face should be facing forward, with a rotation angle of less than 30° (no side profiles).
248
-
249
- Organize your raw videos into the following directory structure:
250
-
251
-
252
- ```text
253
- dataset_name/
254
- |-- videos/
255
- | |-- 0001.mp4
256
- | |-- 0002.mp4
257
- | |-- 0003.mp4
258
- | `-- 0004.mp4
259
- ```
260
-
261
- You can use any `dataset_name`, but ensure the `videos` directory is named as shown above.
262
-
263
- Next, process the videos with the following commands:
264
-
265
- ```bash
266
- python -m scripts.data_preprocess --input_dir dataset_name/videos --step 1
267
- python -m scripts.data_preprocess --input_dir dataset_name/videos --step 2
268
- ```
269
-
270
- **Note:** Execute steps 1 and 2 sequentially as they perform different tasks. Step 1 converts videos into frames, extracts audio from each video, and generates the necessary masks. Step 2 generates face embeddings using InsightFace and audio embeddings using Wav2Vec, and requires a GPU. For parallel processing, use the `-p` and `-r` arguments. The `-p` argument specifies the total number of instances to launch, dividing the data into `p` parts. The `-r` argument specifies which part the current process should handle. You need to manually launch multiple instances with different values for `-r`.
271
-
272
- Generate the metadata JSON files with the following commands:
273
-
274
- ```bash
275
- python scripts/extract_meta_info_stage1.py -r path/to/dataset -n dataset_name
276
- python scripts/extract_meta_info_stage2.py -r path/to/dataset -n dataset_name
277
- ```
278
-
279
- Replace `path/to/dataset` with the path to the parent directory of `videos`, such as `dataset_name` in the example above. This will generate `dataset_name_stage1.json` and `dataset_name_stage2.json` in the `./data` directory.
280
-
281
- ### Training
282
-
283
- Update the data meta path settings in the configuration YAML files, `configs/train/stage1.yaml` and `configs/train/stage2.yaml`:
284
-
285
-
286
- ```yaml
287
- #stage1.yaml
288
- data:
289
- meta_paths:
290
- - ./data/dataset_name_stage1.json
291
-
292
- #stage2.yaml
293
- data:
294
- meta_paths:
295
- - ./data/dataset_name_stage2.json
296
- ```
297
-
298
- Start training with the following command:
299
-
300
- ```shell
301
- accelerate launch -m \
302
- --config_file accelerate_config.yaml \
303
- --machine_rank 0 \
304
- --main_process_ip 0.0.0.0 \
305
- --main_process_port 20055 \
306
- --num_machines 1 \
307
- --num_processes 8 \
308
- scripts.train_stage1 --config ./configs/train/stage1.yaml
309
- ```
310
-
311
- #### Accelerate Usage Explanation
312
-
313
- The `accelerate launch` command is used to start the training process with distributed settings.
314
-
315
- ```shell
316
- accelerate launch [arguments] {training_script} --{training_script-argument-1} --{training_script-argument-2} ...
317
- ```
318
-
319
- **Arguments for Accelerate:**
320
-
321
- - `-m, --module`: Interpret the launch script as a Python module.
322
- - `--config_file`: Configuration file for Hugging Face Accelerate.
323
- - `--machine_rank`: Rank of the current machine in a multi-node setup.
324
- - `--main_process_ip`: IP address of the master node.
325
- - `--main_process_port`: Port of the master node.
326
- - `--num_machines`: Total number of nodes participating in the training.
327
- - `--num_processes`: Total number of processes for training, matching the total number of GPUs across all machines.
328
-
329
- **Arguments for Training:**
330
-
331
- - `{training_script}`: The training script, such as `scripts.train_stage1` or `scripts.train_stage2`.
332
- - `--{training_script-argument-1}`: Arguments specific to the training script. Our training scripts accept one argument, `--config`, to specify the training configuration file.
333
-
334
- For multi-node training, you need to manually run the command with different `machine_rank` on each node separately.
335
-
336
- For more settings, refer to the [Accelerate documentation](https://huggingface.co/docs/accelerate/en/index).
337
-
338
- ## 📅️ Roadmap
339
-
340
- | Status | Milestone | ETA |
341
- | :----: | :---------------------------------------------------------------------------------------------------- | :--------: |
342
- | ✅ | **[Inference source code meet everyone on GitHub](https://github.com/fudan-generative-vision/hallo)** | 2024-06-15 |
343
- | ✅ | **[Pretrained models on Huggingface](https://huggingface.co/fudan-generative-ai/hallo)** | 2024-06-15 |
344
- | ✅ | **[Releasing data preparation and training scripts](#training)** | 2024-06-28 |
345
- | 🚀 | **[Improving the model's performance on Mandarin Chinese]()** | TBD |
346
-
347
- <details>
348
- <summary>Other Enhancements</summary>
349
-
350
- - [x] Enhancement: Test and ensure compatibility with Windows operating system. [#39](https://github.com/fudan-generative-vision/hallo/issues/39)
351
- - [x] Bug: Output video may lose several frames. [#41](https://github.com/fudan-generative-vision/hallo/issues/41)
352
- - [ ] Bug: Sound volume affecting inference results (audio normalization).
353
- - [ ] ~~Enhancement: Inference code logic optimization~~. This solution doesn't show significant performance improvements. Trying other approaches.
354
-
355
- </details>
356
-
357
-
358
- ## 📝 Citation
359
-
360
- If you find our work useful for your research, please consider citing the paper:
361
-
362
- ```
363
- @misc{xu2024hallo,
364
- title={Hallo: Hierarchical Audio-Driven Visual Synthesis for Portrait Image Animation},
365
- author={Mingwang Xu and Hui Li and Qingkun Su and Hanlin Shang and Liwei Zhang and Ce Liu and Jingdong Wang and Yao Yao and Siyu zhu},
366
- year={2024},
367
- eprint={2406.08801},
368
- archivePrefix={arXiv},
369
- primaryClass={cs.CV}
370
- }
371
- ```
372
-
373
- ## 🌟 Opportunities Available
374
-
375
- Multiple research positions are open at the **Generative Vision Lab, Fudan University**! Include:
376
-
377
- - Research assistant
378
- - Postdoctoral researcher
379
- - PhD candidate
380
- - Master students
381
-
382
- Interested individuals are encouraged to contact us at [[email protected]](mailto://[email protected]) for further information.
383
-
384
- ## ⚠️ Social Risks and Mitigations
385
-
386
- The development of portrait image animation technologies driven by audio inputs poses social risks, such as the ethical implications of creating realistic portraits that could be misused for deepfakes. To mitigate these risks, it is crucial to establish ethical guidelines and responsible use practices. Privacy and consent concerns also arise from using individuals' images and voices. Addressing these involves transparent data usage policies, informed consent, and safeguarding privacy rights. By addressing these risks and implementing mitigations, the research aims to ensure the responsible and ethical development of this technology.
387
-
388
- ## 🤗 Acknowledgements
389
-
390
- We would like to thank the contributors to the [magic-animate](https://github.com/magic-research/magic-animate), [AnimateDiff](https://github.com/guoyww/AnimateDiff), [ultimatevocalremovergui](https://github.com/Anjok07/ultimatevocalremovergui), [AniPortrait](https://github.com/Zejun-Yang/AniPortrait) and [Moore-AnimateAnyone](https://github.com/MooreThreads/Moore-AnimateAnyone) repositories, for their open research and exploration.
391
-
392
- If we missed any open-source projects or related articles, we would like to complement the acknowledgement of this specific work immediately.
393
-
394
- ## 👏 Community Contributors
395
-
396
- Thank you to all the contributors who have helped to make this project better!
397
-
398
- <a href="https://github.com/fudan-generative-vision/hallo/graphs/contributors">
399
- <img src="https://contrib.rocks/image?repo=fudan-generative-vision/hallo" />
400
- </a>
 
1
+ title: aiavatar2
2
+ emoji: 👀
3
+ colorFrom: pink
4
+ colorTo: indigo
5
+ sdk: docker
6
+ pinned: false