csukuangfj commited on
Commit
c5bf357
1 Parent(s): 8ab4193

add models from coqui-ai/TTS

Browse files
Files changed (1) hide show
  1. model.py +14 -16
model.py CHANGED
@@ -115,8 +115,11 @@ def _get_vits_ljs(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
115
 
116
  @lru_cache(maxsize=10)
117
  def _get_vits_piper(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
118
- n = len("vits-piper-")
119
- name = repo_id.split("/")[1][n:]
 
 
 
120
 
121
  model = get_file(
122
  repo_id=repo_id,
@@ -200,8 +203,6 @@ def _get_vits_zh_aishell3(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
200
  def _get_vits_hf(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
201
  if "fanchen" in repo_id or "vits-cantonese-hf-xiaomaiiwn" in repo_id:
202
  model = repo_id.split("/")[-1]
203
- elif "coqui" in repo_id:
204
- model = "model"
205
  else:
206
  model = repo_id.split("-")[-1]
207
 
@@ -223,14 +224,11 @@ def _get_vits_hf(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
223
  subfolder=".",
224
  )
225
 
226
- if "coqui" not in repo_id:
227
- rule_fst = get_file(
228
- repo_id=repo_id,
229
- filename="rule.fst",
230
- subfolder=".",
231
- )
232
- else:
233
- rule_fst = ""
234
 
235
  tts_config = sherpa_onnx.OfflineTtsConfig(
236
  model=sherpa_onnx.OfflineTtsModelConfig(
@@ -345,6 +343,10 @@ chinese_models = {
345
  }
346
 
347
  english_models = {
 
 
 
 
348
  # piper, US
349
  "csukuangfj/vits-piper-en_GB-sweetbbak-amy": _get_vits_piper,
350
  "csukuangfj/vits-piper-en_US-amy-low": _get_vits_piper,
@@ -373,10 +375,6 @@ english_models = {
373
  "csukuangfj/vits-piper-en_GB-semaine-medium": _get_vits_piper,
374
  "csukuangfj/vits-piper-en_GB-southern_english_female-low": _get_vits_piper,
375
  "csukuangfj/vits-piper-en_GB-vctk-medium": _get_vits_piper,
376
- # coqui-ai
377
- "csukuangfj/vits-coqui-en-vctk": _get_vits_hf,
378
- "csukuangfj/vits-coqui-en-ljspeech": _get_vits_hf,
379
- "csukuangfj/vits-coqui-en-ljspeech-neon": _get_vits_hf,
380
  #
381
  "csukuangfj/vits-vctk": _get_vits_vctk, # 109 speakers
382
  "csukuangfj/vits-ljs": _get_vits_ljs,
 
115
 
116
  @lru_cache(maxsize=10)
117
  def _get_vits_piper(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
118
+ if "coqui" in repo_id:
119
+ name = "model"
120
+ else:
121
+ n = len("vits-piper-")
122
+ name = repo_id.split("/")[1][n:]
123
 
124
  model = get_file(
125
  repo_id=repo_id,
 
203
  def _get_vits_hf(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
204
  if "fanchen" in repo_id or "vits-cantonese-hf-xiaomaiiwn" in repo_id:
205
  model = repo_id.split("/")[-1]
 
 
206
  else:
207
  model = repo_id.split("-")[-1]
208
 
 
224
  subfolder=".",
225
  )
226
 
227
+ rule_fst = get_file(
228
+ repo_id=repo_id,
229
+ filename="rule.fst",
230
+ subfolder=".",
231
+ )
 
 
 
232
 
233
  tts_config = sherpa_onnx.OfflineTtsConfig(
234
  model=sherpa_onnx.OfflineTtsModelConfig(
 
343
  }
344
 
345
  english_models = {
346
+ # coqui-ai
347
+ "csukuangfj/vits-coqui-en-ljspeech": _get_vits_piper,
348
+ "csukuangfj/vits-coqui-en-ljspeech-neon": _get_vits_piper,
349
+ "csukuangfj/vits-coqui-en-vctk": _get_vits_piper,
350
  # piper, US
351
  "csukuangfj/vits-piper-en_GB-sweetbbak-amy": _get_vits_piper,
352
  "csukuangfj/vits-piper-en_US-amy-low": _get_vits_piper,
 
375
  "csukuangfj/vits-piper-en_GB-semaine-medium": _get_vits_piper,
376
  "csukuangfj/vits-piper-en_GB-southern_english_female-low": _get_vits_piper,
377
  "csukuangfj/vits-piper-en_GB-vctk-medium": _get_vits_piper,
 
 
 
 
378
  #
379
  "csukuangfj/vits-vctk": _get_vits_vctk, # 109 speakers
380
  "csukuangfj/vits-ljs": _get_vits_ljs,