Skip to content

A TTS that fits in your CPU (and pocket)

Python

english_2026-09: robustness fine-tune (mid-word prompt cuts, unpunctuated text) as the default English model (#311)

manu-lm270aef929046
diff --git a/pocket_tts/config/english.yaml b/pocket_tts/config/english.yaml
index e01ff31..df05900 100644
--- a/pocket_tts/config/english.yaml
+++ b/pocket_tts/config/english.yaml
@@ -1,7 +1,7 @@
-# sig: a0ac5076.yaml
+# Default English model: identical weights to english_2026-09.yaml.
-weights_path: hf://kyutai/pocket-tts/languages/english/model.safetensors@39592ff23c9ef80098bb74895d104c26275fe2c9
-weights_path_without_voice_cloning: hf://kyutai/pocket-tts-without-voice-cloning/languages/english/model.safetensors@d29db7978e464fb90cb3359ee0c69a273b9142cc
+weights_path: hf://kyutai/pocket-tts/languages/english/model.safetensors@983151f13aaeab1b13c1e5e3c2c383d49a9edf3f
+weights_path_without_voice_cloning: hf://kyutai/pocket-tts-without-voice-cloning/languages/english/model.safetensors@e7205b6ee50e654a5ea19f0e9df2b0813b05e921
# Human evals preferred this model at 0.3 (equal WER/similarity/speech rate).
default_temperature: 0.3
diff --git a/pocket_tts/config/english_2026-09.yaml b/pocket_tts/config/english_2026-09.yaml
new file mode 100644
index 0000000..15ebc97
--- /dev/null
+++ b/pocket_tts/config/english_2026-09.yaml
@@ -0,0 +1,65 @@
+# english_2026-04 re-distilled from a robustness-fine-tuned 24-layer teacher
+# (training/configs/robustness_redistill.yaml): voice prompts cut mid-word and text
+# without final punctuation are in distribution.
+
+weights_path: hf://kyutai/pocket-tts/languages/english_2026-09/model.safetensors@983151f13aaeab1b13c1e5e3c2c383d49a9edf3f
+weights_path_without_voice_cloning: hf://kyutai/pocket-tts-without-voice-cloning/languages/english_2026-09/model.safetensors@e7205b6ee50e654a5ea19f0e9df2b0813b05e921
+# Human evals preferred this model at 0.3 (equal WER/similarity/speech rate).
+default_temperature: 0.3
+
+
+flow_lm:
+ insert_bos_before_voice: true
+ dtype: float32
+ flow:
+ depth: 6
+ dim: 512
+ transformer:
+ d_model: 1024
+ hidden_scale: 4
+ max_period: 10000
+ num_heads: 16
+ num_layers: 6
+ lookup_table:
+ dim: 1024
+ n_bins: 4000
+ tokenizer: sentencepiece
+ tokenizer_path: hf://kyutai/pocket-tts-without-voice-cloning/languages/english_2026-09/tokenizer.model@e7205b6ee50e654a5ea19f0e9df2b0813b05e921
+ #weights_path: final.safetensors
+
+mimi:
+ dtype: float32
+ sample_rate: 24000
+ inner_dim: 32
+ outer_dim: 512
+ channels: 1
+ frame_rate: 12.5
+ seanet:
+ dimension: 512
+ channels: 1
+ n_filters: 64
+ n_residual_layers: 1
+ ratios:
+ - 6
+ - 5
+ - 4
+ kernel_size: 7
+ residual_kernel_size: 3
+ last_kernel_size: 3
+ dilation_base: 2
+ pad_mode: constant
+ compress: 2
+ transformer:
+ d_model: 512
+ num_heads: 8
+ num_layers: 2
+ layer_scale: 0.01
+ context: 250
+ dim_feedforward: 2048
+ input_dimension: 512
+ output_dimensions:
+ - 512
+ quantizer:
+ dimension: 32
+ output_dimension: 512
+ #weights_path: codec.safetensors
diff --git a/pocket_tts/config/english_2026-09_24l.yaml b/pocket_tts/config/english_2026-09_24l.yaml
new file mode 100644
index 0000000..33c13fc
--- /dev/null
+++ b/pocket_tts/config/english_2026-09_24l.yaml
@@ -0,0 +1,57 @@
+# english_2026-04_24l after training/configs/robustness_finetune.yaml (sampler head frozen).
+weights_path: hf://kyutai/pocket-tts/languages/english_2026-09_24l/model.safetensors@983151f13aaeab1b13c1e5e3c2c383d49a9edf3f
+weights_path_without_voice_cloning: hf://kyutai/pocket-tts-without-voice-cloning/languages/english_2026-09_24l/model.safetensors@e7205b6ee50e654a5ea19f0e9df2b0813b05e921
+
+default_temperature: 0.3
+flow_lm:
+ insert_bos_before_voice: true
+ dtype: float32
+ flow:
+ depth: 6
+ dim: 512
+ transformer:
+ d_model: 1024
+ hidden_scale: 4
+ max_period: 10000
+ num_heads: 16
+ num_layers: 24
+ lookup_table:
+ dim: 1024
+ n_bins: 4000
+ tokenizer: sentencepiece
+ tokenizer_path: hf://kyutai/pocket-tts-without-voice-cloning/languages/english_2026-09_24l/tokenizer.model@e7205b6ee50e654a5ea19f0e9df2b0813b05e921
+mimi:
+ dtype: float32
+ sample_rate: 24000
+ inner_dim: 32
+ outer_dim: 512
+ channels: 1
+ frame_rate: 12.5
+ seanet:
+ dimension: 512
+ channels: 1
+ n_filters: 64
+ n_residual_layers: 1
+ ratios:
+ - 6
+ - 5
+ - 4
+ kernel_size: 7
+ residual_kernel_size: 3
+ last_kernel_size: 3
+ dilation_base: 2
+ pad_mode: constant
+ compress: 2
+ transformer:
+ d_model: 512
+ num_heads: 8
+ num_layers: 2
+ layer_scale: 0.01
+ context: 250
+ dim_feedforward: 2048
+ input_dimension: 512
+ output_dimensions:
+ - 512
+ quantizer:
+ dimension: 32
+ output_dimension: 512
diff --git a/training/args.py b/training/args.py
index ddac7c3..cacf3a5 100644
--- a/training/args.py
+++ b/training/args.py
@@ -23,6 +23,13 @@ class DataArgs:
# so prompts vary in length and the target keeps most of the utterance.
# <= 0 removes the window (any word boundary; full-prefix prompt).
max_voice_prompt_sec: float = 5.0
+ # Robustness augmentations, on by default at the values the released models used.
+ # prompt_trim_max_sec trims a uniform 0..N seconds off the end of every voice prompt
+ # (prompts cut mid-word at inference stay in distribution); final_punct_dropout drops
+ # the target text's final period with this probability (unpunctuated prompts stay in
+ # distribution). Set to 0 to disable.
+ prompt_trim_max_sec: float = 0.5
+ final_punct_dropout: float = 0.3
shuffle: bool = True
# Loader subprocesses per rank. Each one is GIL-bound at ~90 samples/s from
# network storage (extra IO threads do not help), and a rank consumes
@@ -77,6 +84,9 @@ class TrainArgs:
# If false, only Mimi/tokenizer weights are used and the FlowLM is
# re-initialized (training from scratch).
start_from_pretrained: bool = True
+ # Freeze the sampler head (flow_net) during a fine-tune so the latent geometry a
+ # distilled student was trained against is preserved.
+ freeze_head: bool = False
# Load the pretrained weights but start the text embedding from scratch.
# Needed when the tokenizer differs from the one the weights were trained
# with, e.g. when training for a new language.
@@ -141,6 +151,10 @@ class TrainArgs:
# Use the teacher checkpoint's EMA shadow as the regression target (falls
# back to raw weights when the checkpoint carries no EMA).
distill_teacher_use_ema: bool = True
+ # Warm-start the student's backbone and conditioning from these weights (a training
+ # checkpoint, or a released model.safetensors, local or hf://) instead of the
+ # teacher's bottom+top layers; the per-frame heads still come from the teacher.
+ student_init_from: str = ""
# Which teacher layers seed the student backbone: "spaced" (evenly across
# the depth) or "first" (the bottom N). No evidence either way -- "first"
# keeps the early feature extractors contiguous.
diff --git a/training/dataloader/loader.py b/training/dataloader/loader.py
index af73560..f49f103 100644
--- a/training/dataloader/loader.py
+++ b/training/dataloader/loader.py
@@ -10,6 +10,7 @@ import json
import logging
import queue
import random
+import re
import threading
from collections.abc import Callable, Iterator
from concurrent.futures import ThreadPoolExecutor
@@ -46,6 +47,10 @@ def _prefetch(iterator: Iterator[Batch], depth: int = 4) -> Iterator[Batch]:
class DataLoader:
+ # Augmentation knobs; class defaults keep instances built without __init__ (tests) valid.
+ prompt_trim_max_sec: float = 0.0
+ final_punct_dropout: float = 0.0
+
def __init__(
self,
jsonl: str,
@@ -61,6 +66,8 @@ class DataLoader:
shuffle: bool = True,
io_workers: int = 16,
num_bucket_batches: int = 1,
+ prompt_trim_max_sec: float = 0.0,
+ final_punct_dropout: float = 0.0,
):
self.jsonl = jsonl
self.num_bucket_batches = num_bucket_batches
@@ -71,6 +78,8 @@ class DataLoader:
self.frame_rate = frame_rate
self.max_duration_sec = max_duration_sec
self.max_voice_prompt_sec = max_voice_prompt_sec
+ self.prompt_trim_max_sec = prompt_trim_max_sec
+ self.final_punct_dropout = final_punct_dropout
self.shuffle = shuffle
self.io_workers = io_workers
self._failures = 0
@@ -92,8 +101,19 @@ class DataLoader:
if self.max_voice_prompt_sec > 0:
prompt_samples = int(self.max_voice_prompt_sec * self.sample_rate)
prompt = prompt[:prompt_samples]
+ if self.prompt_trim_max_sec > 0:
+ drop = int(self.rng.uniform(0.0, self.prompt_trim_max_sec) * self.sample_rate)
+ prompt = prompt[: max(len(prompt) - drop, min(len(prompt), self.sample_rate))]
return prompt, len(prompt)
+ def _tokens(self, text: str) -> torch.Tensor:
+ """Tokenize the target text, dropping a final period with probability
+ final_punct_dropout so unpunctuated prompts are in distribution. Only the
+ period goes: "?" and "!" change how the sentence is said."""
+ if self.final_punct_dropout > 0 and self.rng.random() < self.final_punct_dropout:
+ text = re.sub(r"\.\s*$", "", text) or text
+ return torch.tensor(self.tokenize(text), dtype=torch.long)
+
@staticmethod
def _last_word_end(entry: Entry) -> float | None:
"""End of the last aligned word, i.e. where the speech actually stops.
@@ -146,7 +166,7 @@ class DataLoader:
chosen = self._choose_cut(entry)
if chosen is not None:
cut, text = chosen
- tokens = torch.tensor(self.tokenize(text), dtype=torch.long)
+ tokens = self._tokens(text)
# Trim to the last word (plus a short tail) rather than the end
# of the file: 12% of utterances carry >1s of trailing silence,
# and training on it teaches the model to emit silence instead of
@@ -172,7 +192,7 @@ class DataLoader:
end = min(entry.duration, last + self.TRAIL_SEC) if last is not None else entry.duration
duration = min(end, self.max_duration_sec)
wav = audio._load_window(entry.path, entry.start, duration, self.sample_rate)
- tokens = torch.tensor(self.tokenize(entry.transcript), dtype=torch.long)
+ tokens = self._tokens(entry.transcript)
# No alignment: voice prompt from a random window of the same file.
fallback_sec = self.max_voice_prompt_sec if self.max_voice_prompt_sec > 0 else 3.0
prompt_start = self.rng.uniform(0, max(0.0, entry.duration - fallback_sec))
@@ -213,9 +233,17 @@ class DataLoader:
else stored
)
if cut_frames > 0:
- return lat[: min(cut_frames, cap)]
+ return self._trim_prompt_frames(lat[: min(cut_frames, cap)])
start = self.rng.randint(0, max(0, stored - cap))
- return lat[start : start + cap]
+ return self._trim_prompt_frames(lat[start : start + cap])
+
+ def _trim_prompt_frames(self, prompt: torch.Tensor) -> torch.Tensor:
+ """Drop a uniform 0..prompt_trim_max_sec tail (in frames), keeping >= 1 s."""
+ if self.prompt_trim_max_sec <= 0:
+ return prompt
+ drop = self.rng.randint(0, int(round(self.prompt_trim_max_sec * self.frame_rate)))
+ keep = max(prompt.shape[0] - drop, min(prompt.shape[0], int(self.frame_rate)))
+ return prompt[:keep]
def _sample_latent(self, entry: Entry) -> tuple[Any, ...]:
"""(stitch wav, tokens, prompt latents, tail latents, target frames)."""
@@ -223,7 +251,7 @@ class DataLoader:
assert entry.latents_file is not None, f"{entry.path}: not a latents entry"
lat = self._load_latents(entry.latents_file)
cut_frames, text = self._latent_cut(entry, lat.shape[0])
- tokens = torch.tensor(self.tokenize(text), dtype=torch.long)
+ tokens = self._tokens(text)
target_frames = self._latent_target_frames(entry, cut_frames, lat.shape[0])
stitch_frames = min(self.stitch_frames, target_frames)
stitch = audio._load_window(
diff --git a/training/dataloader/subproc.py b/training/dataloader/subproc.py
index fc62af8..7030d50 100644
--- a/training/dataloader/subproc.py
+++ b/training/dataloader/subproc.py
@@ -52,6 +52,8 @@ class SubprocessDataLoader:
num_procs: int = 6,
depth: int = 8,
num_bucket_batches: int = 1,
+ prompt_trim_max_sec: float = 0.0,
+ final_punct_dropout: float = 0.0,
):
ctx = torch_mp.get_context("spawn")
self._queue = ctx.Queue(maxsize=depth)
@@ -70,6 +72,8 @@ class SubprocessDataLoader:
"shuffle": shuffle,
"io_workers": io_workers,
"num_bucket_batches": num_bucket_batches,
+ "prompt_trim_max_sec": prompt_trim_max_sec,
+ "final_punct_dropout": final_punct_dropout,
}
proc = ctx.Process(
target=_feed_queue,
diff --git a/training/modules/builders.py b/training/modules/builders.py
index 624fbef..1ec2658 100644
--- a/training/modules/builders.py
+++ b/training/modules/builders.py
@@ -79,14 +79,7 @@ def attach_distillation(model: TrainableTTS, flow_lm: FlowLMModel, args: TrainAr
t_args.distill_cfg_coef = 0.0
t_args.start_from_pretrained = False
teacher = build_models(t_args)[0].flow_lm
- payload = torch.load(args.distill_teacher_weights, map_location="cpu", weights_only=True)
- state = dict(payload.get("model", payload))
- if args.distill_teacher_use_ema and payload.get("ema"):
- # The shadow tracks trainable params only; buffers stay raw.
- state.update(payload["ema"])
- state = {
- k.removeprefix("flow_lm."): v for k, v in state.items() if k.startswith("flow_lm.")
- }
+ state = _load_flow_lm_state(args.distill_teacher_weights, args.distill_teacher_use_ema)
teacher.load_state_dict(state, strict=True)
teacher = teacher.eval()
# Seed the student from the teacher: non-backbone tensors verbatim,
@@ -99,6 +92,18 @@ def attach_distillation(model: TrainableTTS, flow_lm: FlowLMModel, args: TrainAr
for k, v in seeded.items()
if k in student_state and student_state[k].shape == v.shape
}
+ if args.student_init_from:
+ src = _load_flow_lm_state(args.student_init_from, use_ema=False)
+ copied.update(
+ {
+ k: v
+ for k, v in src.items()
+ if not k.startswith(("flow_net.", "out_eos."))
+ and k in student_state
+ and student_state[k].shape == v.shape
+ }
+ )
+ logger.info(f"student backbone seeded from {args.student_init_from}")
flow_lm.load_state_dict(copied, strict=False)
logger.info(
f"depth distillation: teacher={args.distill_teacher_config}, "
@@ -125,6 +130,21 @@ def attach_distillation(model: TrainableTTS, flow_lm: FlowLMModel, args: TrainAr
disable_grad(model.flow)
+def _load_flow_lm_state(path: str, use_ema: bool) -> dict[str, torch.Tensor]:
+ """FlowLM tensors (without the "flow_lm." prefix) from a training checkpoint or a
+ released model.safetensors, local or hf://. With use_ema the checkpoint's EMA shadow
+ overrides the raw weights it tracks."""
+ file = download_if_necessary(path)
+ if file.suffix == ".safetensors":
+ state = safetensors.torch.load_file(str(file))
+ else:
+ payload = torch.load(file, map_location="cpu", weights_only=True)
+ state = dict(payload.get("model", payload))
+ if use_ema and payload.get("ema"):
+ state.update(payload["ema"])
+ return {k.removeprefix("flow_lm."): v for k, v in state.items() if k.startswith("flow_lm.")}
+
+
def build_models(args: TrainArgs) -> tuple[TrainableTTS, MimiModel, Config]:
"""Build (trainable model, frozen mimi, pocket config) from a pocket-tts config."""
config = load_model_config(args.model_config, args.model_overrides)
diff --git a/training/train.py b/training/train.py
index 95390e3..5ccbc37 100644
--- a/training/train.py
+++ b/training/train.py
@@ -112,6 +112,10 @@ def setup(config_path: str) -> Run:
save_args(args, run_dir / "args.yaml")
model, mimi, _config = build_models(args)
+ if args.freeze_head:
+ for name, p in model.named_parameters():
+ if "flow_net." in name:
+ p.requires_grad_(False)
model.to(device)
mimi.to(device)
ensure_train_latents(args, mimi, device, rank, world_size)
@@ -190,6 +194,8 @@ def main(config_path: str):
shuffle=args.data.shuffle,
num_procs=args.data.loader_procs,
num_bucket_batches=args.data.num_bucket_batches,
+ prompt_trim_max_sec=args.data.prompt_trim_max_sec,
+ final_punct_dropout=args.data.final_punct_dropout,
)
)