Text-to-Speech
Transformers
ONNX
teratts_onnx
feature-extraction
onnxruntime
russian
english
custom-code
custom_code
Instructions to use TeraSpace/TeraTTSv2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TeraSpace/TeraTTSv2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-to-speech", model="TeraSpace/TeraTTSv2", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("TeraSpace/TeraTTSv2", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Document automatic stress and cross-language duration guidance
Browse files- README.md +18 -0
- config.json +2 -0
- configuration_teratts.py +6 -0
README.md
CHANGED
|
@@ -18,6 +18,13 @@ streamed audio output.
|
|
| 18 |
This release uses the clean English/Russian 25-second teacher and its matching
|
| 19 |
eight-step CFG-3 distilled student.
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
## Installation
|
| 22 |
|
| 23 |
```bash
|
|
@@ -107,6 +114,17 @@ words and applies deterministic `ё` replacements, while unknown words and
|
|
| 107 |
ambiguous homographs are left unchanged. Set `russian_stress=False` to disable
|
| 108 |
automatic Russian stress processing entirely.
|
| 109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
## Stream audio
|
| 111 |
|
| 112 |
```python
|
|
|
|
| 18 |
This release uses the clean English/Russian 25-second teacher and its matching
|
| 19 |
eight-step CFG-3 distilled student.
|
| 20 |
|
| 21 |
+
> **Important — Russian stress is automatic.** Text inside `<ru>…</ru>` receives
|
| 22 |
+
> stress markers automatically by default. Explicit `+` markers always win.
|
| 23 |
+
>
|
| 24 |
+
> **Important — cross-language prompts.** When an English reference voice is
|
| 25 |
+
> speaking Russian, experiment with `duration_scale` below `1` (for example
|
| 26 |
+
> `0.8`). It is usually a better starting point than the default `1`.
|
| 27 |
+
|
| 28 |
## Installation
|
| 29 |
|
| 30 |
```bash
|
|
|
|
| 114 |
ambiguous homographs are left unchanged. Set `russian_stress=False` to disable
|
| 115 |
automatic Russian stress processing entirely.
|
| 116 |
|
| 117 |
+
When using an English voice such as `eng_f3` for Russian text, start by trying
|
| 118 |
+
`duration_scale=0.8` and adjust by ear:
|
| 119 |
+
|
| 120 |
+
```python
|
| 121 |
+
waveform = tts.generate_speech(
|
| 122 |
+
"<ru>Это русский текст английским голосом.</ru>",
|
| 123 |
+
voice="eng_f3",
|
| 124 |
+
duration_scale=0.8,
|
| 125 |
+
)
|
| 126 |
+
```
|
| 127 |
+
|
| 128 |
## Stream audio
|
| 129 |
|
| 130 |
```python
|
config.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
| 1 |
{
|
| 2 |
"architectures": ["TeraTTSModel"],
|
|
|
|
| 3 |
"auto_map": {
|
| 4 |
"AutoConfig": "configuration_teratts.TeraTTSConfig",
|
| 5 |
"AutoModel": "modeling_teratts.TeraTTSModel"
|
| 6 |
},
|
| 7 |
"default_diffusion_model": "distilled",
|
| 8 |
"default_voice": "ru_f1",
|
|
|
|
| 9 |
"model_type": "teratts_onnx",
|
| 10 |
"sample_rate": 44100,
|
| 11 |
"voices": ["eng_f3", "eng_f4_whisper", "eng_f5", "eng_m2_whisper", "eng_m3", "eng_m4", "ru_f1", "ru_f2", "ru_m1", "ru_m5"]
|
|
|
|
| 1 |
{
|
| 2 |
"architectures": ["TeraTTSModel"],
|
| 3 |
+
"automatic_russian_stress": true,
|
| 4 |
"auto_map": {
|
| 5 |
"AutoConfig": "configuration_teratts.TeraTTSConfig",
|
| 6 |
"AutoModel": "modeling_teratts.TeraTTSModel"
|
| 7 |
},
|
| 8 |
"default_diffusion_model": "distilled",
|
| 9 |
"default_voice": "ru_f1",
|
| 10 |
+
"cross_language_prompt_note": "For an English reference voice speaking Russian, try duration_scale below 1.0.",
|
| 11 |
"model_type": "teratts_onnx",
|
| 12 |
"sample_rate": 44100,
|
| 13 |
"voices": ["eng_f3", "eng_f4_whisper", "eng_f5", "eng_m2_whisper", "eng_m3", "eng_m4", "ru_f1", "ru_f2", "ru_m1", "ru_m5"]
|
configuration_teratts.py
CHANGED
|
@@ -12,6 +12,10 @@ class TeraTTSConfig(PretrainedConfig):
|
|
| 12 |
default_diffusion_model: str = "distilled",
|
| 13 |
default_voice: str = "ru_f1",
|
| 14 |
voices: list[str] | None = None,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
**kwargs,
|
| 16 |
) -> None:
|
| 17 |
super().__init__(**kwargs)
|
|
@@ -19,3 +23,5 @@ class TeraTTSConfig(PretrainedConfig):
|
|
| 19 |
self.default_diffusion_model = default_diffusion_model
|
| 20 |
self.default_voice = default_voice
|
| 21 |
self.voices = voices or []
|
|
|
|
|
|
|
|
|
| 12 |
default_diffusion_model: str = "distilled",
|
| 13 |
default_voice: str = "ru_f1",
|
| 14 |
voices: list[str] | None = None,
|
| 15 |
+
automatic_russian_stress: bool = True,
|
| 16 |
+
cross_language_prompt_note: str = (
|
| 17 |
+
"For an English reference voice speaking Russian, try duration_scale below 1.0."
|
| 18 |
+
),
|
| 19 |
**kwargs,
|
| 20 |
) -> None:
|
| 21 |
super().__init__(**kwargs)
|
|
|
|
| 23 |
self.default_diffusion_model = default_diffusion_model
|
| 24 |
self.default_voice = default_voice
|
| 25 |
self.voices = voices or []
|
| 26 |
+
self.automatic_russian_stress = automatic_russian_stress
|
| 27 |
+
self.cross_language_prompt_note = cross_language_prompt_note
|