Add the audio encoder (wav2vec2 + projection, variable length) fp16/fp32; update card
Browse filesFiles changed (3)
- README.md+5-1
- audio_encoder_fp16.onnxAdded+3
- audio_encoder_fp32.onnxAdded+3
23 unmodified lines242526272829293031323312 unmodified lines46474849505152535423 unmodified lines| `encoder_fp16.onnx` / `encoder_fp32.onnx` | portrait (1×3×512×512, values in [-1,1]) → identity style `x_r` (512) + 7 feature maps; run once per portrait | 44 / 87 MB || `decoder_fp16.onnx` / `decoder_fp32.onnx` | style `wa` (512) + the 7 feature maps → one 512×512 frame; run per frame (batch 1) | 49 / 94 MB || `flow_step_fp16.onnx` / `flow_step_fp32.onnx` | one pass of the 8-layer speech-to-motion transformer with KV cache (2 guidance branches × 12 tokens); inputs `x, c, wr, freqs, ada, fada` + per-layer caches `sk/sv/ck/cv`, output `y`. For timing now; the sampler around it is not published yet | 272 / 544 MB || `audio_encoder_fp16.onnx` / `audio_encoder_fp32.onnx` | raw 16 kHz PCM `wav` [1, n·640] (no normalisation, whole video frames) → audio features `wa` [1, n, 512] at 25 fps: wav2vec2-base-960h with its CNN features interpolated to 25 fps before the transformer, all 12 layers' outputs stacked and projected (the original `AudioEncoder.inference`). Variable length | 198 / 397 MB || `motion_basis_512x20.f32` | the 512×20 orthonormal motion basis (float32, row-major): `wa = x_r + basis @ lambda` for a 20-number motion vector `lambda` | 41 KB |
Not included: wav2vec2, the sampler/timestep/audio-conditioning pieces around the flow step, and the voice/chat parts of the original pipeline.Not included: the sampler/timestep/audio-conditioning pieces around the flow step, and the voice/chat parts of the original pipeline.
## Conversion notes (what mattered)- The decoder's per-sample modulated convolution is rewritten as `conv(x · style) · demod` (the same algebra as `mlx_port/decoder_fast_torch.py` in [AvatarVoice](https://github.com/johnrobinsn/AvatarVoice)); the original grouped form does not export cleanly.12 unmodified lines| encoder fp32 ONNX vs original | max abs 1e-5 || flow step fp32 ONNX (ORT CPU) vs original PyTorch, real weights, 8 layers | max abs 2e-4 on outputs up to 12 || flow step fp32 on ORT-Web **WebGPU** (software adapter) vs ORT-Web CPU | max abs 7e-5, no CPU fallbacks || audio encoder fp32 ONNX (ORT CPU) vs PyTorch, two clip lengths | max abs 1.4e-5; the explicit layer loop equals the repo's own `Wav2VecModel` exactly || audio encoder fp32 on ORT-Web **WebGPU** (software adapter) vs PyTorch | max abs 7e-5, a second clip length on the same session matches CPU to 1e-4 || audio encoder fp16 ONNX vs fp32 | 0.1% mean relative error; finite for quiet (×0.05), normal and loud (×3) input || flow step fp16 ONNX (ORT CPU) vs fp32 original | mean relative error 0.46%, max abs 0.19 (single pass, random inputs). Not yet checked through the full 9-pass sampler, where rounding can compound |
Not verified here: speed or fp16 behaviour on a physical GPU (no GPU was available). The demo page measures that on the visitor's machine and falls back to fp32 automatically if fp16 is rejected.123version https://git-lfs.github.com/spec/v1oid sha256:63cb074cdf46909f9277b03d81b7fd45ef362e4ce7b84b7809964ec8642682f0size 198348031123version https://git-lfs.github.com/spec/v1oid sha256:1f3f523af32526c817f77ee9a666a00b748fddc90fbf2612f62d9d3cfafc41c8size 396532478README.md+5-1
audio_encoder_fp16.onnxAdded+3
audio_encoder_fp32.onnxAdded+3