Skip to content

Commit 33e1a0f

Browse files
authored
fix: i18n导致无法启动 & 增加 --noautoopen 参数 (#39)
* optimize: 精简未用到的配置项并在特征提取初步引入mps * add cmd argument: --noautoopen * fix: i18n * fix * fix * add genlocale workflow * add unitest * fix * fix * fix
1 parent 19a83b7 commit 33e1a0f

11 files changed

Lines changed: 262 additions & 159 deletions

File tree

.github/workflows/genlocale.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: genlocale
2+
on: [ push ]
3+
jobs:
4+
golangci:
5+
name: genlocale
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Check out
9+
uses: actions/checkout@master
10+
11+
- name: Run locale generation
12+
run: |
13+
python3 extract_locale.py
14+
cd locale
15+
python3 locale_diff.py
16+
17+
- name: Commit back
18+
if: ${{ !github.head_ref }}
19+
continue-on-error: true
20+
run: |
21+
git config --local user.name 'github-actions[bot]'
22+
git config --local user.email '41898282+github-actions[bot]@users.noreply.github.com'
23+
git add --all
24+
git commit -m "🎨 同步 locale"

.github/workflows/unitest.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: unitest
2+
on: [ push, pull_request ]
3+
jobs:
4+
build:
5+
runs-on: ${{ matrix.os }}
6+
strategy:
7+
matrix:
8+
python-version: ["3.8", "3.9", "3.10"]
9+
os: [ubuntu-latest]
10+
fail-fast: false
11+
12+
steps:
13+
- uses: actions/checkout@master
14+
- name: Set up Python ${{ matrix.python-version }}
15+
uses: actions/setup-python@v4
16+
with:
17+
python-version: ${{ matrix.python-version }}
18+
- name: Install dependencies
19+
run: |
20+
sudo apt update
21+
sudo apt -y install ffmpeg
22+
sudo apt -y install -qq aria2
23+
aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/hubert_base.pt -d ./ -o hubert_base.pt
24+
python -m pip install --upgrade pip
25+
python -m pip install --upgrade setuptools
26+
python -m pip install --upgrade wheel
27+
pip install torch torchvision torchaudio
28+
pip install -r requirements.txt
29+
- name: Test step 1 & 2
30+
run: |
31+
mkdir -p logs/mi-test
32+
touch logs/mi-test/preprocess.log
33+
python trainset_preprocess_pipeline_print.py logs/mute/0_gt_wavs 48000 8 logs/mi-test True
34+
touch logs/mi-test/extract_f0_feature.log
35+
python extract_f0_print.py logs/mi-test $(nproc) pm
36+
python extract_feature_print.py cpu 1 0 0 logs/mi-test

config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@
2121
parser.add_argument("--pycmd", type=str, default="python", help="Python command")
2222
parser.add_argument("--colab", action='store_true', help="Launch in colab")
2323
parser.add_argument("--noparallel", action='store_true', help="Disable parallel processing")
24+
parser.add_argument("--noautoopen", action='store_true', help="Do not open in browser automatically")
2425
cmd_opts = parser.parse_args()
2526

2627
python_cmd=cmd_opts.pycmd
2728
listen_port=cmd_opts.port
2829
iscolab=cmd_opts.colab
2930
noparallel=cmd_opts.noparallel
31+
noautoopen=cmd_opts.noautoopen
3032
########################命令行参数########################
3133

3234
import sys

extract_locale.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@
22
import re
33

44
# Define regular expression patterns
5-
pattern = r'i18n\([^)]*\)'
5+
pattern = r"""i18n\((["'][^"']+["'])\)"""
66

77
# Initialize the dictionary to store key-value pairs
88
data = {}
99

10-
# Extract labels from infer-webui.py
11-
with open('infer-web.py', 'r', encoding='utf-8') as f:
12-
contents = f.read()
13-
matches = re.findall(pattern, contents)
14-
for match in matches:
15-
key = match.strip('()"')
16-
data[key] = key
10+
def process(fn: str):
11+
global data
12+
with open(fn, 'r', encoding='utf-8') as f:
13+
contents = f.read()
14+
matches = re.findall(pattern, contents)
15+
for key in matches:
16+
key = eval(key)
17+
print("extract:", key)
18+
data[key] = key
1719

18-
# Extract labels from gui.py
19-
with open('gui.py', 'r', encoding='utf-8') as f:
20-
contents = f.read()
21-
matches = re.findall(pattern, contents)
22-
for match in matches:
23-
key = match.strip('()"')
24-
data[key] = key
20+
print("processing infer-web.py")
21+
process('infer-web.py')
22+
23+
print("processing gui.py")
24+
process('gui.py')
2525

2626
# Save as a JSON file
2727
with open('./locale/zh_CN.json', 'w', encoding='utf-8') as f:

gui.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -161,30 +161,30 @@ def launcher(self):
161161
input_devices,output_devices,_, _=self.get_devices()
162162
layout=[
163163
[
164-
sg.Frame(title=i18n('加载模型/Load Model'),layout=[
165-
[sg.Input(default_text='TEMP\\atri.pth',key='pth_path'),sg.FileBrowse(i18n('选择.pth文件/.pth File'))],
166-
[sg.Input(default_text='TEMP\\added_IVF512_Flat_atri_baseline_src_feat.index',key='index_path'),sg.FileBrowse(i18n('选择.index文件/.index File'))],
167-
[sg.Input(default_text='TEMP\\big_src_feature_atri.npy',key='npy_path'),sg.FileBrowse(i18n('选择.npy文件/.npy File'))]
164+
sg.Frame(title=i18n('加载模型'),layout=[
165+
[sg.Input(default_text='TEMP\\atri.pth',key='pth_path'),sg.FileBrowse(i18n('选择.pth文件'))],
166+
[sg.Input(default_text='TEMP\\added_IVF512_Flat_atri_baseline_src_feat.index',key='index_path'),sg.FileBrowse(i18n('选择.index文件'))],
167+
[sg.Input(default_text='TEMP\\big_src_feature_atri.npy',key='npy_path'),sg.FileBrowse(i18n('选择.npy文件'))]
168168
])
169169
],
170170
[
171171
sg.Frame(layout=[
172-
[sg.Text(i18n("输入设备/Input Device")),sg.Combo(input_devices,key='sg_input_device',default_value=input_devices[sd.default.device[0]])],
173-
[sg.Text(i18n("输出设备/Output Device")),sg.Combo(output_devices,key='sg_output_device',default_value=output_devices[sd.default.device[1]])]
174-
],title=i18n("音频设备(请使用同种类驱动)/Audio Devices"))
172+
[sg.Text(i18n("输入设备")),sg.Combo(input_devices,key='sg_input_device',default_value=input_devices[sd.default.device[0]])],
173+
[sg.Text(i18n("输出设备")),sg.Combo(output_devices,key='sg_output_device',default_value=output_devices[sd.default.device[1]])]
174+
],title=i18n("音频设备(请使用同种类驱动)"))
175175
],
176176
[
177177
sg.Frame(layout=[
178-
[sg.Text(i18n("响应阈值/Silence Threhold")),sg.Slider(range=(-60,0),key='threhold',resolution=1,orientation='h',default_value=-30)],
179-
[sg.Text(i18n("音调设置/Pitch Offset")),sg.Slider(range=(-24,24),key='pitch',resolution=1,orientation='h',default_value=12)]
178+
[sg.Text(i18n("响应阈值")),sg.Slider(range=(-60,0),key='threhold',resolution=1,orientation='h',default_value=-30)],
179+
[sg.Text(i18n("音调设置")),sg.Slider(range=(-24,24),key='pitch',resolution=1,orientation='h',default_value=12)]
180180

181-
],title=i18n("常规设置/Common")),
181+
],title=i18n("常规设置")),
182182
sg.Frame(layout=[
183-
[sg.Text(i18n("采样长度/Sample Length")),sg.Slider(range=(0.1,3.0),key='block_time',resolution=0.1,orientation='h',default_value=1.0)],
184-
[sg.Text(i18n("淡入淡出长度/Crossfade Length")),sg.Slider(range=(0.01,0.15),key='crossfade_length',resolution=0.01,orientation='h',default_value=0.08)],
185-
[sg.Text(i18n("额外推理时长/Extra Length")),sg.Slider(range=(0.05,3.00),key='extra_time',resolution=0.01,orientation='h',default_value=0.05)],
183+
[sg.Text(i18n("采样长度")),sg.Slider(range=(0.1,3.0),key='block_time',resolution=0.1,orientation='h',default_value=1.0)],
184+
[sg.Text(i18n("淡入淡出长度")),sg.Slider(range=(0.01,0.15),key='crossfade_length',resolution=0.01,orientation='h',default_value=0.08)],
185+
[sg.Text(i18n("额外推理时长")),sg.Slider(range=(0.05,3.00),key='extra_time',resolution=0.01,orientation='h',default_value=0.05)],
186186
[sg.Checkbox(i18n('输出降噪/Output Noisereduce'),key='noise_reduce')]
187-
],title=i18n("性能设置/Performance"))
187+
],title=i18n("性能设置"))
188188
],
189189
[sg.Button(i18n("开始音频转换"),key='start_vc'),sg.Button(i18n("停止音频转换"),key='stop_vc')]
190190
]

0 commit comments

Comments
 (0)