Fine-Tuning a Commercial-Safe Local Voice Clone from 17 Minutes of Smartphone Audio
A complete engineering field guide to fine-tuning a local MIT-licensed Bangladeshi Bangla neural TTS voice from 17 minutes of phone audio — including all 7 real failures hit, forensic audio curation, Epoch 0–18 validation curves, A/B verification, and zero-idle-VRAM FastAPI serving.
- Brief Type
- Engineering Field Guide
- Focus
- AI / Computing
- Sources
- 6 linked references

Most voice-cloning tutorials show the sanitized "happy path": start with a pristine studio corpus, run train.py, and declare victory. Real production engineering rarely behaves that politely.
In a real workflow, you record 17 minutes on a smartphone in a quiet room, stumble on tricky technical lines, restart mid-sentence on tongue-twisters, get interrupted three times by incoming phone calls and notification chimes, hit PyTorch cuDNN and NCCL symbol crashes, watch Whisper large-v3-turbo enter Bengali decoder hallucination loops, catch two subtle bugs inside the upstream fine-tuning codebase, and hear the zero-shot baseline pronounce "SQL" as "school".
This field guide documents the complete, reproducible pipeline that took raw smartphone recordings to a 100% commercial-safe, MIT-licensed Bangladeshi Bangla (bn-BD) + STEM code-switching neural TTS voice (custom_bn_v1) served locally with 0 MiB idle VRAM — including every failure encountered, the exact root cause, and the verified metrics at every gate.
End-to-End Architecture
Executive Scorecard
| Dimension | Measured Result |
|---|---|
| Base Model & License | BosonLab/chatterbox-bangla (MIT License — safe for commercial media and software products) |
| Raw Smartphone Audio | 30.17s Zero-Shot Ref (26.2 dB SNR) + 17m 01s LoRA Pack (30.4 dB SNR) |
| Forensic Audit Yield | 106 atomic sentences → 89 spotless first takes + 9 recovered retries (−8 quarantined stutters/chime) = 98 clean clips (12.69 min) |
| Training Compute | RTX 5070 Ti (16 GB) · 9.3 min (555.9s, 18 epochs, bf16, 11.3M / 547.5M = 2.07% trainable) |
| Held-Out Val Loss Drop | 5.0458 (Zero-Shot Base) → 3.9076 (Epoch 8 Best) = −1.14 nats on 6 unseen sentences |
| Speaker Cosine Similarity | 0.9132 mean across 9 unseen test sentences (0.9291 on brand-new astrophysics text; studio bar ≥ 0.90) |
| Production Serving | Lazy-loaded FastAPI GPU service · 0 MiB VRAM when idle · ~1.15× RTF on RTX 5070 Ti |
Step 1 — Commercial Licensing First (Fail #1 Avoided Before Writing Code)
Before allocating GPU hours, audit every base weight license down to upstream dependencies:
- Cloud consumer TTS endpoints (
edge-tts, etc.): Useful for rapid prototyping, but carry no commercial monetization rights and lock narration into a generic synthetic cadence. - IndicF5 / F5-TTS derivatives: Frequently recommended for South Asian languages, yet upstream F5-TTS base weights carry
CC-BY-NC-4.0(Non-Commercial), disqualifying commercial media and client deployments. BosonLab/chatterbox-bangla(built onResembleAI/chatterbox): Released under the MIT License, fine-tuned on ~99 hours of Bengali (Shrutilipi28h +Rasa51h +IndicTTS_Bengali20h) with its vocabulary extended from704 → 2,530tokens covering all 77 Bengali characters alongside 442 Latin subwords.
Why Chatterbox Works So Well for 12-Minute Personal LoRA
Chatterbox cleanly separates voice synthesis into three independent modules:
VoiceEncoder(ve.safetensors, 5.5 MB): A 3-layer LSTM projecting 16 kHz audio into a 256-D speaker identity embedding. (Kept frozen.)T3(t3_cfg.safetensors, 2.0 GB): A520M-parameter Llama backbone mapping(speaker_emb, 150 speech prompt tokens, text tokens)to autoregressive 25 Hz discrete S3 speech tokens (0..6560, plusSOS=6561,EOS=6562). Regional accent, Dhaka vs. Kolkata vowels, breath rhythm, and phrasing live here — makingT3the exact surgical target for LoRA.S3Gen(s3gen.safetensors, 1.0 GB): A flow-matching decoder + HiFT-GAN vocoder turning 25 Hz speech tokens + a 10-second reference mel into crisp 24 kHz audio. (Kept frozen.)
Because VoiceEncoder and S3Gen already preserve vocal timbre above 0.90 cosine similarity zero-shot, adapting T3 alone shifts pronunciation and rhythm into the speaker's authentic Bangladeshi cadence without introducing vocoder buzz or needing 10 hours of audio.
Step 2 — Designing Recording Scripts That Teach Real Prosody
Reading flat encyclopedia articles yields flat synthesis. To capture documentary-grade prosody, we structured two purpose-built scripts:
Script #1 — Zero-Shot Reference (55 words, ~25 seconds)
Packs three distinct prosodic contours into one short take (curiosity question → calm technical explanation → energetic documentary hook):
তুমি কি কখনো ভেবে দেখেছো, আমাদের চারপাশের সাধারণ বাতাসের ভেতর দিয়ে আলো আর শব্দ কীভাবে এত দ্রুত ছড়িয়ে পড়ে? আসলে, একটা smartphone battery থেকে শুরু করে আধুনিক AI — ছোট বড় প্রতিটি science-এর পেছনেই খুব সোজা একটা নিয়ম নীরবে কাজ করে। আজকের video-তে আমরা সরাসরি সেই ভেতরের কৌশলটা সহজ বাংলায়, একদম শুরু থেকে বুঝে নেব।
Script #2 — 90-Line Personal LoRA Pack (~15 minutes)
Balanced across seven linguistic and technical domains:
| Part | Lines | What It Teaches T3 | Representative Example |
|---|---|---|---|
| Part 1 | 01–26 | High-risk Bangla pronunciation traps (দ্রুত, সরাসরি, বাতাসের, সূচকীয়, ordinals, decimals) | "দ্রুত সিদ্ধান্ত নিতে গিয়ে মানুষ অনেক সময় সহজ উত্তরটা সরাসরি দেখতে পায় না।" |
| Part 2 | 27–46 | Heavy Bangla–English STEM & cybersecurity code-switching (SQL, DNS, HTTPS, Wh, mAh, p53) | "তুমি যখন browser-এ কোনো link click করো, তখন সবার আগে DNS lookup হয়ে HTTPS আর TCP দিয়ে server-এ connection তৈরি হয়।" |
| Part 3 | 47–58 | Pure-Bangla STEM explainers (batteries, mitosis, calculus, electromagnetism, finance) | "লিথিয়াম-আয়ন ব্যাটারি চার্জ হওয়ার সময় আয়নগুলো ক্যাথোড থেকে অ্যানোডে গিয়ে গ্রাফাইটের স্তরে বসে, যাকে বলে ইন্টারক্যালেশন।" |
| Part 4 | 59–68 | Years, percentages, large-scale numbers, and ranked comparisons (১৯৫০, ৯৯.৯%, মিলিয়ন/কোটি) | "নিরানব্বই দশমিক নয় percent uptime মানেও বছরে প্রায় নয় ঘণ্টা server down থাকার বাস্তব ঝুঁকি।" |
| Part 5 | 69–76 | Curiosity hooks, exclamations, dramatic contrast, and energetic closings | "এখন প্রশ্ন হলো, এত বিশাল একটা global system কোনো central controller ছাড়াই smoothly চলে কীভাবে?" |
| Part 6 | 77–85 | Full Bangladeshi phonetic & juktakkhor coverage (ক্ষ, জ্ঞ, হ্ম, ণ্ড, ষ্ম, ঞ্জ) | "গ্রীষ্মের দুপুরে তীব্র রোদ, বর্ষার ঝুম বৃষ্টি আর শীতের কুয়াশা মিলেই বাংলার ছয় ঋতুর রূপ।" |
| Part 7 | 86–90 | Five multi-sentence documentary paragraphs for natural breath pacing | "রাতের আকাশে কোটি কোটি star থাকা সত্ত্বেও আকাশ অন্ধকার কেন?" |
Step 3 — Software Stack & Three CUDA/Library Failures We Overcame
Verified Environment
| Layer | Exact Verified Packages & Hardware |
|---|---|
| GPUs | Training: NVIDIA RTX 5070 Ti (16 GB) · Production Serving: NVIDIA RTX 2080 Ti (11 GB) |
| Core ML Runtime | Python 3.11.16 · torch 2.13.0+cu130 · torchaudio 2.11.0+cu130 · transformers 4.57.6 · peft 0.20.0 · accelerate 1.14.0 · safetensors 0.8.0 · librosa 0.11.0 · soundfile 0.12.1 |
| Isolated Chatterbox Deps | Installed via pip install --no-deps --target ./pydeps (zero pollution to global Python): conformer==0.3.2, s3tokenizer==0.3.0, resemble-perth==1.0.1, pyloudnorm==0.2.0 |
| Audio & API Tooling | ffmpeg 6.1.1 · fastapi 0.135.3 · uvicorn 0.42.0 · openai-whisper (large-v3-turbo) |
# 1. Clone the Chatterbox fine-tuning kit & download the MIT Bangla checkpoint (3.0 GB)
mkdir -p voice-studio/models
git clone https://github.com/gokhaneraslan/chatterbox-finetuning voice-studio/chatterbox-finetuning
huggingface-cli download BosonLab/chatterbox-bangla \
--local-dir voice-studio/models/chatterbox-bangla
# 2. Install only the 4 missing lightweight dependencies into an isolated target folder
pip install --no-deps --target voice-studio/pydeps \
conformer resemble-perth pyloudnorm s3tokenizerFails #2, #3, and #4 — Runtime Blockers and Exact Fixes
Fail #2 — ImportError: libtorch_cuda.so: undefined symbol: ncclCommResume
- Root Cause: The system conda environment resolved an older
libnccl.so.2than the NCCL ABItorch 2.13.0+cu130was compiled against. - Fix: Preload the matching NCCL 2.29.7 shared library via
LD_PRELOADin both training commands and the systemd unit.
Fail #3 — RuntimeError: cuDNN version incompatibility: PyTorch compiled against (9, 20, 0) but found runtime version (9, 13, 0)
- Root Cause: Importing
transformersimplicitly initialized TensorFlow (cuda_dnn.cc) alongside conda'snvidia-cudnn-cu13==9.13.0.50, crashing the momentVoiceEncoder(a 3-layer LSTM) moved onto CUDA. - Fix: Set
USE_TF=0 TRANSFORMERS_NO_TF=1(also cutting Python startup time by ~5×) and settorch.backends.cudnn.enabled = False. The 520M Llama backbone runs on PyTorch's native SDPA/Flash attention kernels, so disabling cuDNN keeps training and inference fast and rock-solid.
Fail #4 — Hard-Coded 704-Token Vocab Crash + Missing Bengali Dari (।) in punc_norm()
- Root Cause: Upstream
gokhaneraslan/chatterbox-finetuninginitializesT3()with the 704-token English vocabulary, causing a tensor mismatch againstBosonLab/chatterbox-bangla's2,530-token embedding table. In addition,punc_norm()only recognized{".", "!", "?", "-", ","}and blindly appended an English period.after every Bengali sentence ending in dari (।,U+0964). - Fix: Apply a two-point patch to
src/chatterbox_/tts.pyto infertext_tokens_dict_sizedynamically fromt3_cfg.safetensorsand add"।"tosentence_enders:
# Dynamic vocab-size load inside ChatterboxTTS.from_local()
t3_state = load_file(ckpt_dir / "t3_cfg.safetensors")
from .models.t3.modules.t3_config import T3Config
t3 = T3(hp=T3Config(text_tokens_dict_size=t3_state["text_emb.weight"].shape[0]))
# Bengali punctuation preservation inside punc_norm()
sentence_enders = {".", "!", "?", "-", ",", "।"}Step 4 — Forensic Audio Curation (Where Voice Clones Succeed or Fail)
Acoustic diagnostics on the two untouched raw phone files confirmed dual-mono 44.1 kHz 16-bit PCM (L == R, diff = 0.0) with a -48.8 dB room noise floor (26.2 dB SNR on Script #1 and 30.4 dB SNR on Script #2).
Why Uncleaned Mistakes Poison a 12-Minute LoRA
- Unremoved retries / false starts pair two spoken takes with one text string, breaking monotonic text-to-speech attention and causing inference loops.
- Mid-sentence stutters and self-corrections (
উঠলে… উঠে দেখলে,মৈলি-মৌলিক,বরা-ভয়াবহ) teachT3to hallucinate syllable stutters on similar consonant clusters. - Phone ringtones and notification chimes inject narrowband tonal tokens into
S3Tokenizer, occasionally triggering metallic artifacts during silent pauses.
Fail #5 — Blind Whisper Alignment Failed on Bangla–English Code-Switching
Running Whisper large-v3-turbo directly over the 17-minute recording — and even over initial 0.45s-silence VAD chunks — hit two major pitfalls:
- Decoder hallucination loops: Because
large-v3-turbouses only 4 decoder layers, it repeatedly emitted nonsense loops ("যুত্্্্ ক্নাকেন ক্নাকেন","ববর ববো ববো","বে বে বে") on spotless studio lines whenever English acronyms (SMTP,WASP-39,YouTube explainer) appeared mid-sentence. - Coarse VAD merging: A
0.45ssilence threshold fused early lines separated by0.30s–0.44spauses into 20–40 second mega-segments.
Our Two-Layer Fix:
- 10 ms High-Resolution Acoustic Pause Map: Sliding 25 ms RMS window (10 ms hop, threshold
noise_floor + 9.0 dB = -40.1 dB) mapped every silence boundary≥ 0.25sto0.01sprecision. - 100% Direct Ear Audit (
0s → 1021s): Listening directly across compact 16 kHz audit slices caught all 3 phone interruptions, all 9 full-line retries, and all 8 un-retried stutters/chime — including a subtle mid-sentence notification chime at832.5sinside Line 83 that automated tonality heuristics missed.

| Audit Category | Count | Exact Findings & Curation Decision |
|---|---|---|
| Phone Interruptions | 3 | • 698.7–711.9s (L70 Take 1): Incoming ringtone over "কোনো রোগ নেই" + 6.5s silence → Take 1 discarded; spotless Take 2 (711.85–717.75s) recovered.• 797.9–813.6s (L81 Take 1): Incoming ringtone over "একই পদার্থের কাজ করে" + 5.5s silence → Take 1 discarded; spotless Take 2 (813.55–819.75s) recovered.• 832.5s (L83): Mid-sentence notification chime after "আলোর প্রতিসরণ" (not retried) → fully quarantined. |
| Full-Line Retries Recovered | 9 | L09 (stutter শ-বিদ্যুৎ → Take 2), L24 (hesitation → Take 2), L38 (2 fumbled takes → Take 3), L40 (false start → Take 2), L63 (fumble → Take 2), L64 (truncated → Take 2), L70 (Phone #1 → Take 2), L77 (false start → Take 2), L81 (Phone #2 → Take 2). |
| Quarantined Stutters / Chime | 8 | L15, L45, L69, L83 (chime #3), L86_4, L87_2, L89_3, L90_4. Dropping 8 flawed lines instead of risky mid-word splicing left 98 spotless clips. |
| Spoken-Text Sync Fixes | 4 | Matched text 1-to-1 to exact spoken words (e.g., L19 "কার্ডের", L29 "একটা মাত্র কোড", L37 "একশ ওয়াট আওয়ার", L62 "কার্বন ডাই অক্সাইড"). |
| Final Golden Dataset | 98 clips | 92 train (12.01 min) + 6 held-out val (41.1s) · 4.00s–12.85s per clip · zero clicks, zero stutters, zero ringtones. |
Broadcast Mastering Command (All 98 Clips + 25s Zero-Shot Reference)
ffmpeg -y -v error -ss "$START" -to "$END" -i raw_recording.wav \
-af "pan=mono|c0=c0,highpass=f=70,loudnorm=I=-18:TP=-1.5:LRA=11,\
afade=t=in:st=0:d=0.02,afade=t=out:st=${FADE_OUT}:d=0.04,apad=pad_dur=0.05" \
-ar 24000 -ac 1 -c:a pcm_s16le dataset/wavs/${UID}.wavEngineering note: Skip aggressive neural noise reduction (afftdn / RNNoise) when raw SNR already exceeds 25 dB. Denoisers introduce phase smear in high-frequency sibilants (শ, স, ফ, ছ) that discrete speech tokenizers amplify as metallic hiss. A gentle 70 Hz high-pass filter plus EBU R128 -18 LUFS leveling preserves natural vocal warmth.
Step 5 — Stage 1 Zero-Shot Baseline & The "SQL" → "school" Discovery
Before training LoRA weights, we ran a controlled Stage 1 Zero-Shot baseline comparing raw Latin acronyms against Bengali phonetic spelling on the exact same sentence:
| Input Variant | Synthesized Pronunciation | Speaker Cosine Sim | Takeaway |
|---|---|---|---|
| Raw Latin: "তাই আজকের API বা SQL সার্ভারে Lithium-ion battery আর AI মডেল একসাথে কাজ করে।" | Pronounced "SQL" as "school" (স্কুল) and "Lithium-ion" as "lithium-iyan" | 0.8916 | Fail #6a: Base weights saw 99h pure Bengali script; raw Latin acronyms trigger English word-reading collisions. |
| Bengali Phonetic: "তাই আজকের এ পি আই বা এস কিউ এল সার্ভারে লিথিয়াম আয়ন ব্যাটারি আর এ আই মডেল একসাথে কাজ করে।" | Crystal-clear, natural pronunciation of every acronym and STEM term | 0.9166 | Rule: Train T3 on exact spoken Bengali phonetics and add a lightweight deterministic normalizer ahead of inference. |
Pure Bangla (L01): "দ্রুত সিদ্ধান্ত নিতে গিয়ে মানুষ অনেক সময় সহজ উত্তরটা সরাসরি দেখতে পায় না।" | Slight Kolkata vowel tint, mid-sentence pause, clipped final "না" | 0.9006 | Why Stage 2 LoRA matters: Zero-shot captures timbre, while LoRA locks in authentic Bangladeshi cadence & clean endings. |
Step 6 — Stage 2 Personal LoRA Fine-Tuning (Two Upstream Bugs Caught & Fixed)
Auditing src/chatterbox_/models/t3/t3.py, src/preprocess_ljspeech.py, and src/model.py line-by-line before launching training uncovered three high-impact traps (Fail #6b):
- Missing
start_speech_token (6561): At inference (t3.py),T3initiates autoregressive decoding withSOS = 6561([6561, s_0, s_1, ..., 6562]). Upstream preprocessing appendedEOS = 6562without prependingSOS = 6561, creating a subtle train/inference misalignment. - Self-Prefix Prompt Leakage + 3-Second Loss Masking: Upstream took
prompt_tokensfrom the first 3.0 seconds of the same clip (wav[:, :3s]) and then masked those first 75 tokens out of cross-entropy loss — discarding ~40% of every 7-second utterance and leaving sentence openings untrained. - Unfrozen Embeddings (
modules_to_save=["text_emb", "text_head"]): Essential when teaching a model a brand-new language, but harmful on 12 minutes of single-speaker data over an already-trained 99h Bengali vocabulary (unseen Bengali characters drift and degrade open-vocabulary reading).
Inference-Exact LoRA Recipe
- Exact Sequence Framing:
text_tokens = [255, *bn_ids, 0]andspeech_tokens = [6561, *s3_tokens_25hz, 6562](mean198.2speech tokens per clip). - Independent Same-Speaker Conditioning (Zero Loss Masking):
60%of steps condition on one of 3 clean 6-second windows of the Script #1 reference clip (matching inference exactly);40%condition on a different random clean clip from the speaker.15%speaker-embedding dropout preserves Classifier-Free Guidance (CFG) control. Cross-entropy runs across 100% of speech tokens (loss = loss_speech + 0.1 * loss_text). - Regularized LoRA Parameters:
target_modules = ["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj", "spkr_enc"]- Frozen:
text_emb,text_head,VoiceEncoder,S3Gen r = 16,lora_alpha = 32,lora_dropout = 0.08→11,325,440 / 547,470,336trainable parameters (2.07%)AdamW(lr=8e-5, weight_decay=0.01),10%linear warmup + cosine decay to4e-6,bf16autocast,batch_size=2,grad_accum=4(effective batch = 8,12steps/epoch), gradient checkpointing (use_reentrant=False).
- Held-Out Early-Best Selection: Validation
loss_speechevaluated on 6 unseen clips (L01, L03, L18, L36, L71, L84) at Epoch 0 and every 2 epochs.
Training vs. Held-Out Validation Curve

| Epoch | Step | Learning Rate | Train Speech Loss | Held-Out Val Speech Loss | Val Aux Text Loss | Milestone |
|---|---|---|---|---|---|---|
| 0 (Zero-Shot Base) | 0 | — | — | 5.0458 | 3.1003 | Pretrained Baseline |
| 2 | 24 | 8.00e-5 | 4.4833 | 4.3220 | 2.5443 | Rapid speaker & cadence lock (−0.72) |
| 4 | 48 | 7.63e-5 | 4.0648 | 4.0490 | 1.9037 | Strong generalization (−1.00) |
| 6 | 72 | 6.72e-5 | 3.8378 | 3.9462 | 1.8908 | Refining Bangladeshi prosody (−1.10) |
| 8 (Best) | 96 | 5.42e-5 | 3.6333 | 3.9076 | 1.9819 | ★ OPTIMAL SWEET SPOT (−1.14 nats) — Restored & Merged |
| 10 | 120 | 3.90e-5 | 3.4446 | 3.9341 | 2.0804 | Overfitting onset (val ticks upward) |
| 12 | 144 | 2.40e-5 | 3.2840 | 3.9893 | 2.1534 | Memorizing training phrasing |
| 18 (Final) | 216 | 4.00e-6 | 3.0749 | 4.0940 | 2.2201 | +0.186 worse than Epoch 8 (discarded) |
Key empirical takeaway: For ~12 minutes of single-speaker speech (~92 utterances), optimal generalization lands right around ~96 optimizer steps (Epoch 8). Training blindly to Epoch 18 degraded held-out validation loss by +0.19 nats. Total wall-clock training + merge time on RTX 5070 Ti: 555.9s (9.3 minutes).
Step 7 — Verification, Fail #7, and Honest 9-Sentence A/B Benchmark
Fail #7 — patched_model.* State-Dict Collision During Hot-Swapping
Running Zero-Shot model.generate() and then hot-loading merged LoRA weights onto the same ChatterboxTTS instance threw RuntimeError: Unexpected key(s) in state_dict: "patched_model.model.layers...". Inside t3.py, .inference() dynamically attaches a cached HuggingFace wrapper attribute model.t3.patched_model referencing self.tfmr. Clearing it before swapping weights resolves the crash cleanly:
if hasattr(model.t3, "patched_model"):
delattr(model.t3, "patched_model")
model.t3.compiled = False
model.t3.load_state_dict(lora_sd, strict=True)Zero-Shot vs. Personal LoRA (Epoch 8) on 9 Unseen Sentences
All 9 test sentences (6 held-out validation lines + 3 brand-new STEM documentary lines) were synthesized with fixed seed 42, cfg_weight=0.5, temperature=0.72, repetition_penalty=1.2, then verified via VoiceEncoder cosine similarity, Whisper large-v3-turbo Bengali ASR, and direct listening:
| Unseen Test Sentence | Zero-Shot SpkSim | LoRA Ep8 SpkSim | Zero-Shot ASR | LoRA Ep8 ASR | Direct Listening Assessment |
|---|---|---|---|---|---|
L01 (DB traps: দ্রুত, সিদ্ধান্ত, সরাসরি) | 0.9176 | 0.8846 | 0.813 | 0.787 | LoRA wins clearly: Zero-Shot hesitated mid-line & clipped final "না" (6.36s); LoRA delivered the entire line smoothly (4.84s) with authentic Dhaka cadence. |
L03 (বাতাসের ঝাপটা) | 0.9114 | 0.9287 | 0.795 | 0.715 | Stronger timbre lock (+0.017) and calm documentary pacing. |
L18 (ত্রিশ দিন পর… কোটি টাকা!) | 0.9194 | 0.9261 | 0.731 | 0.832 | LoRA wins big: Zero-Shot dropped opening word "ত্রিশ"; LoRA nailed every word and exclamation (+0.101 ASR). |
L36 (AI / image / audio / bug) | 0.9375 | 0.9004 | 0.815 | 0.804 | Both intelligible; LoRA sounds calmer and more conversational. |
L71 (Curiosity hook স্মুথলি চলে কীভাবে?) | 0.9144 | 0.9122 | 0.607 | 0.882 | LoRA wins decisively: Zero-Shot garbled "স্মুথলি" as "সুফ্টলি"; LoRA nailed "স্মুথলি চলে কীভাবে?" with rising curiosity inflection (+0.275 ASR). |
L84 (Juktakkhor গ্রীষ্মের… বর্ষার) | 0.9096 | 0.9169 | 0.749 | 0.723 | Crisp consonant clusters and warmer Bangladeshi vowel tone. |
NEW_banglish (API, SQL, Lithium-ion, AI) | 0.9019 | 0.9074 | 0.710 | 0.508* | Ear audit caught ASR miss: LoRA articulated every acronym cleanly (এ-পি-আই, এস-কিউ-এল, লিথিয়াম আয়ন ব্যাটারি); Whisper dropped the middle clause. |
NEW_cyber (open-source package + SQL) | 0.9232 | 0.9130 | 0.796 | 0.796 | Live API smoke test sounded indistinguishable from a real studio recording. |
NEW_physics (Brand-new astrophysics) | 0.9243 | 0.9291 | 0.808 | 0.820 | Broadcast-grade documentary delivery (0.9291 speaker sim, 0.820 ASR). |
| 9-Sentence Average | 0.9177 | 0.9132 | 0.7581 | 0.7628 | Major qualitative gain in regional cadence, sentence endings & STEM reliability (−1.14 val nats). |
Why speaker cosine similarity stays near ~0.91 while perceptual quality jumps dramatically: VoiceEncoder scores vocal timbre (which S3Gen already anchors from the 10-second reference clip). What LoRA transforms — confirmed by both the −1.14 nat validation drop and listening — is accent authenticity (Kolkata → Dhaka), breath phrasing, complete endings, and smooth technical code-switching.
Step 8 — Zero-Idle-VRAM Production Serving
To run custom voices locally without locking gigabytes of GPU memory away from LLMs or video rendering:
- Deterministic Banglish & Acronym Normalizer (
bn_text_norm.py): Automatically expandsSQL → এস-কিউ-এল,API → এ-পি-আই,HTTPS → এইচ-টি-টি-পি-এস,Wh → ওয়াট আওয়ার,mAh → মিলিঅ্যাম্পিয়ার আওয়ার,CO2 → কার্বন ডাই অক্সাইড,Lithium-ion battery → লিথিয়াম-আয়ন ব্যাটারি, auto-spells unseen 2–5 letter ALL-CAPS acronyms (JWT → জে-ডব্লিউ-টি), smooths attached Bengali case suffixes (সার্ভার-এ → সার্ভারে), and splits long paragraphs cleanly on।,?,!into≤ 210-character utterances stitched with0.22spauses and15msfades. - Peak-Safe Output Limiter: Base Chatterbox occasionally emits waveforms peaking at
1.06–1.14(hard digital clipping in 16-bit PCM). Applying DC offset removal and a0.90ceiling limiter (-0.9 dBFS) eliminates clipping entirely. - Lazy GPU Loading +
/unload_modelsLifecycle: Pinned to a dedicated serving GPU (RTX 2080 Ti), the FastAPI service idles at0.0 MiBVRAM, loads the mergedt3_custom_bn_v1_lora_merged.safetensorsweights on demand during batch synthesis, and releases GPU VRAM back down to baseline (8.8 MiBverified live) the moment the client callsPOST /unload_models.
Reproducible Smoke-Test Checklist
# 1. Confirm healthy service and 0 MiB idle VRAM
curl -s http://127.0.0.1:8042/health | jq .
# 2. Synthesize a brand-new Bangla-English technical sentence
curl -s -X POST http://127.0.0.1:8042/generate_tts \
-H "content-type: application/json" \
-d '{"text":"একটা মাত্র বিষাক্ত open-source package কীভাবে লক্ষ লক্ষ অ্যাপ আর SQL server দখল করে নিতে পারে?",
"voice_id":"custom_bn_v1","language":"bn-BD","return_data":true}' \
| python3 -c "import sys,json,base64; d=json.load(sys.stdin)[0]; open('/tmp/test_bn.wav','wb').write(base64.b64decode(d['data'])); print(d['mode'], d['duration_s'], 's in', d['gen_time_s'], 's')"
# 3. Release GPU VRAM cleanly after batch completion
curl -s -X POST http://127.0.0.1:8042/unload_models -H "content-type: application/json" -d '{}'
nvidia-smi --query-gpu=index,name,memory.used,memory.free --format=csv,noheaderPractical Takeaways for Teams Building Local Voice Pipelines
- Audit licenses before data collection: Commercial projects should anchor on MIT or Apache-2.0 weights (
ResembleAI/chatterbox,BosonLab/chatterbox-bangla) rather thanCC-BY-NCcheckpoints. - 12 clean minutes beats 30 noisy minutes: Quarantining 8 imperfect sentences out of 106 took 20 minutes of ear review and prevented stutters and ringtone artifacts from contaminating LoRA weights.
- Never skip a held-out validation split: On small single-speaker corpora, overfitting starts fast (Epoch 10+ here). Restoring the lowest-validation checkpoint (Epoch 8) is the single highest-ROI safeguard in the entire training loop.
- Pair ASR metrics with human listening: Multilingual ASR models routinely mis-score code-switched STEM phrases even when synthesized audio is spotless. Always combine validation loss, speaker cosine similarity, and direct ear checks before shipping a voice to production.