File size: 2,828 Bytes
a4ee425
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
license: mpl-2.0
language:
- en
- pt
library_name: phoonnx
pipeline_tag: text-to-speech
tags:
- tts
- yourtts
- vits
- onnx
- phoonnx
- offline
- voice-cloning
---

# phoonnx-yourtts

Mirror of a YourTTS checkpoint exported to ONNX for
[phoonnx](https://github.com/TigreGotico/phoonnx), OpenVoiceOS's offline TTS
library. YourTTS is a multilingual VITS conditioned on an external 512-d
speaker d-vector rather than a speaker-id embedding, which is what enables
zero-shot voice cloning: a reference clip is run through a bundled speaker
encoder (`coqui_resnet`) to produce the d-vector that conditions synthesis.
See [`phoonnx/engines/yourtts.py`](https://github.com/TigreGotico/phoonnx/blob/dev/phoonnx/engines/yourtts.py)
and [docs/cloning.md](https://github.com/TigreGotico/phoonnx/blob/dev/docs/cloning.md).

This is the original multilingual YourTTS model
([Casanova et al., 2022](https://arxiv.org/abs/2112.02418)), trained by Coqui
on VCTK (English) and a Brazilian Portuguese corpus, with speaker d-vectors
for a fixed set of training speakers exposed as per-speaker config files.

**Note:** unlike the other `phoonnx-*` mirrors, this repository is not
currently wired into `phoonnx`'s packaged `voice_index` — there is no
`your-tts/*` entry shipped by `update-cache`/`list-voices` yet. The files are
present and the `yourtts` engine adapter is implemented and tested; load them
by path as shown below until a voice-index entry is published.

## Contents

- `your-tts/model.onnx` — the shared YourTTS ONNX graph (all speakers below use this one model)
- `configs/your-tts-en-spk0.json`, `-spk1.json`, `-spk2.json` — three bundled English (VCTK) training speakers, each with its own d-vector in `engine_params`
- `configs/your-tts-pt-spk0.json`, `-spk1.json`, `-spk2.json` — three bundled Brazilian Portuguese training speakers

## Usage

```python
import wave
from huggingface_hub import hf_hub_download
from phoonnx.voice import TTSVoice

model_path = hf_hub_download("OpenVoiceOS/phoonnx-yourtts", "your-tts/model.onnx")
config_path = hf_hub_download("OpenVoiceOS/phoonnx-yourtts", "configs/your-tts-en-spk0.json")

voice = TTSVoice.load(model_path, config_path)
with wave.open("out.wav", "wb") as wav_file:
    voice.synthesize_wav("Hello, this is a test.", wav_file)
```

Zero-shot cloning from your own reference clip (overrides the bundled
speaker) works the same way, passing `speaker_reference` to
`synthesize_wav` — see
[docs/cloning.md](https://github.com/TigreGotico/phoonnx/blob/dev/docs/cloning.md).

## License

YourTTS's pretrained weights were released by Coqui as part of the
`coqui-ai/TTS` model zoo under the MPL-2.0 license, the same license as the
Coqui TTS toolkit itself (this predates Coqui's later CPML non-commercial
license, introduced with XTTS). `phoonnx` itself is Apache-2.0.