Back to archive
Engineering Field GuideBy AusDAIS ResearchNovember 26, 202616 min read6 linked sources

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
Engineering cover summarizing 9.3-minute LoRA fine-tuning of a local MIT-licensed neural voice clone from 17 minutes of smartphone audio
AusDAIS Research engineering telemetry & visualization

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

DimensionMeasured Result
Base Model & LicenseBosonLab/chatterbox-bangla (MIT License — safe for commercial media and software products)
Raw Smartphone Audio30.17s Zero-Shot Ref (26.2 dB SNR) + 17m 01s LoRA Pack (30.4 dB SNR)
Forensic Audit Yield106 atomic sentences → 89 spotless first takes + 9 recovered retries (−8 quarantined stutters/chime) = 98 clean clips (12.69 min)
Training ComputeRTX 5070 Ti (16 GB) · 9.3 min (555.9s, 18 epochs, bf16, 11.3M / 547.5M = 2.07% trainable)
Held-Out Val Loss Drop5.0458 (Zero-Shot Base) → 3.9076 (Epoch 8 Best) = −1.14 nats on 6 unseen sentences
Speaker Cosine Similarity0.9132 mean across 9 unseen test sentences (0.9291 on brand-new astrophysics text; studio bar ≥ 0.90)
Production ServingLazy-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 on ResembleAI/chatterbox): Released under the MIT License, fine-tuned on ~99 hours of Bengali (Shrutilipi 28h + Rasa 51h + IndicTTS_Bengali 20h) with its vocabulary extended from 704 → 2,530 tokens 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:

  1. VoiceEncoder (ve.safetensors, 5.5 MB): A 3-layer LSTM projecting 16 kHz audio into a 256-D speaker identity embedding. (Kept frozen.)
  2. T3 (t3_cfg.safetensors, 2.0 GB): A 520M-parameter Llama backbone mapping (speaker_emb, 150 speech prompt tokens, text tokens) to autoregressive 25 Hz discrete S3 speech tokens (0..6560, plus SOS=6561, EOS=6562). Regional accent, Dhaka vs. Kolkata vowels, breath rhythm, and phrasing live here — making T3 the exact surgical target for LoRA.
  3. 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:

PartLinesWhat It Teaches T3Representative Example
Part 101–26High-risk Bangla pronunciation traps (দ্রুত, সরাসরি, বাতাসের, সূচকীয়, ordinals, decimals)"দ্রুত সিদ্ধান্ত নিতে গিয়ে মানুষ অনেক সময় সহজ উত্তরটা সরাসরি দেখতে পায় না।"
Part 227–46Heavy Bangla–English STEM & cybersecurity code-switching (SQL, DNS, HTTPS, Wh, mAh, p53)"তুমি যখন browser-এ কোনো link click করো, তখন সবার আগে DNS lookup হয়ে HTTPS আর TCP দিয়ে server-এ connection তৈরি হয়।"
Part 347–58Pure-Bangla STEM explainers (batteries, mitosis, calculus, electromagnetism, finance)"লিথিয়াম-আয়ন ব্যাটারি চার্জ হওয়ার সময় আয়নগুলো ক্যাথোড থেকে অ্যানোডে গিয়ে গ্রাফাইটের স্তরে বসে, যাকে বলে ইন্টারক্যালেশন।"
Part 459–68Years, percentages, large-scale numbers, and ranked comparisons (১৯৫০, ৯৯.৯%, মিলিয়ন/কোটি)"নিরানব্বই দশমিক নয় percent uptime মানেও বছরে প্রায় নয় ঘণ্টা server down থাকার বাস্তব ঝুঁকি।"
Part 569–76Curiosity hooks, exclamations, dramatic contrast, and energetic closings"এখন প্রশ্ন হলো, এত বিশাল একটা global system কোনো central controller ছাড়াই smoothly চলে কীভাবে?"
Part 677–85Full Bangladeshi phonetic & juktakkhor coverage (ক্ষ, জ্ঞ, হ্ম, ণ্ড, ষ্ম, ঞ্জ)"গ্রীষ্মের দুপুরে তীব্র রোদ, বর্ষার ঝুম বৃষ্টি আর শীতের কুয়াশা মিলেই বাংলার ছয় ঋতুর রূপ।"
Part 786–90Five multi-sentence documentary paragraphs for natural breath pacing"রাতের আকাশে কোটি কোটি star থাকা সত্ত্বেও আকাশ অন্ধকার কেন?"

Step 3 — Software Stack & Three CUDA/Library Failures We Overcame

Verified Environment

LayerExact Verified Packages & Hardware
GPUsTraining: NVIDIA RTX 5070 Ti (16 GB) · Production Serving: NVIDIA RTX 2080 Ti (11 GB)
Core ML RuntimePython 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 DepsInstalled 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 Toolingffmpeg 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 s3tokenizer

Fails #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.2 than the NCCL ABI torch 2.13.0+cu130 was compiled against.
  • Fix: Preload the matching NCCL 2.29.7 shared library via LD_PRELOAD in 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 transformers implicitly initialized TensorFlow (cuda_dnn.cc) alongside conda's nvidia-cudnn-cu13==9.13.0.50, crashing the moment VoiceEncoder (a 3-layer LSTM) moved onto CUDA.
  • Fix: Set USE_TF=0 TRANSFORMERS_NO_TF=1 (also cutting Python startup time by ~5×) and set torch.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-finetuning initializes T3() with the 704-token English vocabulary, causing a tensor mismatch against BosonLab/chatterbox-bangla's 2,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.py to infer text_tokens_dict_size dynamically from t3_cfg.safetensors and add "।" to sentence_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 (উঠলে… উঠে দেখলে, মৈলি-মৌলিক, বরা-ভয়াবহ) teach T3 to 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:

  1. Decoder hallucination loops: Because large-v3-turbo uses only 4 decoder layers, it repeatedly emitted nonsense loops ("যুত্্্্ ক্নাকেন ক্নাকেন", "ববর ববো ববো", "বে বে বে") on spotless studio lines whenever English acronyms (SMTP, WASP-39, YouTube explainer) appeared mid-sentence.
  2. Coarse VAD merging: A 0.45s silence threshold fused early lines separated by 0.30s–0.44s pauses into 20–40 second mega-segments.

Our Two-Layer Fix:

  1. 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.25s to 0.01s precision.
  2. 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 at 832.5s inside Line 83 that automated tonality heuristics missed.

17-Minute Forensic Audio Curation Breakdown and Unseen-Sentence A/B Verification

Audit CategoryCountExact Findings & Curation Decision
Phone Interruptions3• 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 Recovered9L09 (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 / Chime8L15, 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 Fixes4Matched text 1-to-1 to exact spoken words (e.g., L19 "কার্ডের", L29 "একটা মাত্র কোড", L37 "একশ ওয়াট আওয়ার", L62 "কার্বন ডাই অক্সাইড").
Final Golden Dataset98 clips92 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}.wav

Engineering 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 VariantSynthesized PronunciationSpeaker Cosine SimTakeaway
Raw Latin: "তাই আজকের API বা SQL সার্ভারে Lithium-ion battery আর AI মডেল একসাথে কাজ করে।"Pronounced "SQL" as "school" (স্কুল) and "Lithium-ion" as "lithium-iyan"0.8916Fail #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 term0.9166Rule: 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.9006Why 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):

  1. Missing start_speech_token (6561): At inference (t3.py), T3 initiates autoregressive decoding with SOS = 6561 ([6561, s_0, s_1, ..., 6562]). Upstream preprocessing appended EOS = 6562 without prepending SOS = 6561, creating a subtle train/inference misalignment.
  2. Self-Prefix Prompt Leakage + 3-Second Loss Masking: Upstream took prompt_tokens from 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.
  3. 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] and speech_tokens = [6561, *s3_tokens_25hz, 6562] (mean 198.2 speech 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,336 trainable parameters (2.07%)
    • AdamW(lr=8e-5, weight_decay=0.01), 10% linear warmup + cosine decay to 4e-6, bf16 autocast, batch_size=2, grad_accum=4 (effective batch = 8, 12 steps/epoch), gradient checkpointing (use_reentrant=False).
  • Held-Out Early-Best Selection: Validation loss_speech evaluated on 6 unseen clips (L01, L03, L18, L36, L71, L84) at Epoch 0 and every 2 epochs.

Training vs. Held-Out Validation Curve

Chatterbox-Bangla T3 LoRA Training and Held-Out Validation Curve

EpochStepLearning RateTrain Speech LossHeld-Out Val Speech LossVal Aux Text LossMilestone
0 (Zero-Shot Base)0——5.04583.1003Pretrained Baseline
2248.00e-54.48334.32202.5443Rapid speaker & cadence lock (−0.72)
4487.63e-54.06484.04901.9037Strong generalization (−1.00)
6726.72e-53.83783.94621.8908Refining Bangladeshi prosody (−1.10)
8 (Best)965.42e-53.63333.90761.9819★ OPTIMAL SWEET SPOT (−1.14 nats) — Restored & Merged
101203.90e-53.44463.93412.0804Overfitting onset (val ticks upward)
121442.40e-53.28403.98932.1534Memorizing training phrasing
18 (Final)2164.00e-63.07494.09402.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 SentenceZero-Shot SpkSimLoRA Ep8 SpkSimZero-Shot ASRLoRA Ep8 ASRDirect Listening Assessment
L01 (DB traps: দ্রুত, সিদ্ধান্ত, সরাসরি)0.91760.88460.8130.787LoRA 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.91140.92870.7950.715Stronger timbre lock (+0.017) and calm documentary pacing.
L18 (ত্রিশ দিন পর… কোটি টাকা!)0.91940.92610.7310.832LoRA wins big: Zero-Shot dropped opening word "ত্রিশ"; LoRA nailed every word and exclamation (+0.101 ASR).
L36 (AI / image / audio / bug)0.93750.90040.8150.804Both intelligible; LoRA sounds calmer and more conversational.
L71 (Curiosity hook স্মুথলি চলে কীভাবে?)0.91440.91220.6070.882LoRA wins decisively: Zero-Shot garbled "স্মুথলি" as "সুফ্টলি"; LoRA nailed "স্মুথলি চলে কীভাবে?" with rising curiosity inflection (+0.275 ASR).
L84 (Juktakkhor গ্রীষ্মের… বর্ষার)0.90960.91690.7490.723Crisp consonant clusters and warmer Bangladeshi vowel tone.
NEW_banglish (API, SQL, Lithium-ion, AI)0.90190.90740.7100.508*Ear audit caught ASR miss: LoRA articulated every acronym cleanly (এ-পি-আই, এস-কিউ-এল, লিথিয়াম আয়ন ব্যাটারি); Whisper dropped the middle clause.
NEW_cyber (open-source package + SQL)0.92320.91300.7960.796Live API smoke test sounded indistinguishable from a real studio recording.
NEW_physics (Brand-new astrophysics)0.92430.92910.8080.820Broadcast-grade documentary delivery (0.9291 speaker sim, 0.820 ASR).
9-Sentence Average0.91770.91320.75810.7628Major 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:

  1. Deterministic Banglish & Acronym Normalizer (bn_text_norm.py): Automatically expands SQL → এস-কিউ-এল, 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 with 0.22s pauses and 15ms fades.
  2. 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 a 0.90 ceiling limiter (-0.9 dBFS) eliminates clipping entirely.
  3. Lazy GPU Loading + /unload_models Lifecycle: Pinned to a dedicated serving GPU (RTX 2080 Ti), the FastAPI service idles at 0.0 MiB VRAM, loads the merged t3_custom_bn_v1_lora_merged.safetensors weights on demand during batch synthesis, and releases GPU VRAM back down to baseline (8.8 MiB verified live) the moment the client calls POST /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,noheader

Practical 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 than CC-BY-NC checkpoints.
  • 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.
voice cloningLoRAChatterboxBangla TTSlocal AIPyTorchaudio engineeringMIT license