csukuangfj commited on
Commit
678e3ae
1 Parent(s): 588b97f

update german models

Browse files
Files changed (1) hide show
  1. model.py +13 -88
model.py CHANGED
@@ -113,99 +113,17 @@ def _get_vits_ljs(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
113
  return tts
114
 
115
 
116
- @lru_cache(maxsize=10)
117
- def _get_vits_piper_de_DE_thorsten_low(
118
- repo_id: str, speed: float
119
- ) -> sherpa_onnx.OfflineTts:
120
- assert repo_id == "csukuangfj/vits-piper-de_DE-thorsten-low"
121
-
122
- model = get_file(
123
- repo_id=repo_id,
124
- filename="de_DE-thorsten-low.onnx",
125
- subfolder=".",
126
- )
127
-
128
- lexicon = get_file(
129
- repo_id=repo_id,
130
- filename="lexicon.txt",
131
- subfolder=".",
132
- )
133
-
134
- tokens = get_file(
135
- repo_id=repo_id,
136
- filename="tokens.txt",
137
- subfolder=".",
138
- )
139
-
140
- tts_config = sherpa_onnx.OfflineTtsConfig(
141
- model=sherpa_onnx.OfflineTtsModelConfig(
142
- vits=sherpa_onnx.OfflineTtsVitsModelConfig(
143
- model=model,
144
- lexicon=lexicon,
145
- tokens=tokens,
146
- length_scale=1.0 / speed,
147
- ),
148
- provider="cpu",
149
- debug=True,
150
- num_threads=2,
151
- )
152
- )
153
- tts = sherpa_onnx.OfflineTts(tts_config)
154
-
155
- return tts
156
-
157
-
158
- @lru_cache(maxsize=10)
159
- def _get_vits_piper_de_DE_thorsten_medium(
160
- repo_id: str, speed: float
161
- ) -> sherpa_onnx.OfflineTts:
162
- assert repo_id == "csukuangfj/vits-piper-de_DE-thorsten-medium"
163
-
164
- model = get_file(
165
- repo_id=repo_id,
166
- filename="de_DE-thorsten-medium.onnx",
167
- subfolder=".",
168
- )
169
-
170
- lexicon = get_file(
171
- repo_id=repo_id,
172
- filename="lexicon.txt",
173
- subfolder=".",
174
- )
175
-
176
- tokens = get_file(
177
- repo_id=repo_id,
178
- filename="tokens.txt",
179
- subfolder=".",
180
- )
181
-
182
- tts_config = sherpa_onnx.OfflineTtsConfig(
183
- model=sherpa_onnx.OfflineTtsModelConfig(
184
- vits=sherpa_onnx.OfflineTtsVitsModelConfig(
185
- model=model,
186
- lexicon=lexicon,
187
- tokens=tokens,
188
- length_scale=1.0 / speed,
189
- ),
190
- provider="cpu",
191
- debug=True,
192
- num_threads=2,
193
- )
194
- )
195
- tts = sherpa_onnx.OfflineTts(tts_config)
196
-
197
- return tts
198
-
199
-
200
  @lru_cache(maxsize=10)
201
  def _get_vits_piper_de_DE_thorsten_high(
202
  repo_id: str, speed: float
203
  ) -> sherpa_onnx.OfflineTts:
204
  assert repo_id == "csukuangfj/vits-piper-de_DE-thorsten-high"
 
 
205
 
206
  model = get_file(
207
  repo_id=repo_id,
208
- filename="de_DE-thorsten-high.onnx",
209
  subfolder=".",
210
  )
211
 
@@ -344,9 +262,16 @@ english_models = {
344
  }
345
 
346
  german_models = {
347
- "csukuangfj/vits-piper-de_DE-thorsten-low": _get_vits_piper_de_DE_thorsten_low,
348
- "csukuangfj/vits-piper-de_DE-thorsten-medium": _get_vits_piper_de_DE_thorsten_medium,
349
- "csukuangfj/vits-piper-de_DE-thorsten-high": _get_vits_piper_de_DE_thorsten_high,
 
 
 
 
 
 
 
350
  }
351
 
352
 
 
113
  return tts
114
 
115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  @lru_cache(maxsize=10)
117
  def _get_vits_piper_de_DE_thorsten_high(
118
  repo_id: str, speed: float
119
  ) -> sherpa_onnx.OfflineTts:
120
  assert repo_id == "csukuangfj/vits-piper-de_DE-thorsten-high"
121
+ n = len("vits-piper-")
122
+ name = repo_id.split("/")[0][n:]
123
 
124
  model = get_file(
125
  repo_id=repo_id,
126
+ filename=f"{name}.onnx",
127
  subfolder=".",
128
  )
129
 
 
262
  }
263
 
264
  german_models = {
265
+ "csukuangfj/vits-piper-de_DE-eva_k-x_low": _get_vits_piper_de_DE,
266
+ "csukuangfj/vits-piper-de_DE-karlsson-low": _get_vits_piper_de_DE,
267
+ "csukuangfj/vits-piper-de_DE-kerstin-low": _get_vits_piper_de_DE,
268
+ "csukuangfj/vits-piper-de_DE-pavoque-low": _get_vits_piper_de_DE,
269
+ "csukuangfj/vits-piper-de_DE-ramona-low": _get_vits_piper_de_DE,
270
+ "csukuangfj/vits-piper-de_DE-ramona-low": _get_vits_piper_de_DE,
271
+ "csukuangfj/vits-piper-de_DE-thorsten-low": _get_vits_piper_de_DE,
272
+ "csukuangfj/vits-piper-de_DE-thorsten-medium": _get_vits_piper_de_DE,
273
+ "csukuangfj/vits-piper-de_DE-thorsten-high": _get_vits_piper_de_DE,
274
+ "csukuangfj/vits-piper-de_DE-thorsten_emotional-medium": _get_vits_piper_de_DE,
275
  }
276
 
277