itriedcoding commited on
Commit
795315f
Β·
verified Β·
1 Parent(s): ae5b267

Add model card for Sol

Browse files
Files changed (1) hide show
  1. README.md +77 -60
README.md CHANGED
@@ -1,113 +1,130 @@
1
  ---
2
- language: en
 
 
 
 
 
 
 
3
  license: apache-2.0
4
  library_name: transformers
5
  pipeline_tag: text-to-speech
6
- base_model: microsoft/speecht5_tts
7
- datasets:
8
- - openslr/librispeech_asr
9
  tags:
10
  - text-to-speech
11
  - tts
 
12
  - speecht5
 
13
  - sol
14
- - speech-synthesis
15
  ---
16
 
17
  # Sol
18
 
19
- **Sol** is a text-to-speech model that turns written text into clear, natural
20
- sounding speech. It is a `SpeechT5` acoustic model that was **fine-tuned on
21
- public voice data** (a single-speaker subset of
22
- [LibriSpeech](https://www.openslr.org/12), speaker `2277`) and paired with the
23
- open `speecht5_hifigan` neural vocoder.
24
 
25
- Sol was trained end-to-end by this project β€” data collection, preprocessing,
26
- fine-tuning, evaluation and packaging β€” and it runs on CPU.
27
 
28
- ## Model details
 
 
 
 
29
 
30
- | | |
31
- |---|---|
32
- | Architecture | SpeechT5 (Transformer encoder–decoder TTS + HiFi-GAN vocoder) |
33
- | Base checkpoint | [`microsoft/speecht5_tts`](https://huggingface.co/microsoft/speecht5_tts) |
34
- | Vocoder | [`microsoft/speecht5_hifigan`](https://huggingface.co/microsoft/speecht5_hifigan) |
35
- | Training data | LibriSpeech `clean` / `validation`, speaker `2277` (public) |
36
- | Utterances | 87 |
37
- | Fine-tune | light: 80 optimizer steps, AdamW, lr 2e-6 (CPU) |
38
- | Voice | single speaker x-vector (`speaker_embedding.npy`, shipped) |
39
- | Sampling rate | 16 kHz |
40
- | Language | English |
41
 
42
- ## Quality
43
 
44
- Generated speech is **clean and intelligible**. On the six example clips below,
45
- Whisper (`openai/whisper-tiny`) transcribes Sol's output at **~6.5% WER**, with
46
- several clips at 0% error. Outputs are trimmed of silence and peak-normalised.
 
 
 
 
 
 
 
47
 
48
- ## Example audio
 
49
 
50
- These clips were generated by Sol:
51
 
52
- <audio controls src="examples/hello.mp3"></audio>
 
 
 
 
 
53
 
54
- > "hello, i am sol. i can turn any text you give me into natural sounding speech."
 
 
 
 
 
55
 
56
- <audio controls src="examples/about.mp3"></audio>
57
 
58
- > "sol is a small, open text to speech model, fine tuned on public domain voice recordings."
59
 
60
- <audio controls src="examples/ai.mp3"></audio>
 
61
 
62
- > "artificial intelligence is changing how we create and interact with sound."
 
 
63
 
64
- More clips are in the [`examples/`](./examples) folder.
65
 
66
- ## Usage
 
 
67
 
68
  ```python
69
- import numpy as np
70
- import soundfile as sf
71
- import torch
72
  from transformers import SpeechT5ForTextToSpeech, SpeechT5HifiGan, SpeechT5Processor
73
 
74
  repo = "itriedcoding/Sol"
75
 
76
  processor = SpeechT5Processor.from_pretrained(repo)
77
- model = SpeechT5ForTextToSpeech.from_pretrained(repo)
78
- vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan")
79
 
80
- # Sol's voice is shipped with the model
81
  speaker = torch.tensor(np.load("speaker_embedding.npy")).unsqueeze(0)
82
 
83
- text = "hello, i am sol."
84
- inputs = processor(text=text, return_tensors="pt")
85
-
86
  with torch.no_grad():
87
  speech = model.generate_speech(inputs["input_ids"], speaker, vocoder=vocoder)
88
 
89
  sf.write("sol.wav", speech.numpy(), samplerate=16000)
90
  ```
91
 
92
- > **Tip:** keep the speaker embedding at its original scale. It is an
93
- > x-vector with norm β‰ˆ 320 β€” do **not** unit-normalise it, or the speaker
94
- > conditioning weakens and the audio degrades.
 
 
 
 
 
95
 
96
  ## Intended use & limitations
97
 
98
- - **Intended use:** research, prototyping and demos of English speech synthesis.
99
- - **Limitations:** single English speaker; no multi-speaker or multilingual
100
- support; may mispronounce rare names, numbers and unusual punctuation.
101
- - Output is not a human voice and must not be presented as one, nor used for
102
- impersonation or deceptive audio.
103
 
104
- ## Training data & credits
105
 
106
- - Voice data: [LibriSpeech](https://www.openslr.org/12) (`openslr/librispeech_asr`), CC BY 4.0.
 
107
  - Base model & vocoder: Microsoft Research Asia, via πŸ€— Transformers.
108
- - Fine-tuned and packaged by the **Sol** project.
109
 
110
  ## License
111
 
112
- Apache-2.0, following the base model. Please respect the original dataset and
113
- base-model licenses.
 
1
  ---
2
+ language:
3
+ - en
4
+ - es
5
+ - fr
6
+ - hi
7
+ - it
8
+ - pt
9
+ - zh
10
  license: apache-2.0
11
  library_name: transformers
12
  pipeline_tag: text-to-speech
 
 
 
13
  tags:
14
  - text-to-speech
15
  - tts
16
+ - multilingual
17
  - speecht5
18
+ - kokoro
19
  - sol
 
20
  ---
21
 
22
  # Sol
23
 
24
+ **Sol** is an open text-to-speech engine: type text, get clear speech.
 
 
 
 
25
 
26
+ It comes in two parts:
 
27
 
28
+ 1. **The live engine** β€” a multilingual, multi-voice TTS service running on
29
+ [Kokoro-82M](https://huggingface.co/hexgrad/Kokoro-82M) with **49 voices across
30
+ 8 languages**. Self-hosted, CPU-only, and reachable 24/7.
31
+ 2. **Sol v1** β€” a `SpeechT5` acoustic model we fine-tuned on public
32
+ LibriSpeech voice data, whose weights live in **this repository**.
33
 
34
+ **Live demo:** <https://sol-tts.vercel.app> β€” type a prompt and hear it speak.
 
 
 
 
 
 
 
 
 
 
35
 
36
+ ## Voices & languages
37
 
38
+ | Language | Code | Voices |
39
+ |---|---|---|
40
+ | English (US) | `en-us` | 20 |
41
+ | English (UK) | `en-gb` | 8 |
42
+ | Chinese (Mandarin) | `zh` | 8 |
43
+ | Hindi | `hi` | 4 |
44
+ | Spanish | `es` | 3 |
45
+ | Portuguese (Brazil) | `pt-br` | 3 |
46
+ | Italian | `it` | 2 |
47
+ | French | `fr-fr` | 1 |
48
 
49
+ **49 voices total.** Voice ids look like `af_heart` (American female), `am_michael`
50
+ (American male), `bf_emma` (British female), `ef_dora` (Spanish female), and so on.
51
 
52
+ ## Use the live API
53
 
54
+ ```bash
55
+ curl -X POST "$SOL_API/api/tts" \
56
+ -H "Content-Type: application/json" \
57
+ -d '{"text":"hello from sol","voice":"af_heart","speed":1.0}' \
58
+ --output sol.wav
59
+ ```
60
 
61
+ | Endpoint | Method | Purpose |
62
+ |---|---|---|
63
+ | `/api/health` | GET | service status |
64
+ | `/api/languages` | GET | supported languages + voice counts |
65
+ | `/api/voices` | GET | every voice (optional `?lang=en-us`) |
66
+ | `/api/tts` | POST | `{text, voice, speed}` β†’ `audio/wav` (24 kHz) |
67
 
68
+ Audio is silence-trimmed and peak-normalised, so output is clean with no static.
69
 
70
+ ### Multilingual samples
71
 
72
+ A sample in each language lives in
73
+ [`examples/multilingual/`](./examples/multilingual):
74
 
75
+ <audio controls src="examples/multilingual/en-us.wav"></audio>
76
+ <audio controls src="examples/multilingual/es.wav"></audio>
77
+ <audio controls src="examples/multilingual/zh.wav"></audio>
78
 
79
+ ## Sol v1 β€” the fine-tuned SpeechT5 model
80
 
81
+ This repository also ships **Sol v1**, a `SpeechT5` model fine-tuned on a
82
+ single-speaker subset of [LibriSpeech](https://www.openslr.org/12) (87 utterances,
83
+ light fine-tune, lr 2e-6) and paired with the `speecht5_hifigan` vocoder.
84
 
85
  ```python
86
+ import numpy as np, soundfile as sf, torch
 
 
87
  from transformers import SpeechT5ForTextToSpeech, SpeechT5HifiGan, SpeechT5Processor
88
 
89
  repo = "itriedcoding/Sol"
90
 
91
  processor = SpeechT5Processor.from_pretrained(repo)
92
+ model = SpeechT5ForTextToSpeech.from_pretrained(repo)
93
+ vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan")
94
 
 
95
  speaker = torch.tensor(np.load("speaker_embedding.npy")).unsqueeze(0)
96
 
97
+ inputs = processor(text="hello, i am sol.", return_tensors="pt")
 
 
98
  with torch.no_grad():
99
  speech = model.generate_speech(inputs["input_ids"], speaker, vocoder=vocoder)
100
 
101
  sf.write("sol.wav", speech.numpy(), samplerate=16000)
102
  ```
103
 
104
+ > Keep the speaker embedding at its original scale β€” it is a raw x-vector with
105
+ > norm β‰ˆ 320. Do **not** unit-normalise it, or the voice degrades.
106
+
107
+ ## Self-hosting
108
+
109
+ The engine is served from a FastAPI app (`server/app.py`) that loads Kokoro-82M
110
+ locally and exposes the endpoints above on `127.0.0.1:8000`, then published with a
111
+ Cloudflare tunnel. It starts automatically at logon and runs without a GPU.
112
 
113
  ## Intended use & limitations
114
 
115
+ - **Intended use:** research, prototyping, accessibility and demos.
116
+ - **Limitations:** 8 languages; may mispronounce rare names, numbers and unusual
117
+ punctuation; Japanese is not currently enabled (G2P dependency).
118
+ - Output is not a human voice and must not be used for impersonation or deceptive
119
+ audio.
120
 
121
+ ## Credits
122
 
123
+ - Engine: [Kokoro-82M](https://huggingface.co/hexgrad/Kokoro-82M) by hexgrad.
124
+ - SpeechT5 v1 voice data: [LibriSpeech](https://www.openslr.org/12), CC BY 4.0.
125
  - Base model & vocoder: Microsoft Research Asia, via πŸ€— Transformers.
126
+ - Fine-tuned, hosted and packaged by the **Sol** project.
127
 
128
  ## License
129
 
130
+ Apache-2.0. Please respect the original dataset, base-model and engine licenses.