Default the English model's temperature to 0.3 (#223)
## Motivation Human evaluations consistently prefer the English model at temperature **0.3** over the current default **0.7**, and the change is free on every objective axis we measured.
This commit is contained in:
@@ -37,14 +37,14 @@ The main class for text-to-speech generation.
|
||||
|
||||
#### Class Methods
|
||||
|
||||
##### `load_model(language=None, config=None, temp=0.7, lsd_decode_steps=1, noise_clamp=None, eos_threshold=-4.0, quantize=False)`
|
||||
##### `load_model(language=None, config=None, temp=None, lsd_decode_steps=1, noise_clamp=None, eos_threshold=-4.0, quantize=False)`
|
||||
|
||||
Load and return a TTSModel instance with pre-trained weights.
|
||||
|
||||
**Parameters:**
|
||||
- `language` (str | None): Name of built-in language config to load. Supported values: `"english_2026-01"`, `"english_2026-04"`, `"english"`, `"french_24l"`, `"german_24l"`, `"portuguese_24l"`, `"italian_24l"`, `"spanish_24l"`. If both `language` and `config` are omitted, defaults to `"english"`, which is the same model as `"english_2026-04"`. The "24l" variants are larger models that are not distilled yet and are here only as a preview.
|
||||
- `config` (str | None): Path to model config YAML file. Incompatible with `language`.
|
||||
- `temp` (float): Sampling temperature for generation (default: 0.7)
|
||||
- `temp` (float | None): Sampling temperature for generation. `None` uses the model's recommended default from its config file (`default_temperature`; 0.3 for the English model, 0.7 otherwise).
|
||||
- `lsd_decode_steps` (int): Number of generation steps (default: 1)
|
||||
- `noise_clamp` (float | None): Maximum value for noise sampling (default: None)
|
||||
- `eos_threshold` (float): Threshold for end-of-sequence detection (default: -4.0)
|
||||
|
||||
@@ -25,7 +25,7 @@ This will generate a WAV file `./tts_output.wav` with the default text and voice
|
||||
|
||||
- `--config CONFIG_PATH`: Path to custom config.yaml (for loading local model files). Incompatible with `--language`.
|
||||
- `--lsd-decode-steps LSD_DECODE_STEPS`: Number of generation steps (default: 1)
|
||||
- `--temperature TEMPERATURE`: Temperature for generation (default: 0.7)
|
||||
- `--temperature TEMPERATURE`: Temperature for generation (default: the model's recommended value from its config — 0.3 for the English model, 0.7 otherwise)
|
||||
- `--noise-clamp NOISE_CLAMP`: Noise clamp value (default: None)
|
||||
- `--eos-threshold EOS_THRESHOLD`: EOS threshold (default: -4.0)
|
||||
- `--frames-after-eos FRAMES_AFTER_EOS`: Number of frames to generate after EOS (default: None, auto-calculated based on the text length). Each frame is 80ms.
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
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
|
||||
# Human evals preferred this model at 0.3 (equal WER/similarity/speech rate).
|
||||
default_temperature: 0.3
|
||||
|
||||
|
||||
flow_lm:
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
weights_path: hf://kyutai/pocket-tts/languages/english_2026-04/model.safetensors@19f95fe2df36e79fbd9f10008595cc4c977a0fcc
|
||||
weights_path_without_voice_cloning: hf://kyutai/pocket-tts-without-voice-cloning/languages/english_2026-04/model.safetensors@d29db7978e464fb90cb3359ee0c69a273b9142cc
|
||||
# Human evals preferred this model at 0.3 (equal WER/similarity/speech rate).
|
||||
default_temperature: 0.3
|
||||
|
||||
|
||||
flow_lm:
|
||||
|
||||
+6
-3
@@ -20,7 +20,6 @@ from pocket_tts.default_parameters import (
|
||||
DEFAULT_FRAMES_AFTER_EOS,
|
||||
DEFAULT_LSD_DECODE_STEPS,
|
||||
DEFAULT_NOISE_CLAMP,
|
||||
DEFAULT_TEMPERATURE,
|
||||
MAX_TOKEN_PER_CHUNK,
|
||||
get_default_text_for_language,
|
||||
get_default_voice_for_language,
|
||||
@@ -261,8 +260,12 @@ def generate(
|
||||
int, typer.Option(help="Number of generation steps")
|
||||
] = DEFAULT_LSD_DECODE_STEPS,
|
||||
temperature: Annotated[
|
||||
float, typer.Option(help="Temperature for generation")
|
||||
] = DEFAULT_TEMPERATURE,
|
||||
float | None,
|
||||
typer.Option(
|
||||
help="Temperature for generation. Defaults to the model's recommended "
|
||||
"value from its config (0.3 for the English model, 0.7 otherwise)."
|
||||
),
|
||||
] = None,
|
||||
noise_clamp: Annotated[float, typer.Option(help="Noise clamp value")] = DEFAULT_NOISE_CLAMP,
|
||||
eos_threshold: Annotated[float, typer.Option(help="EOS threshold")] = DEFAULT_EOS_THRESHOLD,
|
||||
frames_after_eos: Annotated[
|
||||
|
||||
@@ -25,7 +25,6 @@ from pocket_tts.default_parameters import (
|
||||
DEFAULT_LANGUAGE,
|
||||
DEFAULT_LSD_DECODE_STEPS,
|
||||
DEFAULT_NOISE_CLAMP,
|
||||
DEFAULT_TEMPERATURE,
|
||||
MAX_TOKEN_PER_CHUNK,
|
||||
)
|
||||
from pocket_tts.models.flow_lm import FlowLMModel
|
||||
@@ -234,7 +233,7 @@ class TTSModel(nn.Module):
|
||||
cls,
|
||||
language: str | None = None,
|
||||
config: str | Path | None = None,
|
||||
temp: float | int = DEFAULT_TEMPERATURE,
|
||||
temp: float | int | None = None,
|
||||
lsd_decode_steps: int = DEFAULT_LSD_DECODE_STEPS,
|
||||
noise_clamp: float | int | None = DEFAULT_NOISE_CLAMP,
|
||||
eos_threshold: float = DEFAULT_EOS_THRESHOLD,
|
||||
@@ -253,7 +252,9 @@ class TTSModel(nn.Module):
|
||||
If neither `config` nor `language` is provided, defaults to `"english", which is the same model as 'english_2026-04'`.
|
||||
config: A path to a custom YAML config file saved locally (e.g., `"C://pocket_tts/pocket_tts_config.yaml"`).
|
||||
temp: Sampling temperature for generation. Higher values produce more
|
||||
diverse but potentially lower quality output.
|
||||
diverse but potentially lower quality output. If None, defaults to
|
||||
the model's recommended value from its config file
|
||||
(``default_temperature``, e.g. 0.3 for the English model).
|
||||
lsd_decode_steps: Number of steps for Lagrangian Self Distillation
|
||||
decoding. More steps can improve quality but increase computation.
|
||||
noise_clamp: Maximum value for noise sampling. If None, no clamping
|
||||
@@ -303,6 +304,8 @@ class TTSModel(nn.Module):
|
||||
raise ValueError("Config should be a path to a YAML file ending with .yaml")
|
||||
config_path = Path(config)
|
||||
config = load_config(config_path)
|
||||
if temp is None:
|
||||
temp = config.default_temperature
|
||||
logger.info(f"Loading model from config at {config_path}...")
|
||||
|
||||
tts_model = TTSModel._from_pydantic_config_with_weights(
|
||||
|
||||
@@ -116,6 +116,7 @@ class Config(StrictModel):
|
||||
pad_with_spaces_for_short_inputs: bool = False
|
||||
remove_semicolons: bool = False
|
||||
model_recommended_frames_after_eos: int | None = None
|
||||
default_temperature: float = 0.7
|
||||
|
||||
|
||||
def load_config(yaml_path: str | Path) -> Config:
|
||||
|
||||
Reference in New Issue
Block a user