Plachta commited on
Commit
f32f220
1 Parent(s): 1706f57

Replaced Encodec with Vocos

Browse files
app.py CHANGED
@@ -36,6 +36,8 @@ import gradio as gr
36
  from vocos import Vocos
37
  from transformers import WhisperProcessor, WhisperForConditionalGeneration
38
 
 
 
39
  torch._C._jit_set_profiling_executor(False)
40
  torch._C._jit_set_profiling_mode(False)
41
  torch._C._set_graph_executor_optimize(False)
@@ -321,7 +323,7 @@ def infer_from_prompt(text, language, accent, preset_prompt, prompt_file):
321
  return message, (24000, samples.squeeze(0).cpu().numpy())
322
 
323
 
324
- from utils.sentence_cutter import split_text_into_sentences
325
  @torch.no_grad()
326
  def infer_long_text(text, preset_prompt, prompt=None, language='auto', accent='no-accent'):
327
  """
 
36
  from vocos import Vocos
37
  from transformers import WhisperProcessor, WhisperForConditionalGeneration
38
 
39
+ from utils.sentence_cutter import split_text_into_sentences
40
+
41
  torch._C._jit_set_profiling_executor(False)
42
  torch._C._jit_set_profiling_mode(False)
43
  torch._C._set_graph_executor_optimize(False)
 
323
  return message, (24000, samples.squeeze(0).cpu().numpy())
324
 
325
 
326
+
327
  @torch.no_grad()
328
  def infer_long_text(text, preset_prompt, prompt=None, language='auto', accent='no-accent'):
329
  """
utils/g2p/english.py CHANGED
@@ -19,6 +19,7 @@ hyperparameter. Some cleaners are English-specific. You'll typically want to use
19
  import re
20
  from unidecode import unidecode
21
  import inflect
 
22
  _inflect = inflect.engine()
23
  _comma_number_re = re.compile(r'([0-9][0-9\,]+[0-9])')
24
  _decimal_number_re = re.compile(r'([0-9]+\.[0-9]+)')
@@ -157,7 +158,6 @@ def mark_dark_l(text):
157
 
158
 
159
  def english_to_ipa(text):
160
- import eng_to_ipa as ipa
161
  text = unidecode(text).lower()
162
  text = expand_abbreviations(text)
163
  text = normalize_numbers(text)
 
19
  import re
20
  from unidecode import unidecode
21
  import inflect
22
+ import eng_to_ipa as ipa
23
  _inflect = inflect.engine()
24
  _comma_number_re = re.compile(r'([0-9][0-9\,]+[0-9])')
25
  _decimal_number_re = re.compile(r'([0-9]+\.[0-9]+)')
 
158
 
159
 
160
  def english_to_ipa(text):
 
161
  text = unidecode(text).lower()
162
  text = expand_abbreviations(text)
163
  text = normalize_numbers(text)
utils/g2p/japanese.py CHANGED
@@ -1,5 +1,6 @@
1
  import re
2
  from unidecode import unidecode
 
3
 
4
 
5
 
@@ -73,7 +74,7 @@ def symbols_to_japanese(text):
73
 
74
  def japanese_to_romaji_with_accent(text):
75
  '''Reference https://r9y9.github.io/ttslearn/latest/notebooks/ch10_Recipe-Tacotron.html'''
76
- import pyopenjtalk
77
  text = symbols_to_japanese(text)
78
  sentences = re.split(_japanese_marks, text)
79
  marks = re.findall(_japanese_marks, text)
 
1
  import re
2
  from unidecode import unidecode
3
+ import pyopenjtalk
4
 
5
 
6
 
 
74
 
75
  def japanese_to_romaji_with_accent(text):
76
  '''Reference https://r9y9.github.io/ttslearn/latest/notebooks/ch10_Recipe-Tacotron.html'''
77
+
78
  text = symbols_to_japanese(text)
79
  sentences = re.split(_japanese_marks, text)
80
  marks = re.findall(_japanese_marks, text)
utils/g2p/mandarin.py CHANGED
@@ -4,6 +4,7 @@ import re
4
  import jieba
5
  import cn2an
6
  import logging
 
7
 
8
 
9
  # List of (Latin alphabet, bopomofo) pairs:
@@ -240,7 +241,7 @@ def number_to_chinese(text):
240
 
241
 
242
  def chinese_to_bopomofo(text):
243
- from pypinyin import lazy_pinyin, BOPOMOFO
244
  text = text.replace('、', ',').replace(';', ',').replace(':', ',')
245
  words = jieba.lcut(text, cut_all=False)
246
  text = ''
 
4
  import jieba
5
  import cn2an
6
  import logging
7
+ from pypinyin import lazy_pinyin, BOPOMOFO
8
 
9
 
10
  # List of (Latin alphabet, bopomofo) pairs:
 
241
 
242
 
243
  def chinese_to_bopomofo(text):
244
+
245
  text = text.replace('、', ',').replace(';', ',').replace(':', ',')
246
  words = jieba.lcut(text, cut_all=False)
247
  text = ''