- Python 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Flash t3 Linears are llama-shaped: quantize them in place while KEEPING the bf16 load dtype (forcing fp32 nominal runs attention/norms at fp32 = 2x loss — first probe's bug). Honest fair interleave (D32): K6 0.84-1.00x -> 1.01-1.22x; K8 0.60-0.76x -> 0.76-0.78x — i.e. K8-int8 matches or beats K6-bf16, buying the higher-K artifact reduction at K6 pricing. Int8Linear/Int8Conv1D now expose a lazily-dequantized .weight property — chatterbox's T3.device reads speech_head.weight.device and crashed without it. _float_param_dtype helper replaces next(parameters()).dtype probes (never use an int8 param's dtype for conds casting). Also recorded: aten::mm is only ~20% of flash t3 wall (eager PMI/block loop + sdpa dominate) — consistent with the modest gain vs the 1.4x microbench. 35 tests in engine suite. |
||
| resonance_engine | ||
| scripts | ||
| tests | ||
| .gitignore | ||
| LICENSE | ||
| pyproject.toml | ||
| README.md | ||
resonance-engine
CPU-optimized inference engine for the Chatterbox family of voice-clone TTS models: nano / turbo / multilingual-v3 / flash.
Serves as the inference layer of
resonance (the OpenAI-compatible TTS
server): flash runs on it exclusively, and the other families can route
through it with --use-engine (same-seed bit-exact vs the chatterbox-tts
packages).
Phase 1 (this repo, current state): the inference orchestration lives here —
ported first-class from resonance's monkeypatch shims (AR sampling loop,
flow-ODE options, compile shims, precision handling) and vendored from
chatterbox-flash (MIT; torch
path only). Model classes (T3 / S3Gen / VE / tokenizers) still import from
chatterbox-tts — full independence is Phase 3.
Usage
from resonance_engine import Engine, EngineOptions, GenerationParams
eng = Engine.load("flash", "models/chatterbox-flash",
EngineOptions(precision="bf16", flash_block_size=32))
conds = eng.prepare_conditionals("reference.wav", exaggeration=0.5)
wav = eng.generate("Hello world.", conds) # float32 np.ndarray @ 24 kHz
Families and their knobs (EngineOptions / GenerationParams):
| family | notes |
|---|---|
nano / turbo |
package adapters; temperature/top_p/top_k/repetition_penalty; int8/bf16/compile t3 opts |
multilingual |
v3 checkpoint + our AR loop; int8/bf16/compile/s3gen-/flow- opts; language_id |
flash |
block-diffusion (vendored); bf16 t3; block size D, K steps, paper sampling defaults; EOS-miss tail trim |
t3 int8 (EngineOptions(t3_int8=True))
Row-wise symmetric int8 weights + per-row input quant, executed on
torch._int_mm (native CPU int8 GEMM, VNNI) and fused into the torch.compile
graph — replaces the bf16 tier. Works for the Linear-backed (multilingual
llama, flash) and Conv1D-backed (nano/turbo GPT2) backbones alike.
Measured (7640HS, fair interleaved): multilingual t3_int8+compile ≈ 0.53×
vs bf16+compile 0.41× realtime (1.29×); turbo ≈ 0.91× vs 0.60× (1.51×);
flash +15–20% — enough that K8-int8 matches/beats K6-bf16 (0.76–0.78× vs
0.84–1.0×), buying the higher-K artifact reduction at K6 pricing.
Quality tier (fixed-input logits vs fp32): top-1 agreement 100%, mean |Δlogit|
0.07–0.10 vs bf16's 0.036–0.04 anchor — ear-gated, same tier family as the
s3gen int8 option.
Ops notes
- One
Engineper process. A family stack costs 1–4.5 GB RSS; two mtl stacks + two flash stacks in one process will OOM-stunlock a 16 GB laptop (learned the hard way). Parity/benchmark drivers must run phases in separate processes or strictlydel+gcbetween loads. - Checkpoints are expected as flat local dirs (see
resonance_engine/loader.pyfor the exact per-family file lists); the multilingual loader redirects the Cangjie tokenizer fetch to the local file — zero network at boot.
Development
pytest tests/ -q # unit tests, no checkpoints needed
python scripts/parity.py # exact-output parity vs the old stacks (needs ckpts)
Parity gates (Phase 1): same-seed exact-match output vs resonance's
MultilingualV3 and vs the chatterbox-flash package.