Image-to-Video
TensorRT
ONNX
Safetensors
PyTorch
English
Arabic
audio-to-video
talking-head
portrait-animation
lip-sync
flow-matching
motion-generation
video-generation
wav2vec2
real-time
Instructions to use mohamedemam/float with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TensorRT
How to use mohamedemam/float with TensorRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
File size: 15,548 Bytes
f5f6741 4ece822 ac47f65 f5f6741 ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 69a132b ac47f65 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | ---
license: cc-by-nc-nd-4.0
language:
- en
- ar
pipeline_tag: image-to-video
tags:
- audio-to-video
- talking-head
- portrait-animation
- lip-sync
- flow-matching
- motion-generation
- video-generation
- wav2vec2
- pytorch
- real-time
- onnx
- tensorrt
---
# [ICCV 2025] FLOAT: Generative Motion Latent Flow Matching for Audio-driven Talking Portrait
Official PyTorch implementation of **FLOAT** β *Flow Matching for Audio-driven Talking Portrait Video Generation* β plus the
**pre-converted ONNX / TensorRT graphs** used by the [FLOAT Fast](https://github.com/mohamed-em2m/float-fast) serving stack.

**FLOAT: Generative Motion Latent Flow Matching for Audio-driven Talking Portrait**<br>
[Taekyung Ki](https://taekyungki.github.io), [Dongchan Min](https://kevinmin95.github.io), [Gyeongsu Chae](https://www.aistudios.com/ko)
Project page: [deepbrainai-research.github.io/float](https://deepbrainai-research.github.io/float/) Β· Serving stack: [github.com/mohamed-em2m/float-fast](https://github.com/mohamed-em2m/float-fast)
**Abstract**: *With the rapid advancement of diffusion-based generative models, portrait image animation has achieved remarkable results. However, it still faces challenges in temporally consistent video generation and fast sampling due to its iterative sampling nature. This paper presents FLOAT, an audio-driven talking portrait video generation method based on flow matching generative model. Instead of a pixel-based latent space, we take advantage of a learned orthogonal motion latent space, enabling efficient generation and editing of temporally consistent motion. To achieve this, we introduce a transformer-based vector field predictor with an effective frame-wise conditioning mechanism. Additionally, our method supports speech-driven emotion enhancement, enabling a natural incorporation of expressive motions. Extensive experiments demonstrate that our method outperforms state-of-the-art audio-driven talking portrait methods in terms of visual quality, motion fidelity, and efficiency.*
**TL;DR**: FLOAT is a flow-matching based audio-driven talking portrait video generation method, which can enhance the
speech-driven emotional motion.
---
## Repository layout
```
mohamedemam/float/
βββ float.pth # the main model checkpoint (827 MB)
βββ wav2vec2-base-960h/ # audio encoder (facebook/wav2vec2-base-960h)
βββ wav2vec-english-speech-emotion-recognition/ # emotion encoder (r-f/wav2vec-β¦-recognition)
βββ assets/ # figures used by this card
βββ onnx/ # pre-converted ONNX graphs (see below)
βββ fmt_step_v1.onnx 628 MB # FMT vector-field step (the ODE inner loop)
βββ emotion_v1.onnx 1.27 GB # speech-emotion classifier
βββ wav2vec_v1.onnx 380 MB # audio encoder + projection head
βββ decoder_v1.onnx 94 MB # frame decoder (StyleGAN-style synthesis)
βββ refenc_v1.onnx 91 MB # reference-image encoder
βββ direction_v1.onnx 42 KB # motion direction basis
βββ decoder_v1.onnx.no_trt # sidecar: the runtime must not use TensorRT here
βββ backends.generated.yaml # measured per-component backend plan
βββ .build_manifest.json # build provenance for the artifacts
```
## ONNX / TensorRT accelerated inference
The `onnx/` folder holds the **same six components**, exported to ONNX and ready to run on
TensorRT / CUDA / CPU. They are produced by
[`float-fast`](https://github.com/mohamed-em2m/float-fast)'s `scripts/convert_to_onnx.sh` and are
**drop-in replacements for the torch modules** β the ODE loop, the CFG combine and the chunk
autoregression stay in Python, only the hot inner steps move into the graph.
Every artifact is **gated before it is published**: the converter compares the exported graph against
the *deployed* torch model and refuses to pass a graph that does not reproduce it. Two rules make
that gate meaningful, and both are easy to get wrong:
- the reference is the **deployed** model, never the module that was traced;
- both sides run **the same computation** (fp32 on both sides β TF32 alone moves a 22-conv stack
by tens of uint8 levels, which would drown the graph's own error).
Measured for the graphs in this folder:
| artifact | provider | fidelity vs the torch model |
|---|---|---|
| `fmt_step_v1.onnx` | TensorRT FP16 | cosine 0.999996 (per ODE step) |
| `decoder_v1.onnx` | CUDA (fp32) | max 1 / mean 0.002 uint8 level on a 512Γ512 frame |
| `emotion_v1.onnx`, `wav2vec_v1.onnx`, `refenc_v1.onnx`, `direction_v1.onnx` | TensorRT FP16 | cosine β₯ 0.99999 |
`backends.generated.yaml` is the **measured** plan for the machine the conversion ran on (an
RTX A6000): `emotion`, `audio` and `fmt` on `onnx/trt`, `refenc` compiled, `direction` and
`decoder` eager. Re-run the selector on your own box to re-measure β the choices are per-GPU:
```bash
git clone https://github.com/mohamed-em2m/float-fast && cd float-fast
uv run --frozen --no-sync python -m fast_float.onnx.select_backends \
--onnx-dir ./onnx --out ./onnx/backends.generated.yaml --ckpt ./checkpoints/float.pth
```
Two things are deliberately **not** in this folder:
- **the TensorRT engine cache** β engines are tied to the GPU and the TensorRT/CUDA versions, so
the target box builds its own on first use (and caches them under `onnx/trt_cache/`);
- **a runtime config you can trust blindly** β see the selector above.
### Using the graphs with FLOAT Fast
```bash
# 1. fetch the checkpoints and the ONNX graphs
huggingface-cli download mohamedemam/float --include "onnx/*" --local-dir ./hf
huggingface-cli download mohamedemam/float --include "float.pth" --local-dir ./checkpoints
huggingface-cli download mohamedemam/float --include "wav2vec2-base-960h/*" --local-dir ./checkpoints
huggingface-cli download mohamedemam/float --include "wav2vec-english-speech-emotion-recognition/*" --local-dir ./checkpoints
cp -r hf/onnx ./onnx
# 2. build the environment (uv venv, deps, ONNX stack, TensorRT 10.9)
./scripts/setup.sh
# 3. re-measure the backends for this box, then serve
uv run --frozen --no-sync python -m fast_float.onnx.select_backends \
--onnx-dir ./onnx --out ./onnx/backends.generated.yaml --ckpt ./checkpoints/float.pth
./scripts/run_all.sh # backend :8000 + Studio frontend :3000
```
FLOAT Fast then serves the model over HTTP:
```bash
curl -X POST http://localhost:8000/generate \
-H 'Content-Type: application/json' \
-d '{"audio_base64": "'"$(base64 -w0 audio.wav)"'",
"audio_format": "wav",
"image_base64": "'"$(base64 -w0 portrait.jpg)"'"}'
```
It also streams the frames live over a WebSocket (`/ws/stream/{request_id}`) and over WebRTC
(`/offer`), so a browser can play the portrait while the MP4 is still being written.
---
## Generation Results
| Result 1 | Result 2 |
|-------------|-------------|
| <video src="https://github.com/user-attachments/assets/8c00274d-795d-4ee9-870f-84a859f3e23f"> </video> | <video src="https://github.com/user-attachments/assets/c6e142b3-519b-4cda-b26d-e088414b478d"> </video> |
| Result 3 | Result 4 |
|---|---|
| <video src="https://github.com/user-attachments/assets/7b201a5f-a293-46cd-974f-0612062d8d94"> </video> | <video src="https://github.com/user-attachments/assets/dd4b74dd-40b4-4864-b87d-7cbf4f0d66da"> </video> |
<br>
Our method runs faster than current diffusion-based methods with fewer sampling steps and lower memory cost. For more details, please refer to the paper.
<div align='center'>
<image width= 80% src="./assets/fps.png" alt="FLOAT inference speed"> </image>
</div>
## Updates
- [2026.10.21] π§© The `onnx/` folder now hosts the **pre-converted ONNX / TensorRT graphs** for the
FLOAT Fast serving stack (FMT step, emotion, audio, frame decoder, reference encoder, motion
direction), each gated against the torch model before publication.
- [2025.06.26] ππ FLOAT is accepted to **[ICCV 2025](https://iccv.thecvf.com)** ππ
- [2025.02.17] The inference code and checkpoints are released under a **[Non-commercial License](https://creativecommons.org/licenses/by-nc-nd/4.0/)**
- [2024.12.03] Selected as a [HuggingFace Daily Papers](https://huggingface.co/papers?date=2024-12-03) on December 3, 2024
- [2024.12.02] The paper is publicly available on [ArXiv](https://arxiv.org/abs/2412.01064)
---
## Getting started
### Requirements
```bash
# The original FLOAT environment
conda create -n FLOAT python=3.8.5
conda activate FLOAT
sh environments.sh
# or manual installation
pip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cu118
pip install -r requirements.txt
```
- Tested on Linux with A100 and V100 GPUs.
- The FLOAT Fast stack needs a newer stack (Python 3.10, PyTorch 2.7.1+cu126, ONNX Runtime 1.23,
optionally TensorRT 10.9).
### Preparing the checkpoints
1. Download the checkpoints β either from this repository:
```bash
huggingface-cli download mohamedemam/float --local-dir ./checkpoints
```
or from the original [Google Drive](https://drive.google.com/file/d/1rvWuM12cyvNvBQNCLmG4Fr2L1rpjQBF0/view?usp=sharing)
(the FLOAT Fast scripts do this automatically).
2. The checkpoints should be organised as follows:
```bash
./checkpoints
|-- checkpoints_here
|-- float.pth # main model
|-- wav2vec2-base-960h/ # audio encoder
| |-- config.json
| |-- feature_extractor_config.json
| |-- model.safetensors
| |-- preprocessor_config.json
| |-- pytorch_model.bin
| |-- special_tokens_map.json
| |-- tokenizer_config.json
| '-- vocab.json
'-- wav2vec-english-speech-emotion-recognition/ # emotion encoder
|-- config.json
|-- preprocessor_config.json
|-- pytorch_model.bin
'-- training_args.bin
```
- The W2V based models come from
[wav2vec2-base-960h](https://huggingface.co/facebook/wav2vec2-base-960h) and
[wav2vec-english-speech-emotion-recognition](https://huggingface.co/r-f/wav2vec-english-speech-emotion-recognition).
### Generating a talking portrait from a single image and audio
> [!IMPORTANT]
> For the best quality, please mind the pre-processing:
>
> - FLOAT is trained on frontal head pose distributions β a non-frontal image gives suboptimal results.
> - The performance of talking-portrait methods depends on their training-time pre-processing (e.g. field
> of view). The inference code includes automatic face cropping, which may introduce black **padding**
> regions; it can be disabled in `generate.py` at the cost of quality.
> - Heavy background music hurts the result β extract the vocals first with
> [ClearVoice](https://github.com/modelscope/ClearerVoice-Studio).
**1. Generating video 1 (emotion from audio)**
You can generate a video with an emotion derived from the audio without specifying `--emo`. Adjust the
intensity with `--e_cfg_scale` (default 1); for more emotion-intensive video try 5β10.
```bash
CUDA_VISIBLE_DEVICES=0 python generate.py \
--ref_path path/to/reference/image \
--aud_path path/to/audio \
--seed 15 \
--a_cfg_scale 2 \
--e_cfg_scale 1 \
--ckpt_path ./checkpoints/float.pth \
--no_crop # [optional] skip cropping
```
**2. Generating video 2 (redirecting the emotion)**
Pass `--emo` to pick one of the seven emotions:
`['angry', 'disgust', 'fear', 'happy', 'neutral', 'sad', 'surprise']`.
```bash
CUDA_VISIBLE_DEVICES=0 python generate.py \
--ref_path path/to/reference/image \
--aud_path path/to/audio \
--emo 'happy' \
--seed 15 \
--a_cfg_scale 2 \
--e_cfg_scale 1 \
--ckpt_path ./checkpoints/float.pth \
--no_crop
```
<video src="https://github.com/user-attachments/assets/fb3826cd-231b-46f2-809b-11adebe9a1cf"> </video>
**3. Running the example**
```bash
CUDA_VISIBLE_DEVICES=0 python generate.py \
--ref_path assets/sam_altman.webp \
--aud_path assets/aud-sample-vs-1.wav \
--seed 15 \
--a_cfg_scale 2 \
--e_cfg_scale 1 \
--ckpt_path ./checkpoints/float.pth
```
| Before Crop | After Crop | Result |
|-------------|-----------|--------|
|  |  | <video src='https://github.com/user-attachments/assets/3353e4e0-00f5-429b-bc66-5db9a72186b8'> </video> |
---
## Intended use and limitations
- **Research use only.** This work is licensed under
[CC BY-NC-ND 4.0](https://creativecommons.org/licenses/by-nc-nd/4.0/): no commercial use, and no
derivative works.
- The model is trained on **frontal** head poses and is driven by a single reference image and a
speech track; it does not handle large head rotations, multi-person scenes or non-speech audio.
- The emotion is either predicted from the audio or set explicitly to one of the seven basic emotions.
- The `onnx/` graphs are **community-produced** (by the FLOAT Fast project) and are provided as-is;
they are numerically validated against the torch model, but the upstream authors do not support them.
## β License β
This work is licensed under a
[Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License](https://creativecommons.org/licenses/by-nc-nd/4.0/).
You may not use this work for commercial purposes and may use it only for research purposes.
**For any commercial inquiries or collaboration opportunities**, please contact [daniel@deepbrain.io](mailto:daniel@deepbrain.io).
## Development
This repository is a research demonstration implementation and is provided as a one-time code drop.
For any research-related inquiries, please contact the first author [Taekyung Ki](https://github.com/TaekyungKi).
This work was done during the first author's South Korean Alternative Military Service at DeepBrain AI.
This repository includes only the inference code; the training code will not be released.
## Citation
```bibtex
@inproceedings{ki2025float,
title={Float: Generative motion latent flow matching for audio-driven talking portrait},
author={Ki, Taekyung and Min, Dongchan and Chae, Gyeongsu},
booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
pages={14699--14710},
year={2025}
}
```
## Related works
- [StyleLipSync: Style-based Personalized Lip-sync Video Generation](https://arxiv.org/abs/2305.00521)<br>
- [StyleTalker: One-shot Style-based Audio-driven Talking Head Video Generation](https://arxiv.org/abs/2208.10922)<br>
- [Export3D: Learning to Generate Conditional Tri-plane for 3D-aware Expression Controllable Portrait Animation](https://arxiv.org/abs/2404.00636)<br>
- [Latent Image Animator: Learning to Animate Images via Latent Space Navigation](https://arxiv.org/abs/2203.09043)<br>
## Acknowledgements
The source images and audio are collected from the internet and other baselines, such as LIA, SadTalker,
EMO, VASA-1, Hallo, LivePortrait, Loopy, and others. We appreciate their valuable contributions to this
field. We employ the Wav2Vec2.0-based speech emotion recognizer by
[Rob Field](https://huggingface.co/r-f/wav2vec-english-speech-emotion-recognition). We appreciate this
good work.
|