ajayarora1235 commited on
Commit
c3cbe08
·
1 Parent(s): 29e1d72

get rid of i18n requirement

Browse files
Files changed (2) hide show
  1. app.py +41 -48
  2. requirements.txt +0 -1
app.py CHANGED
@@ -31,7 +31,6 @@ os.makedirs(os.path.join(now_dir, "weights"), exist_ok=True)
31
  os.environ["TEMP"] = tmp
32
  warnings.filterwarnings("ignore")
33
  torch.manual_seed(114514)
34
- from i18n import I18nAuto
35
 
36
  import edge_tts, asyncio
37
  from ilariatts import tts_order_voice
@@ -175,7 +174,7 @@ def update_fshift_presets(preset, qfrency, tmbre):
175
  {"value": tmbre, "__type__": "update"},
176
  )
177
 
178
- i18n = I18nAuto()
179
  #i18n.print()
180
  # 判断是否有能用来训练和加速推理的N卡
181
  ngpu = torch.cuda.device_count()
@@ -221,7 +220,7 @@ if if_gpu_ok == True and len(gpu_infos) > 0:
221
  gpu_info = "\n".join(gpu_infos)
222
  default_batch_size = min(mem) // 2
223
  else:
224
- gpu_info = i18n("很遗憾您这没有能用的显卡来支持您训练")
225
  default_batch_size = 1
226
  gpus = "-".join([i[0] for i in gpu_infos])
227
  from lib.infer_pack.models import (
@@ -984,7 +983,7 @@ def train1key(
984
  % (trainset_dir4, sr_dict[sr2], np7, model_log_dir)
985
  + str(config.noparallel)
986
  )
987
- yield get_info_str(i18n("step1:正在处理数据"))
988
  yield get_info_str(cmd)
989
  p = Popen(cmd, shell=True)
990
  p.wait()
@@ -1006,9 +1005,9 @@ def train1key(
1006
  with open(extract_f0_feature_log_path, "r") as f:
1007
  print(f.read())
1008
  else:
1009
- yield get_info_str(i18n("step2a:无需提取音高"))
1010
  #######step2b:提取特征
1011
- yield get_info_str(i18n("step2b:正在提取特征"))
1012
  gpus = gpus16.split("-")
1013
  leng = len(gpus)
1014
  ps = []
@@ -1031,7 +1030,7 @@ def train1key(
1031
  with open(extract_f0_feature_log_path, "r") as f:
1032
  print(f.read())
1033
  #######step3a:训练模型
1034
- yield get_info_str(i18n("step3a:正在训练模型"))
1035
  # 生成filelist
1036
  if if_f0_3:
1037
  f0_dir = "%s/2a_f0" % model_log_dir
@@ -1133,7 +1132,7 @@ def train1key(
1133
  yield get_info_str(cmd)
1134
  p = Popen(cmd, shell=True, cwd=now_dir)
1135
  p.wait()
1136
- yield get_info_str(i18n("训练结束, 您可查看控制台训练日志或实验文件夹下的train.log"))
1137
  #######step3b:训练索引
1138
  npys = []
1139
  listdir_res = list(os.listdir(feature_dir))
@@ -1173,7 +1172,7 @@ def train1key(
1173
  "成功构建索引, added_IVF%s_Flat_nprobe_%s_%s_%s.index"
1174
  % (n_ivf, index_ivf.nprobe, exp_dir1, version19)
1175
  )
1176
- yield get_info_str(i18n("全流程结束!"))
1177
 
1178
 
1179
  def whethercrepeornah(radio):
@@ -1649,7 +1648,7 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="rose")
1649
  minimum=0,
1650
  maximum=2333,
1651
  step=1,
1652
- label=i18n("请选择说话人id"),
1653
  value=0,
1654
  visible=False,
1655
  interactive=True,
@@ -1776,7 +1775,7 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="rose")
1776
  index_rate1 = gr.Slider(
1777
  minimum=0,
1778
  maximum=1,
1779
- label=i18n("检索特征占比"),
1780
  value=0,
1781
  interactive=True,
1782
  )
@@ -1804,7 +1803,7 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="rose")
1804
  filter_radius0 = gr.Slider(
1805
  minimum=0,
1806
  maximum=7,
1807
- label=i18n(">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音"),
1808
  value=3,
1809
  step=1,
1810
  interactive=True,
@@ -1812,7 +1811,7 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="rose")
1812
  resample_sr0 = gr.Slider(
1813
  minimum=0,
1814
  maximum=48000,
1815
- label=i18n("后处理重采样至最终采样率,0为不进行重采样"),
1816
  value=0,
1817
  step=1,
1818
  interactive=True,
@@ -1821,14 +1820,14 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="rose")
1821
  rms_mix_rate0 = gr.Slider(
1822
  minimum=0,
1823
  maximum=1,
1824
- label=i18n("输入源音量包络替换输出音量包络融合比例,越靠近1越使用输出包络"),
1825
  value=0.21,
1826
  interactive=True,
1827
  )
1828
  protect0 = gr.Slider(
1829
  minimum=0,
1830
  maximum=0.5,
1831
- label=i18n("保护清辅音和呼吸声,防止电音撕裂等artifact,拉满0.5不开启,调低加大保护力度但可能降低索引效果"),
1832
  value=0,
1833
  step=0.01,
1834
  interactive=True,
@@ -1884,7 +1883,7 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="rose")
1884
 
1885
  with gr.Row():
1886
  vc_output1 = gr.Textbox("")
1887
- f0_file = gr.File(label=i18n("F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调"), visible=False)
1888
 
1889
  but0.click(
1890
  vc_single,
@@ -1911,13 +1910,11 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="rose")
1911
  with gr.Row():
1912
  with gr.Column():
1913
  vc_transform1 = gr.Number(
1914
- label=i18n("变调(整数, 半音数量, 升八度12降八度-12)"), value=0
1915
  )
1916
- opt_input = gr.Textbox(label=i18n("指定输出文件夹"), value="opt")
1917
  f0method1 = gr.Radio(
1918
- label=i18n(
1919
- "选择音高提取算法,输入歌声可用pm提速,harvest低音好但巨慢无比,crepe效果好但吃GPU"
1920
- ),
1921
  choices=["pm", "harvest", "crepe", "rmvpe"],
1922
  value="rmvpe",
1923
  interactive=True,
@@ -1925,19 +1922,19 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="rose")
1925
  filter_radius1 = gr.Slider(
1926
  minimum=0,
1927
  maximum=7,
1928
- label=i18n(">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音"),
1929
  value=3,
1930
  step=1,
1931
  interactive=True,
1932
  )
1933
  with gr.Column():
1934
  file_index3 = gr.Textbox(
1935
- label=i18n("特征检索库文件路径,为空则使用下拉的选择结果"),
1936
  value="",
1937
  interactive=True,
1938
  )
1939
  file_index4 = gr.Dropdown(
1940
- label=i18n("自动检测index路径,下拉式选择(dropdown)"),
1941
  choices=sorted(index_paths),
1942
  interactive=True,
1943
  )
@@ -1954,7 +1951,7 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="rose")
1954
  index_rate2 = gr.Slider(
1955
  minimum=0,
1956
  maximum=1,
1957
- label=i18n("检索特征占比"),
1958
  value=1,
1959
  interactive=True,
1960
  )
@@ -1962,7 +1959,7 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="rose")
1962
  resample_sr1 = gr.Slider(
1963
  minimum=0,
1964
  maximum=48000,
1965
- label=i18n("后处理重采样至最终采样率,0为不进行重采样"),
1966
  value=0,
1967
  step=1,
1968
  interactive=True,
@@ -1970,37 +1967,35 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="rose")
1970
  rms_mix_rate1 = gr.Slider(
1971
  minimum=0,
1972
  maximum=1,
1973
- label=i18n("输入源音量包络替换输出音量包络融合比例,越靠近1越使用输出包络"),
1974
  value=1,
1975
  interactive=True,
1976
  )
1977
  protect1 = gr.Slider(
1978
  minimum=0,
1979
  maximum=0.5,
1980
- label=i18n(
1981
- "保护清辅音和呼吸声,防止电音撕裂等artifact,拉满0.5不开启,调低加大保护力度但可能降低索引效果"
1982
- ),
1983
  value=0.33,
1984
  step=0.01,
1985
  interactive=True,
1986
  )
1987
  with gr.Column():
1988
  dir_input = gr.Textbox(
1989
- label=i18n("输入待处理音频文件夹路径(去文件管理器地址栏拷就行了)"),
1990
  value="E:\codes\py39\\test-20230416b\\todo-songs",
1991
  )
1992
  inputs = gr.File(
1993
- file_count="multiple", label=i18n("也可批量输入音频文件, 二选一, 优先读文件夹")
1994
  )
1995
  with gr.Row():
1996
  format1 = gr.Radio(
1997
- label=i18n("导出文件格式"),
1998
  choices=["wav", "flac", "mp3", "m4a"],
1999
  value="flac",
2000
  interactive=True,
2001
  )
2002
- but1 = gr.Button(i18n("转换"), variant="primary")
2003
- vc_output3 = gr.Textbox(label=i18n("输出信息"))
2004
  but1.click(
2005
  vc_multi,
2006
  [
@@ -2050,14 +2045,14 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="rose")
2050
  with gr.Column():
2051
  exp_dir1 = gr.Textbox(label="Voice Name:", value="My-Voice")
2052
  sr2 = gr.Radio(
2053
- label=i18n("目标采样率"),
2054
  choices=["40k", "48k"],
2055
  value="40k",
2056
  interactive=True,
2057
  visible=False
2058
  )
2059
  if_f0_3 = gr.Radio(
2060
- label=i18n("模型是否带音高指导(唱歌一定要, 语音可以不要)"),
2061
  choices=[True, False],
2062
  value=True,
2063
  interactive=True,
@@ -2092,23 +2087,21 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="rose")
2092
  minimum=0,
2093
  maximum=4,
2094
  step=1,
2095
- label=i18n("请指定说话人id"),
2096
  value=0,
2097
  interactive=True,
2098
  visible=False
2099
  )
2100
  with gr.Accordion('GPU Settings', open=False, visible=False):
2101
  gpus6 = gr.Textbox(
2102
- label=i18n("以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2"),
2103
  value=gpus,
2104
  interactive=True,
2105
  visible=False
2106
  )
2107
- gpu_info9 = gr.Textbox(label=i18n("显卡信息"), value=gpu_info)
2108
  f0method8 = gr.Radio(
2109
- label=i18n(
2110
- "选择音高提取算法:输入歌声可用pm提速,高质量语音但CPU差可用dio提速,harvest质量更好但慢"
2111
- ),
2112
  choices=["harvest","crepe", "mangio-crepe", "rmvpe"], # Fork feature: Crepe on f0 extraction for training.
2113
  value="rmvpe",
2114
  interactive=True,
@@ -2118,7 +2111,7 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="rose")
2118
  minimum=1,
2119
  maximum=512,
2120
  step=1,
2121
- label=i18n("crepe_hop_length"),
2122
  value=128,
2123
  interactive=True,
2124
  visible=False,
@@ -2194,17 +2187,17 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="rose")
2194
  with gr.Group():
2195
  with gr.Accordion("Base Model Locations:", open=False, visible=False):
2196
  pretrained_G14 = gr.Textbox(
2197
- label=i18n("加载预训练底模G路径"),
2198
  value="pretrained_v2/f0G40k.pth",
2199
  interactive=True,
2200
  )
2201
  pretrained_D15 = gr.Textbox(
2202
- label=i18n("加载预训练底模D路径"),
2203
  value="pretrained_v2/f0D40k.pth",
2204
  interactive=True,
2205
  )
2206
  gpus16 = gr.Textbox(
2207
- label=i18n("以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2"),
2208
  value=gpus,
2209
  interactive=True,
2210
  )
@@ -2223,7 +2216,7 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="rose")
2223
  [if_f0_3, sr2, version19],
2224
  [f0method8, pretrained_G14, pretrained_D15],
2225
  )
2226
- but5 = gr.Button(i18n("一键训练"), variant="primary", visible=False)
2227
  but3.click(
2228
  click_train,
2229
  [
 
31
  os.environ["TEMP"] = tmp
32
  warnings.filterwarnings("ignore")
33
  torch.manual_seed(114514)
 
34
 
35
  import edge_tts, asyncio
36
  from ilariatts import tts_order_voice
 
174
  {"value": tmbre, "__type__": "update"},
175
  )
176
 
177
+ # i18n = I18nAuto()
178
  #i18n.print()
179
  # 判断是否有能用来训练和加速推理的N卡
180
  ngpu = torch.cuda.device_count()
 
220
  gpu_info = "\n".join(gpu_infos)
221
  default_batch_size = min(mem) // 2
222
  else:
223
+ gpu_info = "test"
224
  default_batch_size = 1
225
  gpus = "-".join([i[0] for i in gpu_infos])
226
  from lib.infer_pack.models import (
 
983
  % (trainset_dir4, sr_dict[sr2], np7, model_log_dir)
984
  + str(config.noparallel)
985
  )
986
+ yield get_info_str("step1: step 1")
987
  yield get_info_str(cmd)
988
  p = Popen(cmd, shell=True)
989
  p.wait()
 
1005
  with open(extract_f0_feature_log_path, "r") as f:
1006
  print(f.read())
1007
  else:
1008
+ yield get_info_str("step2a:step2a")
1009
  #######step2b:提取特征
1010
+ yield get_info_str("step2b:step2b")
1011
  gpus = gpus16.split("-")
1012
  leng = len(gpus)
1013
  ps = []
 
1030
  with open(extract_f0_feature_log_path, "r") as f:
1031
  print(f.read())
1032
  #######step3a:训练模型
1033
+ yield get_info_str("step3a:step3a")
1034
  # 生成filelist
1035
  if if_f0_3:
1036
  f0_dir = "%s/2a_f0" % model_log_dir
 
1132
  yield get_info_str(cmd)
1133
  p = Popen(cmd, shell=True, cwd=now_dir)
1134
  p.wait()
1135
+ yield get_info_str("training done, in train.log")
1136
  #######step3b:训练索引
1137
  npys = []
1138
  listdir_res = list(os.listdir(feature_dir))
 
1172
  "成功构建索引, added_IVF%s_Flat_nprobe_%s_%s_%s.index"
1173
  % (n_ivf, index_ivf.nprobe, exp_dir1, version19)
1174
  )
1175
+ yield get_info_str("yes!")
1176
 
1177
 
1178
  def whethercrepeornah(radio):
 
1648
  minimum=0,
1649
  maximum=2333,
1650
  step=1,
1651
+ label="speaker id",
1652
  value=0,
1653
  visible=False,
1654
  interactive=True,
 
1775
  index_rate1 = gr.Slider(
1776
  minimum=0,
1777
  maximum=1,
1778
+ label="index rate",
1779
  value=0,
1780
  interactive=True,
1781
  )
 
1803
  filter_radius0 = gr.Slider(
1804
  minimum=0,
1805
  maximum=7,
1806
+ label="label",
1807
  value=3,
1808
  step=1,
1809
  interactive=True,
 
1811
  resample_sr0 = gr.Slider(
1812
  minimum=0,
1813
  maximum=48000,
1814
+ label="label",
1815
  value=0,
1816
  step=1,
1817
  interactive=True,
 
1820
  rms_mix_rate0 = gr.Slider(
1821
  minimum=0,
1822
  maximum=1,
1823
+ label="label",
1824
  value=0.21,
1825
  interactive=True,
1826
  )
1827
  protect0 = gr.Slider(
1828
  minimum=0,
1829
  maximum=0.5,
1830
+ label="label",
1831
  value=0,
1832
  step=0.01,
1833
  interactive=True,
 
1883
 
1884
  with gr.Row():
1885
  vc_output1 = gr.Textbox("")
1886
+ f0_file = gr.File(label="f0 file", visible=False)
1887
 
1888
  but0.click(
1889
  vc_single,
 
1910
  with gr.Row():
1911
  with gr.Column():
1912
  vc_transform1 = gr.Number(
1913
+ label="speaker id", value=0
1914
  )
1915
+ opt_input = gr.Textbox(label="opt", value="opt")
1916
  f0method1 = gr.Radio(
1917
+ label="f0 method",
 
 
1918
  choices=["pm", "harvest", "crepe", "rmvpe"],
1919
  value="rmvpe",
1920
  interactive=True,
 
1922
  filter_radius1 = gr.Slider(
1923
  minimum=0,
1924
  maximum=7,
1925
+ label="harvest",
1926
  value=3,
1927
  step=1,
1928
  interactive=True,
1929
  )
1930
  with gr.Column():
1931
  file_index3 = gr.Textbox(
1932
+ label="file index",
1933
  value="",
1934
  interactive=True,
1935
  )
1936
  file_index4 = gr.Dropdown(
1937
+ label="index path (dropdown)",
1938
  choices=sorted(index_paths),
1939
  interactive=True,
1940
  )
 
1951
  index_rate2 = gr.Slider(
1952
  minimum=0,
1953
  maximum=1,
1954
+ label="index rate 2",
1955
  value=1,
1956
  interactive=True,
1957
  )
 
1959
  resample_sr1 = gr.Slider(
1960
  minimum=0,
1961
  maximum=48000,
1962
+ label="resample rate",
1963
  value=0,
1964
  step=1,
1965
  interactive=True,
 
1967
  rms_mix_rate1 = gr.Slider(
1968
  minimum=0,
1969
  maximum=1,
1970
+ label="rms mix rate",
1971
  value=1,
1972
  interactive=True,
1973
  )
1974
  protect1 = gr.Slider(
1975
  minimum=0,
1976
  maximum=0.5,
1977
+ label="protection rate",
 
 
1978
  value=0.33,
1979
  step=0.01,
1980
  interactive=True,
1981
  )
1982
  with gr.Column():
1983
  dir_input = gr.Textbox(
1984
+ label="directory input",
1985
  value="E:\codes\py39\\test-20230416b\\todo-songs",
1986
  )
1987
  inputs = gr.File(
1988
+ file_count="multiple", label="input"
1989
  )
1990
  with gr.Row():
1991
  format1 = gr.Radio(
1992
+ label="output format",
1993
  choices=["wav", "flac", "mp3", "m4a"],
1994
  value="flac",
1995
  interactive=True,
1996
  )
1997
+ but1 = gr.Button("primary", variant="primary")
1998
+ vc_output3 = gr.Textbox(label="label")
1999
  but1.click(
2000
  vc_multi,
2001
  [
 
2045
  with gr.Column():
2046
  exp_dir1 = gr.Textbox(label="Voice Name:", value="My-Voice")
2047
  sr2 = gr.Radio(
2048
+ label="sample rate",
2049
  choices=["40k", "48k"],
2050
  value="40k",
2051
  interactive=True,
2052
  visible=False
2053
  )
2054
  if_f0_3 = gr.Radio(
2055
+ label="extract f0",
2056
  choices=[True, False],
2057
  value=True,
2058
  interactive=True,
 
2087
  minimum=0,
2088
  maximum=4,
2089
  step=1,
2090
+ label="speaker id",
2091
  value=0,
2092
  interactive=True,
2093
  visible=False
2094
  )
2095
  with gr.Accordion('GPU Settings', open=False, visible=False):
2096
  gpus6 = gr.Textbox(
2097
+ label="0-1-2",
2098
  value=gpus,
2099
  interactive=True,
2100
  visible=False
2101
  )
2102
+ gpu_info9 = gr.Textbox(label="GPU", value=gpu_info)
2103
  f0method8 = gr.Radio(
2104
+ label="f0 method",
 
 
2105
  choices=["harvest","crepe", "mangio-crepe", "rmvpe"], # Fork feature: Crepe on f0 extraction for training.
2106
  value="rmvpe",
2107
  interactive=True,
 
2111
  minimum=1,
2112
  maximum=512,
2113
  step=1,
2114
+ label="crepe_hop_length",
2115
  value=128,
2116
  interactive=True,
2117
  visible=False,
 
2187
  with gr.Group():
2188
  with gr.Accordion("Base Model Locations:", open=False, visible=False):
2189
  pretrained_G14 = gr.Textbox(
2190
+ label="G PATH",
2191
  value="pretrained_v2/f0G40k.pth",
2192
  interactive=True,
2193
  )
2194
  pretrained_D15 = gr.Textbox(
2195
+ label="D PATH",
2196
  value="pretrained_v2/f0D40k.pth",
2197
  interactive=True,
2198
  )
2199
  gpus16 = gr.Textbox(
2200
+ label="GPU NUM",
2201
  value=gpus,
2202
  interactive=True,
2203
  )
 
2216
  [if_f0_3, sr2, version19],
2217
  [f0method8, pretrained_G14, pretrained_D15],
2218
  )
2219
+ but5 = gr.Button("label", variant="primary", visible=False)
2220
  but3.click(
2221
  click_train,
2222
  [
requirements.txt CHANGED
@@ -14,7 +14,6 @@ ffmpeg-python
14
  praat-parselmouth
15
  pyworld
16
  numpy==1.23.5
17
- i18n
18
  numba==0.56.4
19
  librosa==0.9.2
20
  mega.py
 
14
  praat-parselmouth
15
  pyworld
16
  numpy==1.23.5
 
17
  numba==0.56.4
18
  librosa==0.9.2
19
  mega.py