Skip to content

Align CUDA reference-encoder precision for Fish Audio and Drama 3 - #937

Merged
0xShug0 merged 1 commit into
mainfrom
fix/fish-codec-cuda-bf16-encoder
Oct 16, 2026
Merged

0xShug0 merged 1 commit into
mainfrom
fix/fish-codec-cuda-bf16-encoder

Conversation

@0xShug0

@0xShug0 0xShug0 commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

Add optional CUDA BF16 reference-encoder arithmetic for Fish Audio and Drama 3:

  • fish_audio.codec_encoder_bf16_compute
  • fish_drama3.codec_encoder_bf16_compute

Fish Audio defaults to false. Drama 3 defaults to true on its model-local configuration; the mode only applies on CUDA with F16/BF16 codec weights. Set fish_drama3.codec_encoder_bf16_compute=false to restore its previous encoder arithmetic. This intentionally changes Drama 3 reference-conditioned generation. The generic framework default remains false. Align encoder convolution, Snake, transformer and RVQ rounding with the Python codec. Decoder behavior is unchanged. Extend existing Conv1d with an opt-in BF16 path and CUDA im2col with BF16 output dispatch; existing F32/F16 paths remain unchanged. Update specs, help and model documentation, including standalone legacy-contract handling.

Follow-up to #936 / #935; this does not replace the merged CPU layout fix.

Codec parity

Codec-only roundtrips against the native Python reference, not end-to-end TTS:

Codec Code agreement before / after WAV SNR before / after WAV cosine before / after
Fish Audio 40.93% / 84.50% 8.06 / 14.29 dB 0.92258 / 0.98140
Drama 3 39.22% / 85.81% 8.46 / 15.25 dB 0.92879 / 0.98497

Controlled F32 tests using identical GGUF weights achieve 100% code agreement for both codecs. Native BF16 code IDs are not bit-identical to Python. Python cold/warm execution also varies; on the measured same-weight Fish case, common-decoder C++ versus warm-Python waveform drift is comparable to Python cold versus warm drift. This is not a claim of universally identical perceptual quality.

Performance

RTX 5090, Debug build, same approximately six-second reference WAV, sequential measurements. Off/on refers to the new option.

Codec Warm encode off / on Warm decode off / on Peak VRAM off / on
Fish Audio 27.33 / 27.22 ms 36.63 / 36.69 ms 2,644 / 2,676 MiB
Drama 3 30.47 / 28.96 ms 38.67 / 37.36 ms 2,610 / 2,688 MiB

These are codec timings, not end-to-end TTS RTF.

Validation and scope

  • Default-off code arrays and WAVs match the frozen baseline byte-for-byte for both codecs.
  • Decoding identical Python codes is unchanged with the option enabled.
  • Public voice-clone requests pass ASR with existing embedded GGUF contracts.
  • Explicit F16 codec storage tested; model spec system test passed.
  • No global precision overrides, shared attention changes, or new GGML operation.
  • Large graphs remain session-owned and reused.
  • New C++ configuration fields require rebuilding external binary consumers.
  • CUDA BF16 mode validated; no claim of new BF16-mode validation on other backends. Drama 3 now selects this previously tested mode by default; no additional runtime run was performed for the default-selection change.
  • Rebased cleanly onto current main; runtime measurements were collected before the rebase, not rerun afterward.

@0xShug0
0xShug0 force-pushed the fix/fish-codec-cuda-bf16-encoder branch from 82d2334 to 5ea78d0 Compare October 16, 2026 20:51
@0xShug0 0xShug0 changed the title Add opt-in CUDA BF16 reference encoding for Fish Audio and Drama 3 Align CUDA reference-encoder precision for Fish Audio and Drama 3 Oct 16, 2026
@0xShug0
0xShug0 merged commit 2d832de into main Oct 16, 2026
6 checks passed
@0xShug0
0xShug0 deleted the fix/fish-codec-cuda-bf16-encoder branch October 16, 2026 21:17
@0xShug0 0xShug0 added the ggml label Oct 16, 2026
5uck1ess added a commit to 5uck1ess/audio.cpp-fork that referenced this pull request Oct 17, 2026
cunba-ai pushed a commit to cunba-ai/audio.cpp that referenced this pull request Oct 28, 2026
…precision + WebUI voice listing + RKNN docs

Upstream commits 0fdc572..498d4ae (14):
- fix(build): gate family tests on the linked model set (0xShug0#925)
- f5_tts CPU passes inside graph pool ceiling; evicted graphs freed (0xShug0#924)
- Qwen3-TTS spec description trim; Inflect v2 ONNX prefix strip (0xShug0#933)
- CPU Fish DAC reference-encoder tensor layouts (0xShug0#936)
- Fish codec CUDA encoder precision aligned with Python (0xShug0#937)
- C++17 lambda capture fix in parallel server unload (0xShug0#939)
- fix(build): model unit tests compile their own family sources (0xShug0#932)
- fix(build): split compiled-in model specs into 16KB literals (0xShug0#934)
- webui: list/preview server voices (0xShug0#941,0xShug0#943); RKNN docs + IOVA ceiling (0xShug0#945,0xShug0#949)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant