惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Recent Announcements
Recent Announcements
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
O
OpenAI News
D
Docker
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
N
Netflix TechBlog - Medium
人人都是产品经理
人人都是产品经理
Y
Y Combinator Blog
M
MIT News - Artificial intelligence
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 司徒正美
C
CXSECURITY Database RSS Feed - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
K
Kaspersky official blog
Security Latest
Security Latest
T
Tailwind CSS Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
V
Vulnerabilities – Threatpost
W
WeLiveSecurity
N
News and Events Feed by Topic
aimingoo的专栏
aimingoo的专栏
美团技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Google DeepMind News
Google DeepMind News
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Cyber Attacks, Cyber Crime and Cyber Security
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
B
Blog
T
The Blog of Author Tim Ferriss
Google DeepMind News
Google DeepMind News
Help Net Security
Help Net Security
爱范儿
爱范儿
宝玉的分享
宝玉的分享
腾讯CDC
H
Heimdal Security Blog
Webroot Blog
Webroot Blog
AI
AI
WordPress大学
WordPress大学
Recorded Future
Recorded Future
SecWiki News
SecWiki News
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Security Archives - TechRepublic
Security Archives - TechRepublic
Google Online Security Blog
Google Online Security Blog
C
Check Point Blog
TaoSecurity Blog
TaoSecurity Blog
Cisco Talos Blog
Cisco Talos Blog
The Cloudflare Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - Franky
云风的 BLOG
云风的 BLOG

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Fine-tuning Chatterbox on a Low-Resource Language: 7 Things That Mattered
pekiskol · 2026-04-27 · via DEV Community

Fine-tuning Chatterbox on a Low-Resource Language: 7 Things That Mattered

Resemble AI's Chatterbox Multilingual TTS is one of the few SOTA open-source TTS models with a real MIT license — code and weights — so it's a natural starting point if you want to build a commercially usable text-to-speech for a language that the official model doesn't ship.

I fine-tuned it on Slovak. The 23 supported languages in the official multilingual checkpoint don't include it, and there was nothing comparable in the open-source ecosystem — every other halfway decent multilingual TTS I could find (XTTS-v2, F5-TTS, Fish Speech) ships under non-commercial licenses. So I trained my own and published the weights.

The TTS sits at the end of a larger pipeline I'm building — an end-to-end Slovak video-dubbing tool (Whisper for transcription, a fine-tuned Gemma 3 for translation, MuseTalk for lip-sync) — and Slovak TTS was the missing piece. That's the reason "good enough on a single sentence" wasn't good enough; I needed audio that holds up across hours of generated speech.

The fine-tuning itself isn't the hard part. The hard part is the dozen tiny things that turn a "weights file that loads" into "weights file that produces audio you'd actually ship." Here are the seven that mattered most for me.

This post assumes you already know what fine-tuning a TTS is and have a base Chatterbox setup running. It's the practical-tuning notes I wish someone had written before I started.


1. The base model and your fine-tune disagree on vocab size

Chatterbox uses a sentencepiece text tokenizer, and depending on training data your fine-tune may end up with a different vocab size than the base multilingual checkpoint. If you naively load_state_dict(strict=True) the T3 weights into the base model, you get a shape mismatch.

The fix is to pad or trim the affected matrices (text_emb.weight and text_head.weight) before loading:

state = load_safetensors(my_finetune_path, device="cpu")

target_vocab = model.t3.text_emb.weight.shape[0]
src_vocab = state["text_emb.weight"].shape[0]

if src_vocab > target_vocab:
    state["text_emb.weight"] = state["text_emb.weight"][:target_vocab, :]
    state["text_head.weight"] = state["text_head.weight"][:target_vocab, :]
elif src_vocab < target_vocab:
    pad = target_vocab - src_vocab
    emb_pad = state["text_emb.weight"].mean(dim=0, keepdim=True).repeat(pad, 1)
    head_pad = state["text_head.weight"].mean(dim=0, keepdim=True).repeat(pad, 1)
    state["text_emb.weight"] = torch.cat([state["text_emb.weight"], emb_pad], dim=0)
    state["text_head.weight"] = torch.cat([state["text_head.weight"], head_pad], dim=0)

model.t3.load_state_dict(state, strict=True)

Enter fullscreen mode Exit fullscreen mode

Padding with the row mean instead of zeros gives you a sensible "neutral" embedding for tokens the fine-tune never saw — better than zeros, which produce noise.


2. The reference audio matters more than you think

Chatterbox is a zero-shot voice-cloning model. You give it a few seconds of someone speaking, and the output mimics that voice. Most articles stop there. They don't tell you that whatever noise is in your reference clip will be baked into every generation.

I was using a 5.7-second Common Voice Slovak clip as the reference. The model output was almost perfect — but had a faint low-frequency hum throughout. Same hum that was in the reference, which I hadn't noticed until I heard it stretched across thirty seconds of generated audio.

The fix is to clean the reference before you pass it to the model. Here's the ffmpeg chain I ended up with (based on what's in my production pipeline):

ffmpeg -i reference.wav -af "
  highpass=f=70,
  afftdn=nr=12:nt=w:om=o,
  lowpass=f=11000,
  equalizer=f=6800:t=q:w=1.2:g=-1.5,
  silenceremove=start_periods=1:start_silence=0.04:start_threshold=-50dB,
  areverse,
  silenceremove=start_periods=1:start_silence=0.06:start_threshold=-46dB,
  areverse
" reference_clean.wav

Enter fullscreen mode Exit fullscreen mode

What each stage does:

  • highpass=70 removes mains hum and low-frequency rumble
  • afftdn is FFT-based broadband denoising (12 dB reduction is gentle — pushing it higher starts to make speech metallic)
  • lowpass=11000 cuts hiss above 11 kHz, which Chatterbox doesn't reproduce anyway
  • The equalizer notch around 6.8 kHz tames sibilance
  • The pair of silenceremove + areverse blocks trims silence from both ends without complicated edge-case handling

This matters because cloning is essentially a "voice colour transfer" — anything in the reference is part of the cloned voice. Garbage in, garbage out.


3. Generation parameters: defaults vs. tuned

The default model.generate() call works, but you can do better. After regression-testing on Slovak segments, I landed on these:

Param Default Tuned for stability Notes
exaggeration 0.5 0.5 Same
cfg_weight 0.5 0.5 Same
temperature 0.8 0.6 Lower → more stable, less variable
top_p 1.0 0.92 Cuts the long tail of low-prob samples
repetition_penalty 1.0 1.25 Prevents the model getting stuck on syllables

There's a real trade-off here: tuned parameters produce more consistent, less-likely-to-fail output, but they also flatten the prosody. The voice sounds slightly more monotone. For a production pipeline doing thousands of segments per day where any failure is worse than a slightly less expressive read, tuned wins. For a demo on a model card where you want one perfect take, default temperature with a deterministic seed and a retry loop wins.

RETRY_SEEDS = [42, 0, 123, 7, 99]
min_dur = max(0.3, len(text) / 25.0)

for seed in RETRY_SEEDS:
    torch.manual_seed(seed)
    wav = model.generate(text=text, language_id="sk")
    if wav.shape[-1] / model.sr >= min_dur:
        break

Enter fullscreen mode Exit fullscreen mode

The retry loop catches the cases where the model produces a too-short output (it sometimes EOSes early on hard inputs). If the first seed works, you stop; if not, try another. Five seeds is plenty in practice.


4. The first word can be garbage. Add a warmup prefix.

Generating "Slovenský jazyk je úradný..." would sometimes produce "Zvolenský jazyk..." — the model's first token after the reference would morph. Sometimes the entire first word would be quiet noise.

This is a "warmup" artifact: the model has to transition from the reference voice's prosody to its own generation, and that first ~0.3 s is where it can wobble. Hard words at position zero hit hardest.

Two fixes, both work:

Reword. If "Slovenský" trips the model, start with "Slovenčina" instead. Easy, free, doesn't always work.

Add a warmup prefix. Put a short, easy phrase at the start that the model can land on cleanly:

Vitajte v ukážke.
Slovenčina je úradný jazyk Slovenskej republiky.
...

Enter fullscreen mode Exit fullscreen mode

By the time the model reaches "Slovenčina," it has stabilised. The prefix becomes part of the generation but is short and natural, and you can always trim it in post if you don't want it.

This isn't unique to Chatterbox — most autoregressive TTS models have warmup behaviour at the very start. The fix transfers.


5. The model can't read out individual letter names

I tried generating "Má bohatú gramatiku, sedem pádov a špecifické hlásky ako ô, ľ alebo ŕ." — a sentence that names individual Slovak letters. The model produced nonsense for the letter-name part.

This is a known limitation of TTS models trained on running speech: they rarely see "the letter ô" as a phrase, so they don't know it should be pronounced as a name rather than as the sound itself. The same is true of acronyms ("NDA" gets read as "enda") and units ("20 %" sometimes becomes "two-hundred percent" because of how digit-percent pairs were tokenised in training data).

The fix is text normalisation before TTS. In my pipeline I have a small Slovak-specific preprocessor that rewrites:

  • 20 %dvadsať percent
  • Y100ypsilon sto
  • NDAeN-Dý-Á
  • Letter names → spelled-out phonetic forms

This lives as a preprocessing layer, not part of the model. It's easier to fix text once than to retrain the model to handle every edge case.


6. max_new_tokens matters for long generations

Chatterbox auto-scales the generation budget:

_max_toks = max_new_tokens or min(4096, max(1000, len(text) * 8))

Enter fullscreen mode Exit fullscreen mode

For a 350-character text that gives 2800 tokens, which sounds like plenty (at ~25 Hz token rate that's over 100 seconds of audio). But the model can EOS early on a particular word — even with a budget far above what the text needs. I had a 30-second narrative whose final word ("Amerike") got cut short despite a 4096-token budget.

When you have a long input, set max_new_tokens=4096 explicitly and check for premature EOS in postprocessing. If your output ends mid-word, treat it as a generation failure and retry with a different seed (see #3).

For very long inputs, a more reliable strategy is to chunk into sentences, generate each separately, and concatenate with a short crossfade. Chatterbox doesn't have first-class chunking yet, so you do this at the application layer.


7. Use prepare_conditionals separately from generate

The Chatterbox API supports passing audio_prompt_path= directly to generate(), but in a production loop where you're generating many segments with the same voice, it's faster to call prepare_conditionals once and reuse:

model.prepare_conditionals(reference_path)

# Now generate many times without re-loading reference each time
for text in texts:
    wav = model.generate(text=text, language_id="sk")

Enter fullscreen mode Exit fullscreen mode

The conditioning extracts speaker-identity features from the reference. Doing it once amortises the cost across the loop. For one-off demos it doesn't matter; for batch jobs it can shave noticeable time.

A related gotcha: if you switch reference voices mid-loop, remember to re-run prepare_conditionals (or null model.conds) before the next generation, or you'll keep cloning the previous voice.


Final recipe

Putting it together — the inference snippet I'd hand to someone starting fresh:

import torch, torchaudio, subprocess
from chatterbox.mtl_tts import ChatterboxMultilingualTTS
from safetensors.torch import load_file

device = "cuda" if torch.cuda.is_available() else "cpu"

# 1. Clean the reference
subprocess.run([
    "ffmpeg", "-y", "-i", "reference.wav",
    "-af",
    "highpass=f=70,afftdn=nr=12,lowpass=f=11000,"
    "equalizer=f=6800:t=q:w=1.2:g=-1.5,"
    "silenceremove=start_periods=1:start_silence=0.04:start_threshold=-50dB,"
    "areverse,silenceremove=start_periods=1:start_silence=0.06:start_threshold=-46dB,"
    "areverse",
    "reference_clean.wav",
], check=True)

# 2. Load base + patch in fine-tune
model = ChatterboxMultilingualTTS.from_pretrained(device=device)
state = load_file("my_finetune_t3.safetensors", device="cpu")
# vocab resize block from #1 here
model.t3.load_state_dict(state, strict=True)
model.t3.to(device).eval()

# 3. Prepare reference once
model.prepare_conditionals("reference_clean.wav")

# 4. Generate with retry
text = "Vitajte v ukážke. " + your_actual_text  # warmup prefix from #4
RETRY_SEEDS = [42, 0, 123, 7, 99]
min_dur = max(0.3, len(text) / 25.0)

wav = None
for seed in RETRY_SEEDS:
    torch.manual_seed(seed)
    with torch.inference_mode():
        candidate = model.generate(text=text, language_id="sk", max_new_tokens=4096)
    if candidate.shape[-1] / model.sr >= min_dur:
        wav = candidate
        break

torchaudio.save("output.wav", wav.cpu(), model.sr)

Enter fullscreen mode Exit fullscreen mode

This is roughly what's running in my pipeline today.


What didn't work

A few things I tried that turned out to be dead ends, in case you're tempted by them:

  • Aggressive denoising of the reference (FFT noise reduction at -18 dB or higher). Removes hum reliably but starts producing a metallic, "phasey" cloned voice. -12 dB is the sweet spot.
  • temperature=0.4 or below. Flattens prosody to the point of sounding like a robocall.
  • Skipping the warmup prefix and trimming the first 0.3 s in post. Works most of the time, but occasionally cuts the start of an actually-clean first word. The prefix is more reliable.
  • Trying to fix the EOS-early problem with repetition_penalty=1.5 or higher. Did not help; the model's stop decision is upstream of repetition logic.

Wrapping up

If you're fine-tuning Chatterbox on a language it doesn't ship, the biggest things you can do outside the training loop are:

  1. Clean your reference audio
  2. Tune your generation params (or accept the defaults' trade-offs)
  3. Normalise your text before it reaches the model
  4. Use a warmup prefix for the first word
  5. Set max_new_tokens explicitly and have a retry path

The Slovak fine-tune lives at huggingface.co/pekiskol/chatterbox-tts-slovak under MIT — drop in the inference snippet above and it should work out of the box. Feedback (or different language fine-tunes that hit the same gotchas) welcome on the model's HF discussions tab.

If you've discovered other Chatterbox tuning tricks I missed, leave a comment — I'd like to extend this list.


The code in this post is also in the release scripts on the model page.