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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div align="center">
|
| 2 |
+
|
| 3 |
+
# ComfyUI FLOAT Optimized
|
| 4 |
+
|
| 5 |
+
[](https://arxiv.org/abs/2412.01064)
|
| 6 |
+
[](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)
|
| 7 |
+
|
| 8 |
+
</div>
|
| 9 |
+
|
| 10 |
+
**Table of Contents**
|
| 11 |
+
1. 🚀 [Installation](#-installation)
|
| 12 |
+
2. ☀️ [Usage](#️-usage)
|
| 13 |
+
- [More examples](#more-examples)
|
| 14 |
+
3. 💾 [Manual Models Download](#-manual-models-download)
|
| 15 |
+
- [Simple](#simple)
|
| 16 |
+
- [Flexible](#flexible)
|
| 17 |
+
- [Very Advanced](#very-advanced)
|
| 18 |
+
4. 📚 [Nodes](#-nodes)
|
| 19 |
+
- [Load FLOAT Models (Opt)](#load-float-models-opt)
|
| 20 |
+
- [FLOAT Process (Opt)](#float-process-opt)
|
| 21 |
+
- [FLOAT Advanced Options](#float-advanced-options)
|
| 22 |
+
5. 🐞 [Debugging](#-debugging)
|
| 23 |
+
6. 📜 [Project History](#-project-history)
|
| 24 |
+
7. 🔗 [Citation](#-citation-of-the-paper)
|
| 25 |
+
8. 👥 [Attributions](#-attributions)
|
| 26 |
+
9. ©️ [License](#️-license)
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
This project provides a ComfyUI wrapper of [FLOAT](https://github.com/deepbrainai-research/float) for Generative Motion Latent Flow Matching for Audio-driven Talking Portrait
|
| 30 |
+
|
| 31 |
+
The code was optimized to reduce VRAM usage and avoid temporal files.
|
| 32 |
+
|
| 33 |
+
If you don't know about FLOAT, want to understand more, and you don't want to read the paper, the following explanation might help you [Understanding FLOAT](doc/understanding_FLOAT.md)
|
| 34 |
+
|
| 35 |
+
> [!WARNING]
|
| 36 |
+
> **FLOAT is not for commercial use.**
|
| 37 |
+
> Please refer to the licensing terms for more details.
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
[](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_workflow.json)
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
## 🚀 Installation
|
| 44 |
+
|
| 45 |
+
```bash
|
| 46 |
+
git clone https://github.com/set-soft/ComfyUI-FLOAT_Optimized.git
|
| 47 |
+
cd ./ComfyUI-FLOAT_Optimized
|
| 48 |
+
pip install -r requirements.txt
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
Note:
|
| 52 |
+
- The code uses `torch` which is installed for ComfyUI, is part of its dependencies.
|
| 53 |
+
This dependency isn't listed to avoid messing with it, which delicated.
|
| 54 |
+
- I tested the nodes using an RTX3060 with 12 GB of VRAM and 32 GB of RAM, in addition I have 32 GB of swap (virtual RAM).
|
| 55 |
+
|
| 56 |
+
## ☀️ Usage
|
| 57 |
+
|
| 58 |
+
- Load [example workflow](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_workflow.json)<br>
|
| 59 |
+
Or you can use a version of the workflow that can download the example image and audio:
|
| 60 |
+
[quick example workflow](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_workflow_quick.json)
|
| 61 |
+
Note that this version needs some extra nodes.
|
| 62 |
+
- Upload driving image and audio, click queue.
|
| 63 |
+
You can get the image originally used from [here](https://raw.githubusercontent.com/deepbrainai-research/float/refs/heads/main/assets/sam_altman_512x512.jpg),
|
| 64 |
+
and the audio from [here](https://github.com/deepbrainai-research/float/raw/refs/heads/main/assets/aud-sample-vs-1.wav)
|
| 65 |
+
- Models are automatically downloaded to `/ComfyUI/models/float`.
|
| 66 |
+
But you can also download them manually.
|
| 67 |
+
|
| 68 |
+
> [!IMPORTANT]
|
| 69 |
+
> If models are automatically downloaded you'll see the workflow stopped at the "Load Float Models (Opt)" for a while.<br>
|
| 70 |
+
> The download progress will be displayed in the node and also in the console.<br>
|
| 71 |
+
> It will have to download 2.4 GB
|
| 72 |
+
|
| 73 |
+
### More examples
|
| 74 |
+
|
| 75 |
+
In addition to the [main example](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_workflow.json)
|
| 76 |
+
you can also try:
|
| 77 |
+
|
| 78 |
+
- [Quick](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_workflow_quick.json): A basic example that can download an image and audio example. The downloaded media is from the original paper.
|
| 79 |
+
- [Advanced](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_adv.json): This example uses the *advanced* nodes. They show the architecture better. But I recommend using the *very advanced* nodes.
|
| 80 |
+
- [Advanced (without comments)](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_adv_no_comments.json): This is the same as *Advanced* but without the notes.
|
| 81 |
+
- [Very Advanced](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_very_advanced.json): This example uses the *very advanced* nodes. You can play with the inner details using it. I should also use less VRAM.
|
| 82 |
+
- [Very Advanced (without comments)](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_very_advanced_no_comments.json): Same as *Very Advanced* but without the notes.
|
| 83 |
+
- [Very Advanced Subgraphs](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_very_advanced_subgraphs.json): This is a *very advanced* version that uses subgraphs, so it can be seen as simple as the basic workflow, but you can go one level down and see it as the *advanced* version, and you can go deep to the *very advanced* level.
|
| 84 |
+
- [Very Advanced Dynamic Emotion](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_va_dynamic_emo.json): An experimental workflow that uses the emotion as it changes during the audio clip, not just the emotion for the overall audio clip.
|
| 85 |
+
- [Very Advanced Insert](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_very_advanced_sub_insert.json): Very advanced version that reinserts the generated animation in the original image, uses subgraphs
|
| 86 |
+
- [Very Advanced Insert 2](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_very_advanced_sub_insert_2.json): Same as *Very Advanced Insert* but shows how to handle two faces.
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
### 💾 Manual models download
|
| 90 |
+
|
| 91 |
+
Models are automatically downloaded, but you can also download them manually.
|
| 92 |
+
This is for advanced use, not usually needed.
|
| 93 |
+
There are two ways to do it.
|
| 94 |
+
|
| 95 |
+
#### Simple
|
| 96 |
+
|
| 97 |
+
Just download the unified [FLOAT model](https://huggingface.co/set-soft/float/resolve/main/FLOAT.safetensors?download=true)
|
| 98 |
+
to a folder named `models/float` inside your ComfyUI installation.
|
| 99 |
+
|
| 100 |
+
This file (2.4 GiB) contains the weights for all the networks used by FLOAT.
|
| 101 |
+
|
| 102 |
+
#### Flexible
|
| 103 |
+
|
| 104 |
+
Three *models* are needed.
|
| 105 |
+
|
| 106 |
+
1. Wav2Vec 2.0
|
| 107 |
+
|
| 108 |
+
This is an audio encoder used as base for speech recognition. Was created by FaceBook AI.
|
| 109 |
+
You can download the files to a folder named `models/audio/wav2vec2-base-960h` inside your ComfyUI installation.
|
| 110 |
+
Note that you don't need to include *pytorch_model.bin* or *tf_model.h5*, you just need the JSON files and *model.safetensors*
|
| 111 |
+
- Repo: [HuggingFace repo](https://huggingface.co/facebook/wav2vec2-base-960h).
|
| 112 |
+
- License: [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/)
|
| 113 |
+
- Paper: https://huggingface.co/papers/2006.11477
|
| 114 |
+
|
| 115 |
+
2. Speech Emotion Recognition
|
| 116 |
+
|
| 117 |
+
This is what FLOAT uses to detect the emotion in the audio, uses Wav2Vec 2.0 as base.
|
| 118 |
+
Well, in fact is based on another net that uses Wav2Vec ([Base](https://huggingface.co/jonatasgrosman/wav2vec2-large-xlsr-53-english))
|
| 119 |
+
You can download the files to a folder named `models/audio/wav2vec-english-speech-emotion-recognition` inside your ComfyUI installation.
|
| 120 |
+
- Repo: [HuggingFace repo](https://huggingface.co/r-f/wav2vec-english-speech-emotion-recognition).
|
| 121 |
+
- License: [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/)
|
| 122 |
+
- Paper: doi 10.57967/hf/3569 (for the base speech recognition model)
|
| 123 |
+
|
| 124 |
+
3. FLOAT
|
| 125 |
+
|
| 126 |
+
This is the main model.
|
| 127 |
+
You can download the file to a folder named `models/float` inside your ComfyUI installation.
|
| 128 |
+
- Repo: [GitHub page](https://github.com/deepbrainai-research/float)
|
| 129 |
+
[download 1](https://drive.google.com/file/d/1rvWuM12cyvNvBQNCLmG4Fr2L1rpjQBF0/view?pli=1)
|
| 130 |
+
[download 2](https://huggingface.co/yuvraj108c/float/resolve/main/float.pth?download=true)
|
| 131 |
+
- License: [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)
|
| 132 |
+
|
| 133 |
+
#### Very Advanced
|
| 134 |
+
|
| 135 |
+
The current **VA** (Very Advanced) nodes can either download the components or extract them from
|
| 136 |
+
the unified 2.4 GB file.
|
| 137 |
+
|
| 138 |
+
But if you want to manually download them what the nodes needs is:
|
| 139 |
+
|
| 140 |
+
1. The Wav2Vec 2.0 and Speech Emotion Recognition models described before (models/audio)
|
| 141 |
+
2. The FLOAT individual parts found [here](https://huggingface.co/set-soft/float_advanced/tree/main)
|
| 142 |
+
Download the folders and copy them to `models/float` inside your ComfyUI installation.
|
| 143 |
+
|
| 144 |
+
These nodes are the most flexible and they enable using various options to fine-tune the FLOAT behavior.
|
| 145 |
+
Note that their input and outputs might change.
|
| 146 |
+
|
| 147 |
+
## 📚 Nodes
|
| 148 |
+
|
| 149 |
+
The nodes come in three flavors:
|
| 150 |
+
|
| 151 |
+
- Regular nodes: simple to use but no flexibility and needs more memory. Recommended for casual use.
|
| 152 |
+
- [Advanced nodes](doc/nodes_adv.md): uses the same model files as the regular nodes
|
| 153 |
+
- [Very advanced](doc/nodes_vadv.md): uses separated portions and provides flexibility. Recommended for investigating options.
|
| 154 |
+
|
| 155 |
+
### Load FLOAT Models (Opt)
|
| 156 |
+
|
| 157 |
+
- **model**: Shows the models in `models/float`. Currently you can choose between `FLOAT.safetensors` (unified) and `float.pth`
|
| 158 |
+
The default is `FLOAT.safetensors`, if the file isn't there it will be downloaded.
|
| 159 |
+
- **target_device**: Selects the inference device. Might be useful if you have more than one GPU.
|
| 160 |
+
- **cudnn_benchmark**: When enabled CUDA will try to find the best algorithm to run the inference steps.
|
| 161 |
+
The drawback is that this makes the first inference run very slow.
|
| 162 |
+
For this reason the default value is disabled. This is much better for RTX3060 systems.
|
| 163 |
+
If you find enabling it is better for your system please report it.
|
| 164 |
+
|
| 165 |
+
### FLOAT Process (Opt)
|
| 166 |
+
|
| 167 |
+
- **ref_image**: Image to apply the voice. Use a square image. The net was trained using 512x512 images,
|
| 168 |
+
so your image will be rescaled to this size. Use simple backgrounds for better results. Leave enough
|
| 169 |
+
space around the face to allow for head motion or just enable **face_align**.
|
| 170 |
+
- **ref_audio**: The voice to use. If this is a song try removing the music. The model can detect emotions,
|
| 171 |
+
but it was trained for english. The length of the generated video is the same of the audio. Longer audios
|
| 172 |
+
will need more memory.
|
| 173 |
+
- **float_pipe**: Connect the `Load Float Models (Opt)` node here.
|
| 174 |
+
- **fps**: Frames Per Second, 25 fps is fine, 30 will probably sync better with your screen. Higher FPSs
|
| 175 |
+
will need more memory.
|
| 176 |
+
- **emotion**: Can be used to shift the emotion of the reference image.
|
| 177 |
+
- **face_align**: When enabled the image will be processed to detect the face and ensure the space around
|
| 178 |
+
it is suitable for head motion. If disabled you must ensure it.
|
| 179 |
+
- **seed**: random seed for the generation, change it to get different videos.
|
| 180 |
+
- **control after generate**: added by ComfyUI to choose what to do after a generation. Use *fixed* to
|
| 181 |
+
keep the same **seed**, allowing repetitibility.
|
| 182 |
+
|
| 183 |
+
### FLOAT Advanced Options
|
| 184 |
+
|
| 185 |
+
- **r_cfg_scale**: Reference classifier-free guidance (vector field) scale.
|
| 186 |
+
Will just enable CFG process if different than 1.
|
| 187 |
+
- **attention_window**: Attention window size, e.g., if 1, attend frames of t-1, t, t+1 for frame t
|
| 188 |
+
- **audio_dropout_prob**: Dropout probability for audio
|
| 189 |
+
- **ref_dropout_prob**: Dropout probability for reference
|
| 190 |
+
- **emotion_dropout_prob**: Dropout probability for emotion
|
| 191 |
+
- **ode_atol**: Absolute tolerance for the Ordinary Differential Equation solver (ODE)
|
| 192 |
+
- **ode_rtol**: Relative tolerance for the ODE
|
| 193 |
+
- **nfe**: Number of Function Evaluations for the ODE
|
| 194 |
+
- **torchdiffeq_ode_method**: ODE method
|
| 195 |
+
- **face_margin**: Controls the space around the face. The network was trained using 1.6. Making it bigger
|
| 196 |
+
you'll get more margin. Best results are achieved using 1.6, but sometimes this produces artifacts with
|
| 197 |
+
the hair, you can try to enlarge or reduce the margin a little.
|
| 198 |
+
- **rgba_conversion**: How to handle images with alpha channel. Three strategies:
|
| 199 |
+
1. **blend_with_color** will blend the image with the specified color
|
| 200 |
+
2. **discard_alpha** the alpha channel is just ignored
|
| 201 |
+
3. **replace_with_color** fully transparent pixels are replaced by the specified color
|
| 202 |
+
Nodes like *Inspyrenet Rembg* generate RGBA images, part of
|
| 203 |
+
[ComfyUI-Inspyrenet-Rembg](https://github.com/john-mnz/ComfyUI-Inspyrenet-Rembg)
|
| 204 |
+
- **bkg_color_hex**: Color used for the *rgba_conversion*. You can connect a *LayerUtility: ColorPicker* node
|
| 205 |
+
here, part of [ComfyUI-LayerStyle](https://github.com/chflame163/ComfyUI_LayerStyle).
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
## 🐞 Debugging
|
| 209 |
+
|
| 210 |
+
When you face problems you can ask these nodes to show more information.
|
| 211 |
+
|
| 212 |
+
- You can just run ComfyUI using `--verbose DEBUG`.
|
| 213 |
+
This will show extra information for *all* the ComfyUI operations
|
| 214 |
+
- If you just want extra information for these nodes you can define the `FLOAT_OPTIMIZED_NODES_DEBUG` environment variable to `1`.
|
| 215 |
+
This will show extra information related to FLOAT nodes.
|
| 216 |
+
- If you want even more information use `2` or `3` for the environment variable.
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
## 📜 Project History
|
| 220 |
+
|
| 221 |
+
- 1.0.0 2025-06-14: Initial release
|
| 222 |
+
- Optimized
|
| 223 |
+
- Advanced nodes
|
| 224 |
+
- Very advanced nodes
|
| 225 |
+
|
| 226 |
+
- 1.1.0 2025-07-03: Dynamic Emotion and fixes
|
| 227 |
+
- Fixed support for broken Transformers (default attn_implementation is incompatible)
|
| 228 |
+
- Fixed support for Apple Silicon Macs (#2)
|
| 229 |
+
- Added dynamic emotions handling (experimental)
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
## 🔗 Citation of the paper
|
| 233 |
+
|
| 234 |
+
```bibtex
|
| 235 |
+
@article{ki2024float,
|
| 236 |
+
title={FLOAT: Generative Motion Latent Flow Matching for Audio-driven Talking Portrait},
|
| 237 |
+
author={Ki, Taekyung and Min, Dongchan and Chae, Gyeongsu},
|
| 238 |
+
journal={arXiv preprint arXiv:2412.01064},
|
| 239 |
+
year={2024}
|
| 240 |
+
}
|
| 241 |
+
```
|
| 242 |
+
|
| 243 |
+
## 👥 Attributions
|
| 244 |
+
|
| 245 |
+
- **FLOAT: Generative Motion Latent Flow Matching for Audio-driven Talking Portrait** by
|
| 246 |
+
[Taekyung Ki](https://taekyungki.github.io), [Dongchan Min](https://kevinmin95.github.io), [Gyeongsu Chae](https://www.aistudios.com/ko)
|
| 247 |
+
[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)
|
| 248 |
+
- **Wav2Vec 2.0** by
|
| 249 |
+
Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael Auli from [FaceBook AI](https://ai.meta.com/)
|
| 250 |
+
[Apache 2.0](https://choosealicense.com/licenses/apache-2.0/)
|
| 251 |
+
- **Speech Emotion Recognition By Fine-Tuning Wav2Vec 2.0** by
|
| 252 |
+
[Rob Field](https://huggingface.co/r-f) et al.
|
| 253 |
+
[Apache 2.0](https://choosealicense.com/licenses/apache-2.0/)
|
| 254 |
+
- **Base FLOAT nodes for ComfyUI** by Yuvraj Seegolam [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)
|
| 255 |
+
- **Optimizations** by Salvador E. Tropea [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)
|
| 256 |
+
|
| 257 |
+
## ©️ License
|
| 258 |
+
|
| 259 |
+
[Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](https://creativecommons.org/licenses/by-nc-sa/4.0/)
|
| 260 |
+
---
|
| 261 |
+
license: apache-2.0
|
| 262 |
+
---
|
| 263 |
+
<div align="center">
|
| 264 |
+
|
| 265 |
+
# ComfyUI FLOAT Optimized
|
| 266 |
+
|
| 267 |
+
[](https://arxiv.org/abs/2412.01064)
|
| 268 |
+
[](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)
|
| 269 |
+
|
| 270 |
+
</div>
|
| 271 |
+
|
| 272 |
+
**Table of Contents**
|
| 273 |
+
1. 🚀 [Installation](#-installation)
|
| 274 |
+
2. ☀️ [Usage](#️-usage)
|
| 275 |
+
- [More examples](#more-examples)
|
| 276 |
+
3. 💾 [Manual Models Download](#-manual-models-download)
|
| 277 |
+
- [Simple](#simple)
|
| 278 |
+
- [Flexible](#flexible)
|
| 279 |
+
- [Very Advanced](#very-advanced)
|
| 280 |
+
4. 📚 [Nodes](#-nodes)
|
| 281 |
+
- [Load FLOAT Models (Opt)](#load-float-models-opt)
|
| 282 |
+
- [FLOAT Process (Opt)](#float-process-opt)
|
| 283 |
+
- [FLOAT Advanced Options](#float-advanced-options)
|
| 284 |
+
5. 🐞 [Debugging](#-debugging)
|
| 285 |
+
6. 📜 [Project History](#-project-history)
|
| 286 |
+
7. 🔗 [Citation](#-citation-of-the-paper)
|
| 287 |
+
8. 👥 [Attributions](#-attributions)
|
| 288 |
+
9. ©️ [License](#️-license)
|
| 289 |
+
---
|
| 290 |
+
|
| 291 |
+
This project provides a ComfyUI wrapper of [FLOAT](https://github.com/deepbrainai-research/float) for Generative Motion Latent Flow Matching for Audio-driven Talking Portrait
|
| 292 |
+
|
| 293 |
+
The code was optimized to reduce VRAM usage and avoid temporal files.
|
| 294 |
+
|
| 295 |
+
If you don't know about FLOAT, want to understand more, and you don't want to read the paper, the following explanation might help you [Understanding FLOAT](doc/understanding_FLOAT.md)
|
| 296 |
+
|
| 297 |
+
> [!WARNING]
|
| 298 |
+
> **FLOAT is not for commercial use.**
|
| 299 |
+
> Please refer to the licensing terms for more details.
|
| 300 |
+
|
| 301 |
+
|
| 302 |
+
[](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_workflow.json)
|
| 303 |
+
|
| 304 |
+
|
| 305 |
+
## 🚀 Installation
|
| 306 |
+
|
| 307 |
+
```bash
|
| 308 |
+
git clone https://github.com/set-soft/ComfyUI-FLOAT_Optimized.git
|
| 309 |
+
cd ./ComfyUI-FLOAT_Optimized
|
| 310 |
+
pip install -r requirements.txt
|
| 311 |
+
```
|
| 312 |
+
|
| 313 |
+
Note:
|
| 314 |
+
- The code uses `torch` which is installed for ComfyUI, is part of its dependencies.
|
| 315 |
+
This dependency isn't listed to avoid messing with it, which delicated.
|
| 316 |
+
- I tested the nodes using an RTX3060 with 12 GB of VRAM and 32 GB of RAM, in addition I have 32 GB of swap (virtual RAM).
|
| 317 |
+
|
| 318 |
+
## ☀️ Usage
|
| 319 |
+
|
| 320 |
+
- Load [example workflow](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_workflow.json)<br>
|
| 321 |
+
Or you can use a version of the workflow that can download the example image and audio:
|
| 322 |
+
[quick example workflow](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_workflow_quick.json)
|
| 323 |
+
Note that this version needs some extra nodes.
|
| 324 |
+
- Upload driving image and audio, click queue.
|
| 325 |
+
You can get the image originally used from [here](https://raw.githubusercontent.com/deepbrainai-research/float/refs/heads/main/assets/sam_altman_512x512.jpg),
|
| 326 |
+
and the audio from [here](https://github.com/deepbrainai-research/float/raw/refs/heads/main/assets/aud-sample-vs-1.wav)
|
| 327 |
+
- Models are automatically downloaded to `/ComfyUI/models/float`.
|
| 328 |
+
But you can also download them manually.
|
| 329 |
+
|
| 330 |
+
> [!IMPORTANT]
|
| 331 |
+
> If models are automatically downloaded you'll see the workflow stopped at the "Load Float Models (Opt)" for a while.<br>
|
| 332 |
+
> The download progress will be displayed in the node and also in the console.<br>
|
| 333 |
+
> It will have to download 2.4 GB
|
| 334 |
+
|
| 335 |
+
### More examples
|
| 336 |
+
|
| 337 |
+
In addition to the [main example](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_workflow.json)
|
| 338 |
+
you can also try:
|
| 339 |
+
|
| 340 |
+
- [Quick](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_workflow_quick.json): A basic example that can download an image and audio example. The downloaded media is from the original paper.
|
| 341 |
+
- [Advanced](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_adv.json): This example uses the *advanced* nodes. They show the architecture better. But I recommend using the *very advanced* nodes.
|
| 342 |
+
- [Advanced (without comments)](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_adv_no_comments.json): This is the same as *Advanced* but without the notes.
|
| 343 |
+
- [Very Advanced](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_very_advanced.json): This example uses the *very advanced* nodes. You can play with the inner details using it. I should also use less VRAM.
|
| 344 |
+
- [Very Advanced (without comments)](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_very_advanced_no_comments.json): Same as *Very Advanced* but without the notes.
|
| 345 |
+
- [Very Advanced Subgraphs](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_very_advanced_subgraphs.json): This is a *very advanced* version that uses subgraphs, so it can be seen as simple as the basic workflow, but you can go one level down and see it as the *advanced* version, and you can go deep to the *very advanced* level.
|
| 346 |
+
- [Very Advanced Dynamic Emotion](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_va_dynamic_emo.json): An experimental workflow that uses the emotion as it changes during the audio clip, not just the emotion for the overall audio clip.
|
| 347 |
+
- [Very Advanced Insert](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_very_advanced_sub_insert.json): Very advanced version that reinserts the generated animation in the original image, uses subgraphs
|
| 348 |
+
- [Very Advanced Insert 2](https://github.com/set-soft/ComfyUI-FLOAT_Optimized/raw/refs/heads/master/example_workflows/float_very_advanced_sub_insert_2.json): Same as *Very Advanced Insert* but shows how to handle two faces.
|
| 349 |
+
|
| 350 |
+
|
| 351 |
+
### 💾 Manual models download
|
| 352 |
+
|
| 353 |
+
Models are automatically downloaded, but you can also download them manually.
|
| 354 |
+
This is for advanced use, not usually needed.
|
| 355 |
+
There are two ways to do it.
|
| 356 |
+
|
| 357 |
+
#### Simple
|
| 358 |
+
|
| 359 |
+
Just download the unified [FLOAT model](https://huggingface.co/set-soft/float/resolve/main/FLOAT.safetensors?download=true)
|
| 360 |
+
to a folder named `models/float` inside your ComfyUI installation.
|
| 361 |
+
|
| 362 |
+
This file (2.4 GiB) contains the weights for all the networks used by FLOAT.
|
| 363 |
+
|
| 364 |
+
#### Flexible
|
| 365 |
+
|
| 366 |
+
Three *models* are needed.
|
| 367 |
+
|
| 368 |
+
1. Wav2Vec 2.0
|
| 369 |
+
|
| 370 |
+
This is an audio encoder used as base for speech recognition. Was created by FaceBook AI.
|
| 371 |
+
You can download the files to a folder named `models/audio/wav2vec2-base-960h` inside your ComfyUI installation.
|
| 372 |
+
Note that you don't need to include *pytorch_model.bin* or *tf_model.h5*, you just need the JSON files and *model.safetensors*
|
| 373 |
+
- Repo: [HuggingFace repo](https://huggingface.co/facebook/wav2vec2-base-960h).
|
| 374 |
+
- License: [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/)
|
| 375 |
+
- Paper: https://huggingface.co/papers/2006.11477
|
| 376 |
+
|
| 377 |
+
2. Speech Emotion Recognition
|
| 378 |
+
|
| 379 |
+
This is what FLOAT uses to detect the emotion in the audio, uses Wav2Vec 2.0 as base.
|
| 380 |
+
Well, in fact is based on another net that uses Wav2Vec ([Base](https://huggingface.co/jonatasgrosman/wav2vec2-large-xlsr-53-english))
|
| 381 |
+
You can download the files to a folder named `models/audio/wav2vec-english-speech-emotion-recognition` inside your ComfyUI installation.
|
| 382 |
+
- Repo: [HuggingFace repo](https://huggingface.co/r-f/wav2vec-english-speech-emotion-recognition).
|
| 383 |
+
- License: [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/)
|
| 384 |
+
- Paper: doi 10.57967/hf/3569 (for the base speech recognition model)
|
| 385 |
+
|
| 386 |
+
3. FLOAT
|
| 387 |
+
|
| 388 |
+
This is the main model.
|
| 389 |
+
You can download the file to a folder named `models/float` inside your ComfyUI installation.
|
| 390 |
+
- Repo: [GitHub page](https://github.com/deepbrainai-research/float)
|
| 391 |
+
[download 1](https://drive.google.com/file/d/1rvWuM12cyvNvBQNCLmG4Fr2L1rpjQBF0/view?pli=1)
|
| 392 |
+
[download 2](https://huggingface.co/yuvraj108c/float/resolve/main/float.pth?download=true)
|
| 393 |
+
- License: [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)
|
| 394 |
+
|
| 395 |
+
#### Very Advanced
|
| 396 |
+
|
| 397 |
+
The current **VA** (Very Advanced) nodes can either download the components or extract them from
|
| 398 |
+
the unified 2.4 GB file.
|
| 399 |
+
|
| 400 |
+
But if you want to manually download them what the nodes needs is:
|
| 401 |
+
|
| 402 |
+
1. The Wav2Vec 2.0 and Speech Emotion Recognition models described before (models/audio)
|
| 403 |
+
2. The FLOAT individual parts found [here](https://huggingface.co/set-soft/float_advanced/tree/main)
|
| 404 |
+
Download the folders and copy them to `models/float` inside your ComfyUI installation.
|
| 405 |
+
|
| 406 |
+
These nodes are the most flexible and they enable using various options to fine-tune the FLOAT behavior.
|
| 407 |
+
Note that their input and outputs might change.
|
| 408 |
+
|
| 409 |
+
## 📚 Nodes
|
| 410 |
+
|
| 411 |
+
The nodes come in three flavors:
|
| 412 |
+
|
| 413 |
+
- Regular nodes: simple to use but no flexibility and needs more memory. Recommended for casual use.
|
| 414 |
+
- [Advanced nodes](doc/nodes_adv.md): uses the same model files as the regular nodes
|
| 415 |
+
- [Very advanced](doc/nodes_vadv.md): uses separated portions and provides flexibility. Recommended for investigating options.
|
| 416 |
+
|
| 417 |
+
### Load FLOAT Models (Opt)
|
| 418 |
+
|
| 419 |
+
- **model**: Shows the models in `models/float`. Currently you can choose between `FLOAT.safetensors` (unified) and `float.pth`
|
| 420 |
+
The default is `FLOAT.safetensors`, if the file isn't there it will be downloaded.
|
| 421 |
+
- **target_device**: Selects the inference device. Might be useful if you have more than one GPU.
|
| 422 |
+
- **cudnn_benchmark**: When enabled CUDA will try to find the best algorithm to run the inference steps.
|
| 423 |
+
The drawback is that this makes the first inference run very slow.
|
| 424 |
+
For this reason the default value is disabled. This is much better for RTX3060 systems.
|
| 425 |
+
If you find enabling it is better for your system please report it.
|
| 426 |
+
|
| 427 |
+
### FLOAT Process (Opt)
|
| 428 |
+
|
| 429 |
+
- **ref_image**: Image to apply the voice. Use a square image. The net was trained using 512x512 images,
|
| 430 |
+
so your image will be rescaled to this size. Use simple backgrounds for better results. Leave enough
|
| 431 |
+
space around the face to allow for head motion or just enable **face_align**.
|
| 432 |
+
- **ref_audio**: The voice to use. If this is a song try removing the music. The model can detect emotions,
|
| 433 |
+
but it was trained for english. The length of the generated video is the same of the audio. Longer audios
|
| 434 |
+
will need more memory.
|
| 435 |
+
- **float_pipe**: Connect the `Load Float Models (Opt)` node here.
|
| 436 |
+
- **fps**: Frames Per Second, 25 fps is fine, 30 will probably sync better with your screen. Higher FPSs
|
| 437 |
+
will need more memory.
|
| 438 |
+
- **emotion**: Can be used to shift the emotion of the reference image.
|
| 439 |
+
- **face_align**: When enabled the image will be processed to detect the face and ensure the space around
|
| 440 |
+
it is suitable for head motion. If disabled you must ensure it.
|
| 441 |
+
- **seed**: random seed for the generation, change it to get different videos.
|
| 442 |
+
- **control after generate**: added by ComfyUI to choose what to do after a generation. Use *fixed* to
|
| 443 |
+
keep the same **seed**, allowing repetitibility.
|
| 444 |
+
|
| 445 |
+
### FLOAT Advanced Options
|
| 446 |
+
|
| 447 |
+
- **r_cfg_scale**: Reference classifier-free guidance (vector field) scale.
|
| 448 |
+
Will just enable CFG process if different than 1.
|
| 449 |
+
- **attention_window**: Attention window size, e.g., if 1, attend frames of t-1, t, t+1 for frame t
|
| 450 |
+
- **audio_dropout_prob**: Dropout probability for audio
|
| 451 |
+
- **ref_dropout_prob**: Dropout probability for reference
|
| 452 |
+
- **emotion_dropout_prob**: Dropout probability for emotion
|
| 453 |
+
- **ode_atol**: Absolute tolerance for the Ordinary Differential Equation solver (ODE)
|
| 454 |
+
- **ode_rtol**: Relative tolerance for the ODE
|
| 455 |
+
- **nfe**: Number of Function Evaluations for the ODE
|
| 456 |
+
- **torchdiffeq_ode_method**: ODE method
|
| 457 |
+
- **face_margin**: Controls the space around the face. The network was trained using 1.6. Making it bigger
|
| 458 |
+
you'll get more margin. Best results are achieved using 1.6, but sometimes this produces artifacts with
|
| 459 |
+
the hair, you can try to enlarge or reduce the margin a little.
|
| 460 |
+
- **rgba_conversion**: How to handle images with alpha channel. Three strategies:
|
| 461 |
+
1. **blend_with_color** will blend the image with the specified color
|
| 462 |
+
2. **discard_alpha** the alpha channel is just ignored
|
| 463 |
+
3. **replace_with_color** fully transparent pixels are replaced by the specified color
|
| 464 |
+
Nodes like *Inspyrenet Rembg* generate RGBA images, part of
|
| 465 |
+
[ComfyUI-Inspyrenet-Rembg](https://github.com/john-mnz/ComfyUI-Inspyrenet-Rembg)
|
| 466 |
+
- **bkg_color_hex**: Color used for the *rgba_conversion*. You can connect a *LayerUtility: ColorPicker* node
|
| 467 |
+
here, part of [ComfyUI-LayerStyle](https://github.com/chflame163/ComfyUI_LayerStyle).
|
| 468 |
+
|
| 469 |
+
|
| 470 |
+
## 🐞 Debugging
|
| 471 |
+
|
| 472 |
+
When you face problems you can ask these nodes to show more information.
|
| 473 |
+
|
| 474 |
+
- You can just run ComfyUI using `--verbose DEBUG`.
|
| 475 |
+
This will show extra information for *all* the ComfyUI operations
|
| 476 |
+
- If you just want extra information for these nodes you can define the `FLOAT_OPTIMIZED_NODES_DEBUG` environment variable to `1`.
|
| 477 |
+
This will show extra information related to FLOAT nodes.
|
| 478 |
+
- If you want even more information use `2` or `3` for the environment variable.
|
| 479 |
+
|
| 480 |
+
|
| 481 |
+
## 📜 Project History
|
| 482 |
+
|
| 483 |
+
- 1.0.0 2025-06-14: Initial release
|
| 484 |
+
- Optimized
|
| 485 |
+
- Advanced nodes
|
| 486 |
+
- Very advanced nodes
|
| 487 |
+
|
| 488 |
+
- 1.1.0 2025-07-03: Dynamic Emotion and fixes
|
| 489 |
+
- Fixed support for broken Transformers (default attn_implementation is incompatible)
|
| 490 |
+
- Fixed support for Apple Silicon Macs (#2)
|
| 491 |
+
- Added dynamic emotions handling (experimental)
|
| 492 |
+
|
| 493 |
+
|
| 494 |
+
## 🔗 Citation of the paper
|
| 495 |
+
|
| 496 |
+
```bibtex
|
| 497 |
+
@article{ki2024float,
|
| 498 |
+
title={FLOAT: Generative Motion Latent Flow Matching for Audio-driven Talking Portrait},
|
| 499 |
+
author={Ki, Taekyung and Min, Dongchan and Chae, Gyeongsu},
|
| 500 |
+
journal={arXiv preprint arXiv:2412.01064},
|
| 501 |
+
year={2024}
|
| 502 |
+
}
|
| 503 |
+
```
|
| 504 |
+
|
| 505 |
+
## 👥 Attributions
|
| 506 |
+
|
| 507 |
+
- **FLOAT: Generative Motion Latent Flow Matching for Audio-driven Talking Portrait** by
|
| 508 |
+
[Taekyung Ki](https://taekyungki.github.io), [Dongchan Min](https://kevinmin95.github.io), [Gyeongsu Chae](https://www.aistudios.com/ko)
|
| 509 |
+
[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)
|
| 510 |
+
- **Wav2Vec 2.0** by
|
| 511 |
+
Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael Auli from [FaceBook AI](https://ai.meta.com/)
|
| 512 |
+
[Apache 2.0](https://choosealicense.com/licenses/apache-2.0/)
|
| 513 |
+
- **Speech Emotion Recognition By Fine-Tuning Wav2Vec 2.0** by
|
| 514 |
+
[Rob Field](https://huggingface.co/r-f) et al.
|
| 515 |
+
[Apache 2.0](https://choosealicense.com/licenses/apache-2.0/)
|
| 516 |
+
- **Base FLOAT nodes for ComfyUI** by Yuvraj Seegolam [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)
|
| 517 |
+
- **Optimizations** by Salvador E. Tropea [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)
|
| 518 |
+
|
| 519 |
+
## ©️ License
|
| 520 |
+
|
| 521 |
+
[Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](https://creativecommons.org/licenses/by-nc-sa/4.0/)
|