Yunshansongbai commited on
Commit
4585e41
1 Parent(s): 045a470

Upload 75 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +19 -0
  2. .ipynb_checkpoints/build.gradio-checkpoint.py +176 -0
  3. build.gradio.py +176 -0
  4. cluster/__init__.py +29 -0
  5. cluster/train_cluster.py +88 -0
  6. configs/config.json +95 -0
  7. data_utils.py +143 -0
  8. examples/instrumental/Counter_clockwise_Clock_instrumental.wav +3 -0
  9. examples/instrumental/blue_instrumental.wav +3 -0
  10. examples/instrumental/one_last_kiss_instrumental.wav +3 -0
  11. examples/song/Counter_clockwise_Clock.wav +3 -0
  12. examples/song/blue.wav +3 -0
  13. examples/song/one_last_kiss.wav +3 -0
  14. examples/vocals/Counter_clockwise_Clock_vocal.wav +3 -0
  15. examples/vocals/blue_vocal.wav +3 -0
  16. examples/vocals/one_last_kiss_vocal.wav +3 -0
  17. filelists/test.txt +2 -0
  18. filelists/train.txt +857 -0
  19. filelists/val.txt +2 -0
  20. flask_api.py +57 -0
  21. hubert/__init__.py +0 -0
  22. hubert/hubert4.0.onnx +3 -0
  23. hubert/hubert_model.py +226 -0
  24. hubert/hubert_model_onnx.py +217 -0
  25. inference/__init__.py +1 -0
  26. inference/chunks_temp.json +1 -0
  27. inference/infer_tool.py +255 -0
  28. inference/infer_tool_grad.py +161 -0
  29. inference/slicer.py +142 -0
  30. inference_main.py +108 -0
  31. logs/44k/config.json +95 -0
  32. logs/44k/eval/vdlrecords.1690034156.log +0 -0
  33. logs/44k/train.log +8 -0
  34. logs/44k/vdlrecords.1690034156.log +0 -0
  35. models.py +556 -0
  36. modules/__init__.py +1 -0
  37. modules/attentions.py +377 -0
  38. modules/commons.py +192 -0
  39. modules/losses.py +61 -0
  40. modules/mel_processing.py +111 -0
  41. modules/modules.py +351 -0
  42. output_2stems/blue-instrumental.wav +3 -0
  43. output_2stems/blue-vocals.wav +3 -0
  44. output_2stems/temp-instrumental.wav +3 -0
  45. output_2stems/temp-vocals.wav +3 -0
  46. paddle_infer_shape.py +88 -0
  47. preprocess_flist_config.py +84 -0
  48. preprocess_hubert_f0.py +62 -0
  49. raw/1.wav +3 -0
  50. requirements.txt +16 -0
.gitattributes CHANGED
@@ -33,3 +33,22 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ examples/instrumental/blue_instrumental.wav filter=lfs diff=lfs merge=lfs -text
37
+ examples/instrumental/Counter_clockwise_Clock_instrumental.wav filter=lfs diff=lfs merge=lfs -text
38
+ examples/instrumental/one_last_kiss_instrumental.wav filter=lfs diff=lfs merge=lfs -text
39
+ examples/song/blue.wav filter=lfs diff=lfs merge=lfs -text
40
+ examples/song/Counter_clockwise_Clock.wav filter=lfs diff=lfs merge=lfs -text
41
+ examples/song/one_last_kiss.wav filter=lfs diff=lfs merge=lfs -text
42
+ examples/vocals/blue_vocal.wav filter=lfs diff=lfs merge=lfs -text
43
+ examples/vocals/Counter_clockwise_Clock_vocal.wav filter=lfs diff=lfs merge=lfs -text
44
+ examples/vocals/one_last_kiss_vocal.wav filter=lfs diff=lfs merge=lfs -text
45
+ output_2stems/blue-instrumental.wav filter=lfs diff=lfs merge=lfs -text
46
+ output_2stems/blue-vocals.wav filter=lfs diff=lfs merge=lfs -text
47
+ output_2stems/temp-instrumental.wav filter=lfs diff=lfs merge=lfs -text
48
+ output_2stems/temp-vocals.wav filter=lfs diff=lfs merge=lfs -text
49
+ raw/1.wav filter=lfs diff=lfs merge=lfs -text
50
+ spleeter/2stems_instrumental.pdparams filter=lfs diff=lfs merge=lfs -text
51
+ spleeter/2stems_vocals.pdparams filter=lfs diff=lfs merge=lfs -text
52
+ trained_models/纳西妲.pdparams filter=lfs diff=lfs merge=lfs -text
53
+ trained_models/派蒙.pdparams filter=lfs diff=lfs merge=lfs -text
54
+ trained_models/YH.pdparams filter=lfs diff=lfs merge=lfs -text
.ipynb_checkpoints/build.gradio-checkpoint.py ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import io
2
+ import os
3
+
4
+ import gradio as gr
5
+ import librosa
6
+ import numpy as np
7
+ import soundfile
8
+ from inference.infer_tool import Svc
9
+ import logging
10
+ import os
11
+ import paddle
12
+ import requests
13
+ import utils
14
+ from spleeter import Separator
15
+
16
+ build_dir=os.getcwd()
17
+ if build_dir == "/home/aistudio":
18
+ build_dir += "/build"
19
+
20
+ model_dir=build_dir+'/trained_models'
21
+
22
+ model_list_path = model_dir + "/model_list.txt"
23
+
24
+ # 筛选出文件夹
25
+ models = []
26
+ for filename in os.listdir(model_dir):
27
+ # 判断文件名是否以 '.pdparams' 结尾,并且不包含后缀部分
28
+ if filename.endswith('.pdparams') and os.path.splitext(filename)[0].isalpha():
29
+ models.append(os.path.splitext(filename)[0])
30
+ cache_model = {}
31
+
32
+ def reboot():
33
+ os.execv(sys.executable, ['python'] + sys.argv)
34
+
35
+ def separate_fn(song_input):
36
+ try:
37
+ if song_input is None:
38
+ return "请上传歌曲",None,None,None,None
39
+ params_2stems = {
40
+ 'sample_rate': 44100,
41
+ 'frame_length': 4096,
42
+ 'frame_step': 1024,
43
+ 'T': 512,
44
+ 'F': 1024,
45
+ 'num_instruments': ['vocals', 'instrumental'],
46
+ 'output_dir': build_dir+'/output_2stems',
47
+ 'checkpoint_path': build_dir+'/spleeter',
48
+ 'use_elu': False}
49
+ sampling_rate, song = song_input
50
+ soundfile.write("temp.wav", song, sampling_rate, format="wav")
51
+ # 初始化分离器
52
+ sep = Separator(params_2stems)
53
+ sep.separate('temp.wav')
54
+ vocal_path = params_2stems["output_dir"]+"/temp-vocals.wav"
55
+ instrumental_path = params_2stems["output_dir"]+"/temp-instrumental.wav"
56
+ return "分离成功,请继续前往体验【转换】和【混音】",vocal_path,instrumental_path,vocal_path,instrumental_path
57
+ except Exception as e:
58
+ import traceback
59
+ return traceback.format_exc() , None,None,None,None
60
+
61
+
62
+ def convert_fn(model_name, input_audio,input_audio_micro, vc_transform, auto_f0,cluster_ratio, slice_db, noise_scale):
63
+ try:
64
+ if model_name in cache_model:
65
+ model = cache_model[model_name]
66
+ else:
67
+ if paddle.device.is_compiled_with_cuda()==False and len(cache_model)!=0:
68
+ return f"目前运行环境为CPU,受制于平台算力,每次启动本项目只允许加载1个模型,当前已加载{next(iter(cache_model))}",None,None
69
+ config_path = f"{build_dir}/trained_models/config.json"
70
+ model = Svc(f"{build_dir}/trained_models/{model_name}.pdparams", config_path,mode="test")
71
+ cache_model[model_name] = model
72
+ if input_audio is None and input_audio_micro is None:
73
+ return "请上传音频", None,None
74
+ if input_audio_micro is not None:
75
+ input_audio = input_audio_micro
76
+ sampling_rate, audio = input_audio
77
+ duration = audio.shape[0] / sampling_rate
78
+ audio = (audio / np.iinfo(audio.dtype).max).astype(np.float32)
79
+ if len(audio.shape) > 1:
80
+ audio = librosa.to_mono(audio.transpose(1, 0))
81
+ if sampling_rate != 16000:
82
+ audio = librosa.resample(audio, orig_sr=sampling_rate, target_sr=16000)
83
+ print(audio.shape)
84
+ out_wav_path = "temp.wav"
85
+ soundfile.write(out_wav_path, audio, 16000, format="wav")
86
+ print(cluster_ratio, auto_f0, noise_scale)
87
+ _audio = model.slice_inference(out_wav_path, model_name, vc_transform, slice_db, cluster_ratio, auto_f0, noise_scale)
88
+ del model
89
+ return "转换成功,请继续前往体验【混音】", (44100, _audio),(44100, _audio)
90
+ except Exception as e:
91
+ import traceback
92
+ return traceback.format_exc() , None,None
93
+
94
+ def compose_fn(input_vocal,input_instrumental,mixing_ratio=0.5):
95
+ try:
96
+ outlog = "混音成功"
97
+ if input_vocal is None:
98
+ return "请上传人声", None
99
+ if input_instrumental is None:
100
+ return "请上传伴奏", None
101
+ vocal_sampling_rate, vocal = input_vocal
102
+ vocal_duration = vocal.shape[0] / vocal_sampling_rate
103
+ vocal = (vocal / np.iinfo(vocal.dtype).max).astype(np.float32)
104
+ if len(vocal.shape) > 1:
105
+ vocal = librosa.to_mono(vocal.transpose(1, 0))
106
+ if vocal_sampling_rate != 44100:
107
+ vocal = librosa.resample(vocal, orig_sr=vocal_sampling_rate, target_sr=44100)
108
+
109
+ instrumental_sampling_rate, instrumental = input_instrumental
110
+ instrumental_duration = instrumental.shape[0] / instrumental_sampling_rate
111
+ instrumental = (instrumental / np.iinfo(instrumental.dtype).max).astype(np.float32)
112
+ if len(instrumental.shape) > 1:
113
+ instrumental = librosa.to_mono(instrumental.transpose(1, 0))
114
+ if instrumental_sampling_rate != 44100:
115
+ instrumental = librosa.resample(instrumental, orig_sr=instrumental_sampling_rate, target_sr=44100)
116
+ if len(vocal)!=len(instrumental):
117
+ min_length = min(len(vocal),len(instrumental))
118
+ instrumental = instrumental[:min_length]
119
+ vocal = vocal[:min_length]
120
+ outlog = "人声伴奏长度不一致,已自动截断较长的音频"
121
+
122
+ mixed_audio = (1 - mixing_ratio) * vocal + mixing_ratio * instrumental
123
+ mixed_audio_data = mixed_audio.astype(np.float32)
124
+ return outlog,(44100,mixed_audio_data)
125
+ except Exception as e:
126
+ import traceback
127
+ return traceback.format_exc() , None
128
+
129
+
130
+ app = gr.Blocks()
131
+ with app:
132
+ gr.Markdown('<h1 style="text-align: center;">SVC歌声转换全流程体验(伴奏分离,转换,混音)</h1>')
133
+ btn_reboot = gr.Button("重启程序", variant="primary")
134
+ with gr.Tabs() as tabs:
135
+ with gr.TabItem("人声伴奏分离"):
136
+ gr.Markdown('<p>该项目人声分离的效果弱于UVR5,如自备分离好的伴奏和人声可跳过该步骤</p>')
137
+ song_input = gr.Audio(label="上传歌曲(tips:上传后点击右上角✏可以进行歌曲剪辑)",interactive=True)
138
+ gr.Examples(examples=[build_dir+"/examples/song/blue.wav",build_dir+"/examples/song/Counter_clockwise_Clock.wav",build_dir+"/examples/song/one_last_kiss.wav"],inputs=song_input,label="歌曲样例")
139
+
140
+ btn_separate = gr.Button("人声伴奏分离", variant="primary")
141
+ text_output1 = gr.Textbox(label="输出信息")
142
+ vocal_output1 = gr.Audio(label="输出人声",interactive=False)
143
+ instrumental_output1 = gr.Audio(label="输出伴奏",interactive=False)
144
+ with gr.TabItem("转换"):
145
+ model_name = gr.Dropdown(label="模型", choices=models, value="纳西妲")
146
+ vocal_input1 = gr.Audio(label="上传人声",interactive=True)
147
+ gr.Examples(examples=[build_dir+"/examples/vocals/blue_vocal.wav",build_dir+"/examples/vocals/Counter_clockwise_Clock_vocal.wav",build_dir+"/examples/vocals/one_last_kiss_vocal.wav"],inputs=vocal_input1,label="人声样例")
148
+ btn_use_separate = gr.Button("使用【人声伴奏分离】分离的人声")
149
+ micro_input = gr.Audio(label="麦克风输入(优先于上传的人声)",source="microphone",interactive=True)
150
+ vc_transform = gr.Number(label="变调(半音数量,升八度12降八度-12)", value=0)
151
+ cluster_ratio = gr.Number(label="聚类模型混合比例", value=0,visible=False)
152
+ auto_f0 = gr.Checkbox(label="自动预测音高(转换歌声时不要打开,会严重跑调)", value=False)
153
+ slice_db = gr.Number(label="静音分贝阈值(嘈杂的音频可以-30,干声保留呼吸可以-50)", value=-50)
154
+ noise_scale = gr.Number(label="noise_scale", value=0.2)
155
+ btn_convert = gr.Button("转换", variant="primary")
156
+ text_output2 = gr.Textbox(label="输出信息")
157
+ vc_output2 = gr.Audio(label="输出音频",interactive=False)
158
+
159
+ with gr.TabItem("混音"):
160
+ vocal_input2 = gr.Audio(label="上传人声",interactive=True)
161
+ btn_use_convert = gr.Button("使用【转换】输出的人声")
162
+ instrumental_input1 = gr.Audio(label="上传伴奏")
163
+ gr.Examples(examples=[build_dir+"/examples/instrumental/blue_instrumental.wav",build_dir+"/examples/instrumental/Counter_clockwise_Clock_instrumental.wav",build_dir+"/examples/instrumental/one_last_kiss_instrumental.wav"],inputs=instrumental_input1,label="伴奏样例")
164
+ btn_use_separate2 = gr.Button("使用【人声伴奏分离】分离的伴奏")
165
+ mixing_ratio = gr.Slider(0, 1, value=0.75,step=0.01,label="混音比例(人声:伴奏)", info="人声:伴奏")
166
+ btn_compose = gr.Button("混音", variant="primary")
167
+ text_output3 = gr.Textbox(label="输出信息")
168
+ song_output = gr.Audio(label="输出歌曲",interactive=False)
169
+ btn_separate.click(separate_fn, song_input, [text_output1, vocal_output1,instrumental_output1,vocal_input1,instrumental_input1])
170
+ btn_convert.click(convert_fn, [model_name, vocal_input1,micro_input,vc_transform,auto_f0,cluster_ratio, slice_db, noise_scale], [text_output2, vc_output2,vocal_input2])
171
+ btn_reboot.click(reboot)
172
+ btn_use_convert.click(lambda x:x,vc_output2,vocal_input2)
173
+ btn_use_separate.click(lambda x:x,vocal_output1,vocal_input1)
174
+ btn_use_separate2.click(lambda x:x,instrumental_output1,instrumental_input1)
175
+
176
+ app.launch()
build.gradio.py ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import io
2
+ import os
3
+
4
+ import gradio as gr
5
+ import librosa
6
+ import numpy as np
7
+ import soundfile
8
+ from inference.infer_tool import Svc
9
+ import logging
10
+ import os
11
+ import paddle
12
+ import requests
13
+ import utils
14
+ from spleeter import Separator
15
+
16
+ build_dir=os.getcwd()
17
+ if build_dir == "/home/aistudio":
18
+ build_dir += "/build"
19
+
20
+ model_dir=build_dir+'/trained_models'
21
+
22
+ model_list_path = model_dir + "/model_list.txt"
23
+
24
+ # 筛选出文件夹
25
+ models = []
26
+ for filename in os.listdir(model_dir):
27
+ # 判断文件名是否以 '.pdparams' 结尾,并且不包含后缀部分
28
+ if filename.endswith('.pdparams') and os.path.splitext(filename)[0].isalpha():
29
+ models.append(os.path.splitext(filename)[0])
30
+ cache_model = {}
31
+
32
+ def reboot():
33
+ os._exit(0)
34
+
35
+ def separate_fn(song_input):
36
+ try:
37
+ if song_input is None:
38
+ return "请上传歌曲",None,None,None,None
39
+ params_2stems = {
40
+ 'sample_rate': 44100,
41
+ 'frame_length': 4096,
42
+ 'frame_step': 1024,
43
+ 'T': 512,
44
+ 'F': 1024,
45
+ 'num_instruments': ['vocals', 'instrumental'],
46
+ 'output_dir': build_dir+'/output_2stems',
47
+ 'checkpoint_path': build_dir+'/spleeter',
48
+ 'use_elu': False}
49
+ sampling_rate, song = song_input
50
+ soundfile.write("temp.wav", song, sampling_rate, format="wav")
51
+ # 初始化分离器
52
+ sep = Separator(params_2stems)
53
+ sep.separate('temp.wav')
54
+ vocal_path = params_2stems["output_dir"]+"/temp-vocals.wav"
55
+ instrumental_path = params_2stems["output_dir"]+"/temp-instrumental.wav"
56
+ return "分离成功,请继续前往体验【转换】和【混音】",vocal_path,instrumental_path,vocal_path,instrumental_path
57
+ except Exception as e:
58
+ import traceback
59
+ return traceback.format_exc() , None,None,None,None
60
+
61
+
62
+ def convert_fn(model_name, input_audio,input_audio_micro, vc_transform, auto_f0,cluster_ratio, slice_db, noise_scale):
63
+ try:
64
+ if model_name in cache_model:
65
+ model = cache_model[model_name]
66
+ else:
67
+ if paddle.device.is_compiled_with_cuda()==False and len(cache_model)!=0:
68
+ return f"目前运行环境为CPU,受制于平台算力,每次启动本项目只允许加载1个模型,当前已加载{next(iter(cache_model))}",None,None
69
+ config_path = f"{build_dir}/trained_models/config.json"
70
+ model = Svc(f"{build_dir}/trained_models/{model_name}.pdparams", config_path,mode="test")
71
+ cache_model[model_name] = model
72
+ if input_audio is None and input_audio_micro is None:
73
+ return "请上传音频", None,None
74
+ if input_audio_micro is not None:
75
+ input_audio = input_audio_micro
76
+ sampling_rate, audio = input_audio
77
+ duration = audio.shape[0] / sampling_rate
78
+ audio = (audio / np.iinfo(audio.dtype).max).astype(np.float32)
79
+ if len(audio.shape) > 1:
80
+ audio = librosa.to_mono(audio.transpose(1, 0))
81
+ if sampling_rate != 16000:
82
+ audio = librosa.resample(audio, orig_sr=sampling_rate, target_sr=16000)
83
+ print(audio.shape)
84
+ out_wav_path = "temp.wav"
85
+ soundfile.write(out_wav_path, audio, 16000, format="wav")
86
+ print(cluster_ratio, auto_f0, noise_scale)
87
+ _audio = model.slice_inference(out_wav_path, model_name, vc_transform, slice_db, cluster_ratio, auto_f0, noise_scale)
88
+ del model
89
+ return "转换成功,请继续前往体验【混音】", (44100, _audio),(44100, _audio)
90
+ except Exception as e:
91
+ import traceback
92
+ return traceback.format_exc() , None,None
93
+
94
+ def compose_fn(input_vocal,input_instrumental,mixing_ratio=0.5):
95
+ try:
96
+ outlog = "混音成功"
97
+ if input_vocal is None:
98
+ return "请上传人声", None
99
+ if input_instrumental is None:
100
+ return "请上传伴奏", None
101
+ vocal_sampling_rate, vocal = input_vocal
102
+ vocal_duration = vocal.shape[0] / vocal_sampling_rate
103
+ vocal = (vocal / np.iinfo(vocal.dtype).max).astype(np.float32)
104
+ if len(vocal.shape) > 1:
105
+ vocal = librosa.to_mono(vocal.transpose(1, 0))
106
+ if vocal_sampling_rate != 44100:
107
+ vocal = librosa.resample(vocal, orig_sr=vocal_sampling_rate, target_sr=44100)
108
+
109
+ instrumental_sampling_rate, instrumental = input_instrumental
110
+ instrumental_duration = instrumental.shape[0] / instrumental_sampling_rate
111
+ instrumental = (instrumental / np.iinfo(instrumental.dtype).max).astype(np.float32)
112
+ if len(instrumental.shape) > 1:
113
+ instrumental = librosa.to_mono(instrumental.transpose(1, 0))
114
+ if instrumental_sampling_rate != 44100:
115
+ instrumental = librosa.resample(instrumental, orig_sr=instrumental_sampling_rate, target_sr=44100)
116
+ if len(vocal)!=len(instrumental):
117
+ min_length = min(len(vocal),len(instrumental))
118
+ instrumental = instrumental[:min_length]
119
+ vocal = vocal[:min_length]
120
+ outlog = "人声伴奏长度不一致,已自动截断较长的音频"
121
+
122
+ mixed_audio = (1 - mixing_ratio) * vocal + mixing_ratio * instrumental
123
+ mixed_audio_data = mixed_audio.astype(np.float32)
124
+ return outlog,(44100,mixed_audio_data)
125
+ except Exception as e:
126
+ import traceback
127
+ return traceback.format_exc() , None
128
+
129
+
130
+ app = gr.Blocks()
131
+ with app:
132
+ gr.Markdown('<h1 style="text-align: center;">SVC歌声转换全流程体验(伴奏分离,转换,混音)</h1>')
133
+ btn_reboot = gr.Button("重启程序", variant="primary")
134
+ with gr.Tabs() as tabs:
135
+ with gr.TabItem("人声伴奏分离"):
136
+ gr.Markdown('<p>该项目人声分离的效果弱于UVR5,如自备分离好的伴奏和人声可跳过该步骤</p>')
137
+ song_input = gr.Audio(label="上传歌曲(tips:上传后点击右上角✏可以进行歌曲剪辑)",interactive=True)
138
+ gr.Examples(examples=[build_dir+"/examples/song/blue.wav",build_dir+"/examples/song/Counter_clockwise_Clock.wav",build_dir+"/examples/song/one_last_kiss.wav"],inputs=song_input,label="歌曲样例")
139
+
140
+ btn_separate = gr.Button("人声伴奏分离", variant="primary")
141
+ text_output1 = gr.Textbox(label="输出信息")
142
+ vocal_output1 = gr.Audio(label="输出人声",interactive=False)
143
+ instrumental_output1 = gr.Audio(label="输出伴奏",interactive=False)
144
+ with gr.TabItem("转换"):
145
+ model_name = gr.Dropdown(label="模型", choices=models, value="纳西妲")
146
+ vocal_input1 = gr.Audio(label="上传人声",interactive=True)
147
+ gr.Examples(examples=[build_dir+"/examples/vocals/blue_vocal.wav",build_dir+"/examples/vocals/Counter_clockwise_Clock_vocal.wav",build_dir+"/examples/vocals/one_last_kiss_vocal.wav"],inputs=vocal_input1,label="人声样例")
148
+ btn_use_separate = gr.Button("使用【人声伴奏分离】分离的人声")
149
+ micro_input = gr.Audio(label="麦克风输入(优先于上传的人声)",source="microphone",interactive=True)
150
+ vc_transform = gr.Number(label="变调(半音数量,升八度12降八度-12)", value=0)
151
+ cluster_ratio = gr.Number(label="聚类模型混合比例", value=0,visible=False)
152
+ auto_f0 = gr.Checkbox(label="自动预测音高(转换歌声时不要打开,会严重跑调)", value=False)
153
+ slice_db = gr.Number(label="静音分贝阈值(嘈杂的音频可以-30,干声保留呼吸可以-50)", value=-50)
154
+ noise_scale = gr.Number(label="noise_scale", value=0.2)
155
+ btn_convert = gr.Button("转换", variant="primary")
156
+ text_output2 = gr.Textbox(label="输出信息")
157
+ vc_output2 = gr.Audio(label="输出音频",interactive=False)
158
+
159
+ with gr.TabItem("混音"):
160
+ vocal_input2 = gr.Audio(label="上传人声",interactive=True)
161
+ btn_use_convert = gr.Button("使用【转换】输出的人声")
162
+ instrumental_input1 = gr.Audio(label="上传伴奏")
163
+ gr.Examples(examples=[build_dir+"/examples/instrumental/blue_instrumental.wav",build_dir+"/examples/instrumental/Counter_clockwise_Clock_instrumental.wav",build_dir+"/examples/instrumental/one_last_kiss_instrumental.wav"],inputs=instrumental_input1,label="伴奏样例")
164
+ btn_use_separate2 = gr.Button("使用【人声伴奏分离】分离的伴奏")
165
+ mixing_ratio = gr.Slider(0, 1, value=0.75,step=0.01,label="混音比例(人声:伴奏)", info="人声:伴奏")
166
+ btn_compose = gr.Button("混音", variant="primary")
167
+ text_output3 = gr.Textbox(label="输出信息")
168
+ song_output = gr.Audio(label="输出歌曲",interactive=False)
169
+ btn_separate.click(separate_fn, song_input, [text_output1, vocal_output1,instrumental_output1,vocal_input1,instrumental_input1])
170
+ btn_convert.click(convert_fn, [model_name, vocal_input1,micro_input,vc_transform,auto_f0,cluster_ratio, slice_db, noise_scale], [text_output2, vc_output2,vocal_input2])
171
+ btn_reboot.click(reboot)
172
+ btn_use_convert.click(lambda x:x,vc_output2,vocal_input2)
173
+ btn_use_separate.click(lambda x:x,vocal_output1,vocal_input1)
174
+ btn_use_separate2.click(lambda x:x,instrumental_output1,instrumental_input1)
175
+
176
+ app.launch()
cluster/__init__.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import paddle
3
+ from sklearn.cluster import KMeans
4
+
5
+ def get_cluster_model(ckpt_path:str):
6
+ checkpoint = paddle.load(ckpt_path)
7
+ kmeans_dict = {}
8
+ for spk, ckpt in checkpoint.items():
9
+ km = KMeans(ckpt["n_features_in_"])
10
+ km.__dict__["n_features_in_"] = ckpt["n_features_in_"]
11
+ km.__dict__["_n_threads"] = ckpt["_n_threads"]
12
+ km.__dict__["cluster_centers_"] = ckpt["cluster_centers_"]
13
+ kmeans_dict[spk] = km
14
+ return kmeans_dict
15
+
16
+ def get_cluster_result(model, x, speaker):
17
+ """
18
+ x: np.array [t, 256]
19
+ return cluster class result
20
+ """
21
+ return model[speaker].predict(x)
22
+
23
+ def get_cluster_center_result(model, x,speaker):
24
+ """x: np.array [t, 256]"""
25
+ predict = model[speaker].predict(x)
26
+ return model[speaker].cluster_centers_[predict]
27
+
28
+ def get_center(model, x,speaker):
29
+ return model[speaker].cluster_centers_[x]
cluster/train_cluster.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from glob import glob
3
+ from pathlib import Path
4
+ import paddle
5
+ import logging
6
+ import argparse
7
+ import numpy as np
8
+ from sklearn.cluster import KMeans, MiniBatchKMeans
9
+ import tqdm
10
+ logging.basicConfig(level=logging.INFO)
11
+ logger = logging.getLogger(__name__)
12
+ import time
13
+ import random
14
+
15
+ def train_cluster(in_dir, n_clusters, use_minibatch=True, verbose=False):
16
+
17
+ logger.info(f"正在从{in_dir}加载特征")
18
+ features = []
19
+ nums = 0
20
+ for path in tqdm.tqdm(in_dir.glob("*.soft.pdtensor")):
21
+ path = str(path)
22
+ features.append(paddle.load(path).squeeze(0).numpy().T)
23
+ # print(features[-1].shape)
24
+ features = np.concatenate(features, axis=0)
25
+ print(nums, features.nbytes/ 1024**2, "MB , 形状:",features.shape, features.dtype)
26
+ features = features.astype(np.float32)
27
+ logger.info(f"聚类特征的形状:{features.shape}")
28
+ t = time.time()
29
+ if use_minibatch:
30
+ kmeans = MiniBatchKMeans(n_clusters=n_clusters,verbose=verbose, batch_size=4096, max_iter=80).fit(features)
31
+ else:
32
+ kmeans = KMeans(n_clusters=n_clusters,verbose=verbose).fit(features)
33
+ print(time.time()-t, "s")
34
+
35
+ x = {
36
+ "n_features_in_": kmeans.n_features_in_,
37
+ "_n_threads": kmeans._n_threads,
38
+ "cluster_centers_": kmeans.cluster_centers_,
39
+ }
40
+ print("结束")
41
+
42
+ return x
43
+
44
+
45
+ if __name__ == "__main__":
46
+
47
+ parser = argparse.ArgumentParser()
48
+ parser.add_argument('--dataset', type=Path, default="./dataset/44k",
49
+ help='path of training data directory')
50
+ parser.add_argument('--output', type=Path, default="logs/44k",
51
+ help='path of model output directory')
52
+
53
+ args = parser.parse_args()
54
+
55
+ checkpoint_dir = args.output
56
+ dataset = args.dataset
57
+ n_clusters = 10000
58
+
59
+ ckpt = {}
60
+ for spk in os.listdir(dataset):
61
+ if os.path.isdir(dataset/spk):
62
+ print(f"正在给{spk}训练kmeans中……")
63
+ in_dir = dataset/spk
64
+ x = train_cluster(in_dir, n_clusters, verbose=False)
65
+ ckpt[spk] = x
66
+
67
+ checkpoint_path = checkpoint_dir / f"kmeans_{n_clusters}.pdparams"
68
+ checkpoint_path.parent.mkdir(exist_ok=True, parents=True)
69
+ paddle.save(
70
+ ckpt,
71
+ str(checkpoint_path),
72
+ )
73
+
74
+
75
+ # import cluster
76
+ # for spk in tqdm.tqdm(os.listdir("dataset")):
77
+ # if os.path.isdir(f"dataset/{spk}"):
78
+ # print(f"start kmeans inference for {spk}...")
79
+ # for feature_path in tqdm.tqdm(glob(f"dataset/{spk}/*.discrete.npy", recursive=True)):
80
+ # mel_path = feature_path.replace(".discrete.npy",".mel.npy")
81
+ # mel_spectrogram = np.load(mel_path)
82
+ # feature_len = mel_spectrogram.shape[-1]
83
+ # c = np.load(feature_path)
84
+ # c = utils.tools.repeat_expand_2d(torch.FloatTensor(c), feature_len).numpy()
85
+ # feature = c.T
86
+ # feature_class = cluster.get_cluster_result(feature, spk)
87
+ # np.save(feature_path.replace(".discrete.npy", ".discrete_class.npy"), feature_class)
88
+
configs/config.json ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "train": {
3
+ "log_interval": 800,
4
+ "eval_interval": 400,
5
+ "seed": 1234,
6
+ "epochs": 114514,
7
+ "learning_rate": 0.0001,
8
+ "betas": [
9
+ 0.8,
10
+ 0.99
11
+ ],
12
+ "eps": 1e-05,
13
+ "batch_size": 2,
14
+ "fp16_run": true,
15
+ "lr_decay": 0.999875,
16
+ "segment_size": 10240,
17
+ "init_lr_ratio": 1,
18
+ "warmup_epochs": 0,
19
+ "c_mel": 45,
20
+ "c_kl": 1.0,
21
+ "use_sr": true,
22
+ "max_speclen": 512,
23
+ "port": "8001",
24
+ "keep_ckpts": 5
25
+ },
26
+ "data": {
27
+ "training_files": "filelists/train.txt",
28
+ "validation_files": "filelists/val.txt",
29
+ "max_wav_value": 32768.0,
30
+ "sampling_rate": 44100,
31
+ "filter_length": 2048,
32
+ "hop_length": 512,
33
+ "win_length": 2048,
34
+ "n_mel_channels": 80,
35
+ "mel_fmin": 0.0,
36
+ "mel_fmax": 22050
37
+ },
38
+ "model": {
39
+ "inter_channels": 192,
40
+ "hidden_channels": 192,
41
+ "filter_channels": 768,
42
+ "n_heads": 2,
43
+ "n_layers": 6,
44
+ "kernel_size": 3,
45
+ "p_dropout": 0.1,
46
+ "resblock": "1",
47
+ "resblock_kernel_sizes": [
48
+ 3,
49
+ 7,
50
+ 11
51
+ ],
52
+ "resblock_dilation_sizes": [
53
+ [
54
+ 1,
55
+ 3,
56
+ 5
57
+ ],
58
+ [
59
+ 1,
60
+ 3,
61
+ 5
62
+ ],
63
+ [
64
+ 1,
65
+ 3,
66
+ 5
67
+ ]
68
+ ],
69
+ "upsample_rates": [
70
+ 8,
71
+ 8,
72
+ 2,
73
+ 2,
74
+ 2
75
+ ],
76
+ "upsample_initial_channel": 512,
77
+ "upsample_kernel_sizes": [
78
+ 16,
79
+ 16,
80
+ 4,
81
+ 4,
82
+ 4
83
+ ],
84
+ "n_layers_q": 3,
85
+ "use_spectral_norm": false,
86
+ "gin_channels": 256,
87
+ "ssl_dim": 256,
88
+ "n_speakers": 200
89
+ },
90
+ "spk": {
91
+ "yuuka": 0
92
+ },
93
+ "clean_logs": true,
94
+ "trainer": "admin"
95
+ }
data_utils.py ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import time
2
+ import os
3
+ import random
4
+ import numpy as np
5
+ import paddle
6
+
7
+ import modules.commons as commons
8
+ import utils
9
+ from modules.mel_processing import spectrogram_torch, spec_to_mel_torch
10
+ from utils import load_wav_to_torch, load_filepaths_and_text
11
+
12
+ # import h5py
13
+
14
+
15
+ """Multi speaker version"""
16
+
17
+
18
+ class TextAudioSpeakerLoader(paddle.io.Dataset):
19
+ """
20
+ 1) loads audio, speaker_id, text pairs
21
+ 2) normalizes text and converts them to sequences of integers
22
+ 3) computes spectrograms from audio files.
23
+ """
24
+
25
+ def __init__(self, audiopaths, hparams):
26
+ self.audiopaths = load_filepaths_and_text(audiopaths)
27
+ self.max_wav_value = hparams.data.max_wav_value
28
+ self.sampling_rate = hparams.data.sampling_rate
29
+ self.filter_length = hparams.data.filter_length
30
+ self.hop_length = hparams.data.hop_length
31
+ self.win_length = hparams.data.win_length
32
+ self.sampling_rate = hparams.data.sampling_rate
33
+ self.use_sr = hparams.train.use_sr
34
+ self.spec_len = hparams.train.max_speclen
35
+ self.spk_map = hparams.spk
36
+
37
+ random.seed(1234)
38
+ random.shuffle(self.audiopaths)
39
+
40
+ def get_audio(self, filename):
41
+ filename = filename.replace("\\", "/")
42
+ audio, sampling_rate = load_wav_to_torch(filename)
43
+ if sampling_rate != self.sampling_rate:
44
+ raise ValueError("{} SR doesn't match target {} SR".format(
45
+ sampling_rate, self.sampling_rate))
46
+ audio_norm = audio / self.max_wav_value
47
+ audio_norm = audio_norm.unsqueeze(0)
48
+ spec_filename = filename.replace(".wav", ".spec.pdtensor")
49
+ if os.path.exists(spec_filename):
50
+ spec = paddle.load(spec_filename)
51
+ else:
52
+ spec = spectrogram_torch(audio_norm, self.filter_length,
53
+ self.sampling_rate, self.hop_length, self.win_length,
54
+ center=False)
55
+ spec = paddle.squeeze(spec, 0)
56
+ paddle.save(spec, spec_filename)
57
+
58
+ spk = filename.split("/")[-2]
59
+ spk = paddle.to_tensor([self.spk_map[spk]],dtype = 'int64')
60
+
61
+ f0 = np.load(filename + ".f0.npy")
62
+ f0, uv = utils.interpolate_f0(f0)
63
+ f0 = paddle.to_tensor(f0,dtype = 'float32')
64
+ uv = paddle.to_tensor(uv,dtype = 'float32')
65
+
66
+ c = paddle.load(filename+ ".soft.pdtensor")
67
+ c = utils.repeat_expand_2d(c.squeeze(0), f0.shape[0])
68
+
69
+
70
+ lmin = min(c.shape[-1], spec.shape[-1])
71
+ assert abs(c.shape[-1] - spec.shape[-1]) < 3, (c.shape[-1], spec.shape[-1], f0.shape, filename)
72
+ assert abs(audio_norm.shape[1]-lmin * self.hop_length) < 3 * self.hop_length
73
+ spec, c, f0, uv = spec[:, :lmin], c[:, :lmin], f0[:lmin], uv[:lmin]
74
+ audio_norm = audio_norm[:, :lmin * self.hop_length]
75
+ # if spec.shape[1] < 30:
76
+ # print("skip too short audio:", filename)
77
+ # return None
78
+ if spec.shape[1] > 800:
79
+ start = random.randint(0, spec.shape[1]-800)
80
+ end = start + 790
81
+ spec, c, f0, uv = spec[:, start:end], c[:, start:end], f0[start:end], uv[start:end]
82
+ audio_norm = audio_norm[:, start * self.hop_length : end * self.hop_length]
83
+
84
+ return c, f0, spec, audio_norm, spk, uv
85
+
86
+ def __getitem__(self, index):
87
+ return self.get_audio(self.audiopaths[index][0])
88
+
89
+ def __len__(self):
90
+ return len(self.audiopaths)
91
+
92
+
93
+ class TextAudioCollate:
94
+
95
+ def __call__(self, batch):
96
+ batch = [b for b in batch if b is not None]
97
+
98
+ input_lengths, ids_sorted_decreasing = \
99
+ paddle.sort(
100
+ paddle.to_tensor([x[0].shape[1] for x in batch],dtype = 'int64'),
101
+ axis=0, descending=True),\
102
+ paddle.argsort(
103
+ paddle.to_tensor([x[0].shape[1] for x in batch],dtype = 'int64'),
104
+ axis=0, descending=True)
105
+
106
+ max_c_len = max([x[0].shape[1] for x in batch])
107
+ max_wav_len = max([x[3].shape[1] for x in batch])
108
+
109
+ lengths = paddle.zeros((len(batch),),dtype = 'int64')
110
+ c_padded = paddle.to_tensor(np.random.rand(len(batch), batch[0][0].shape[0], max_c_len),dtype = 'float32')
111
+ f0_padded = paddle.to_tensor(np.random.rand(len(batch), max_c_len),dtype = 'float32')
112
+ spec_padded = paddle.to_tensor(np.random.rand(len(batch), batch[0][2].shape[0], max_c_len),dtype = 'float32')
113
+ wav_padded = paddle.to_tensor(np.random.rand(len(batch), 1, max_wav_len),dtype = 'float32')
114
+ spkids = paddle.zeros((len(batch), 1),dtype = 'int64')
115
+ uv_padded = paddle.to_tensor(np.random.rand(len(batch), max_c_len),dtype = 'float32')
116
+
117
+ c_padded.zero_()
118
+ spec_padded.zero_()
119
+ f0_padded.zero_()
120
+ wav_padded.zero_()
121
+ uv_padded.zero_()
122
+
123
+ for i in range(len(ids_sorted_decreasing)):
124
+ row = batch[ids_sorted_decreasing[i]]
125
+
126
+ c = row[0]
127
+ c_padded[i, :, :c.shape[1]] = c
128
+ lengths[i] = c.shape[1]
129
+
130
+ f0 = row[1]
131
+ f0_padded[i, :f0.shape[0]] = f0
132
+
133
+ spec = row[2]
134
+ spec_padded[i, :, :spec.shape[1]] = spec
135
+
136
+ wav = row[3]
137
+ wav_padded[i, :, :wav.shape[1]] = wav
138
+ spkids[i, 0] = row[4]
139
+
140
+ uv = row[5]
141
+ uv_padded[i, :uv.shape[0]] = uv
142
+
143
+ return c_padded, f0_padded, spec_padded, wav_padded, spkids, lengths, uv_padded
examples/instrumental/Counter_clockwise_Clock_instrumental.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4a1c1d882e28458a0aa448cb68b65344e4839a2354766d679f20970c30362fc9
3
+ size 2062380
examples/instrumental/blue_instrumental.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7bbbc0b86619c634cbad2769ce035e96d4b7e598d50260be11a84e21f7b8b311
3
+ size 5420756
examples/instrumental/one_last_kiss_instrumental.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:223b2eb0ef567c891bf61a3f05d97aea97b18fb44bc21d6726053f81c5fe0f57
3
+ size 6575226
examples/song/Counter_clockwise_Clock.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b87df2edb949b8c8d87f740ebd701c764425636906b0232c6ea7375b0dc898e8
3
+ size 2252296
examples/song/blue.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2b80bd01d14fcd86bbee2c048f94b8b5927ae0a661ff5b2b99a014110a8c9a49
3
+ size 2709736
examples/song/one_last_kiss.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fc671b5095cc1dfa00772de09f8fa94741482b573eafbd88188fe909cdb1f173
3
+ size 6575226
examples/vocals/Counter_clockwise_Clock_vocal.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f749f2b9a1c8af5afbc66544956337ce12fd1c5b9d64e69d1212847a36480b9e
3
+ size 2062380
examples/vocals/blue_vocal.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5014db90a4bd53a18054ae2a2f9b1e733c8c474a6872beace1c3bd716b2cb61f
3
+ size 2484268
examples/vocals/one_last_kiss_vocal.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d52245bb0ac3965ebedcf730d5e21bc8d35519b84184c40b9f8ec780420b813c
3
+ size 6568602
filelists/test.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ ./dataset/44k/yuuka/7_93.wav
2
+ ./dataset/44k/yuuka/1_98.wav
filelists/train.txt ADDED
@@ -0,0 +1,857 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ./dataset/44k/yuuka/1_44.wav
2
+ ./dataset/44k/yuuka/6_3.wav
3
+ ./dataset/44k/yuuka/3_136.wav
4
+ ./dataset/44k/yuuka/3_63.wav
5
+ ./dataset/44k/yuuka/4_14.wav
6
+ ./dataset/44k/yuuka/7_168.wav
7
+ ./dataset/44k/yuuka/4_12.wav
8
+ ./dataset/44k/yuuka/364983.wav
9
+ ./dataset/44k/yuuka/606448.wav
10
+ ./dataset/44k/yuuka/5_21.wav
11
+ ./dataset/44k/yuuka/8_23.wav
12
+ ./dataset/44k/yuuka/9_69.wav
13
+ ./dataset/44k/yuuka/5_91.wav
14
+ ./dataset/44k/yuuka/3_163.wav
15
+ ./dataset/44k/yuuka/6_27.wav
16
+ ./dataset/44k/yuuka/234705.wav
17
+ ./dataset/44k/yuuka/3_176.wav
18
+ ./dataset/44k/yuuka/1_93.wav
19
+ ./dataset/44k/yuuka/76490.wav
20
+ ./dataset/44k/yuuka/3_179.wav
21
+ ./dataset/44k/yuuka/1_69.wav
22
+ ./dataset/44k/yuuka/192554.wav
23
+ ./dataset/44k/yuuka/218550.wav
24
+ ./dataset/44k/yuuka/6_16.wav
25
+ ./dataset/44k/yuuka/5_35.wav
26
+ ./dataset/44k/yuuka/207846.wav
27
+ ./dataset/44k/yuuka/7_145.wav
28
+ ./dataset/44k/yuuka/audio_28.wav
29
+ ./dataset/44k/yuuka/2_30.wav
30
+ ./dataset/44k/yuuka/1_55.wav
31
+ ./dataset/44k/yuuka/5_6.wav
32
+ ./dataset/44k/yuuka/3_178.wav
33
+ ./dataset/44k/yuuka/3_19.wav
34
+ ./dataset/44k/yuuka/audio_15.wav
35
+ ./dataset/44k/yuuka/3_134.wav
36
+ ./dataset/44k/yuuka/1_1.wav
37
+ ./dataset/44k/yuuka/5_66.wav
38
+ ./dataset/44k/yuuka/7_61.wav
39
+ ./dataset/44k/yuuka/7_43.wav
40
+ ./dataset/44k/yuuka/9_4.wav
41
+ ./dataset/44k/yuuka/4_42.wav
42
+ ./dataset/44k/yuuka/7_130.wav
43
+ ./dataset/44k/yuuka/5_52.wav
44
+ ./dataset/44k/yuuka/919255.wav
45
+ ./dataset/44k/yuuka/4_82.wav
46
+ ./dataset/44k/yuuka/1_114.wav
47
+ ./dataset/44k/yuuka/7_7.wav
48
+ ./dataset/44k/yuuka/1_79.wav
49
+ ./dataset/44k/yuuka/1_33.wav
50
+ ./dataset/44k/yuuka/9_21.wav
51
+ ./dataset/44k/yuuka/574054.wav
52
+ ./dataset/44k/yuuka/69301.wav
53
+ ./dataset/44k/yuuka/5_30.wav
54
+ ./dataset/44k/yuuka/119619.wav
55
+ ./dataset/44k/yuuka/7_167.wav
56
+ ./dataset/44k/yuuka/1_45.wav
57
+ ./dataset/44k/yuuka/6_23.wav
58
+ ./dataset/44k/yuuka/656221.wav
59
+ ./dataset/44k/yuuka/9_65.wav
60
+ ./dataset/44k/yuuka/3_85.wav
61
+ ./dataset/44k/yuuka/7_188.wav
62
+ ./dataset/44k/yuuka/6_13.wav
63
+ ./dataset/44k/yuuka/3_60.wav
64
+ ./dataset/44k/yuuka/997011.wav
65
+ ./dataset/44k/yuuka/audio_1.wav
66
+ ./dataset/44k/yuuka/6_39.wav
67
+ ./dataset/44k/yuuka/5_15.wav
68
+ ./dataset/44k/yuuka/7775.wav
69
+ ./dataset/44k/yuuka/969593.wav
70
+ ./dataset/44k/yuuka/7_94.wav
71
+ ./dataset/44k/yuuka/39442.wav
72
+ ./dataset/44k/yuuka/9_37.wav
73
+ ./dataset/44k/yuuka/3_46.wav
74
+ ./dataset/44k/yuuka/5_41.wav
75
+ ./dataset/44k/yuuka/517653.wav
76
+ ./dataset/44k/yuuka/9_38.wav
77
+ ./dataset/44k/yuuka/2_18.wav
78
+ ./dataset/44k/yuuka/255268.wav
79
+ ./dataset/44k/yuuka/8_5.wav
80
+ ./dataset/44k/yuuka/4_22.wav
81
+ ./dataset/44k/yuuka/1_81.wav
82
+ ./dataset/44k/yuuka/3_39.wav
83
+ ./dataset/44k/yuuka/262686.wav
84
+ ./dataset/44k/yuuka/3_105.wav
85
+ ./dataset/44k/yuuka/571657.wav
86
+ ./dataset/44k/yuuka/8_20.wav
87
+ ./dataset/44k/yuuka/6_33.wav
88
+ ./dataset/44k/yuuka/3_165.wav
89
+ ./dataset/44k/yuuka/594447.wav
90
+ ./dataset/44k/yuuka/7_181.wav
91
+ ./dataset/44k/yuuka/695541.wav
92
+ ./dataset/44k/yuuka/1_32.wav
93
+ ./dataset/44k/yuuka/1_92.wav
94
+ ./dataset/44k/yuuka/3_40.wav
95
+ ./dataset/44k/yuuka/98954.wav
96
+ ./dataset/44k/yuuka/8_11.wav
97
+ ./dataset/44k/yuuka/7_25.wav
98
+ ./dataset/44k/yuuka/4_43.wav
99
+ ./dataset/44k/yuuka/3_26.wav
100
+ ./dataset/44k/yuuka/7_23.wav
101
+ ./dataset/44k/yuuka/1_34.wav
102
+ ./dataset/44k/yuuka/3_24.wav
103
+ ./dataset/44k/yuuka/3_135.wav
104
+ ./dataset/44k/yuuka/4_33.wav
105
+ ./dataset/44k/yuuka/9_39.wav
106
+ ./dataset/44k/yuuka/52347.wav
107
+ ./dataset/44k/yuuka/3_54.wav
108
+ ./dataset/44k/yuuka/3_145.wav
109
+ ./dataset/44k/yuuka/1_13.wav
110
+ ./dataset/44k/yuuka/463536.wav
111
+ ./dataset/44k/yuuka/3_104.wav
112
+ ./dataset/44k/yuuka/2_20.wav
113
+ ./dataset/44k/yuuka/3_66.wav
114
+ ./dataset/44k/yuuka/7_182.wav
115
+ ./dataset/44k/yuuka/3_1.wav
116
+ ./dataset/44k/yuuka/5_63.wav
117
+ ./dataset/44k/yuuka/3_12.wav
118
+ ./dataset/44k/yuuka/audio_40.wav
119
+ ./dataset/44k/yuuka/7_127.wav
120
+ ./dataset/44k/yuuka/1_11.wav
121
+ ./dataset/44k/yuuka/audio_10.wav
122
+ ./dataset/44k/yuuka/490130.wav
123
+ ./dataset/44k/yuuka/3_162.wav
124
+ ./dataset/44k/yuuka/audio_11.wav
125
+ ./dataset/44k/yuuka/3_42.wav
126
+ ./dataset/44k/yuuka/635392.wav
127
+ ./dataset/44k/yuuka/7_52.wav
128
+ ./dataset/44k/yuuka/5_51.wav
129
+ ./dataset/44k/yuuka/8_6.wav
130
+ ./dataset/44k/yuuka/8_7.wav
131
+ ./dataset/44k/yuuka/8_1.wav
132
+ ./dataset/44k/yuuka/3_94.wav
133
+ ./dataset/44k/yuuka/1_10.wav
134
+ ./dataset/44k/yuuka/9_76.wav
135
+ ./dataset/44k/yuuka/7_160.wav
136
+ ./dataset/44k/yuuka/3_98.wav
137
+ ./dataset/44k/yuuka/553418.wav
138
+ ./dataset/44k/yuuka/3_53.wav
139
+ ./dataset/44k/yuuka/295642.wav
140
+ ./dataset/44k/yuuka/5_45.wav
141
+ ./dataset/44k/yuuka/5_50.wav
142
+ ./dataset/44k/yuuka/1_47.wav
143
+ ./dataset/44k/yuuka/4_50.wav
144
+ ./dataset/44k/yuuka/609212.wav
145
+ ./dataset/44k/yuuka/4_77.wav
146
+ ./dataset/44k/yuuka/5_13.wav
147
+ ./dataset/44k/yuuka/2_21.wav
148
+ ./dataset/44k/yuuka/9_25.wav
149
+ ./dataset/44k/yuuka/2_6.wav
150
+ ./dataset/44k/yuuka/4_1.wav
151
+ ./dataset/44k/yuuka/8_4.wav
152
+ ./dataset/44k/yuuka/1_14.wav
153
+ ./dataset/44k/yuuka/7_55.wav
154
+ ./dataset/44k/yuuka/3_90.wav
155
+ ./dataset/44k/yuuka/7_98.wav
156
+ ./dataset/44k/yuuka/1_26.wav
157
+ ./dataset/44k/yuuka/7_187.wav
158
+ ./dataset/44k/yuuka/622956.wav
159
+ ./dataset/44k/yuuka/4_37.wav
160
+ ./dataset/44k/yuuka/61332.wav
161
+ ./dataset/44k/yuuka/1_43.wav
162
+ ./dataset/44k/yuuka/233242.wav
163
+ ./dataset/44k/yuuka/audio_36.wav
164
+ ./dataset/44k/yuuka/2_3.wav
165
+ ./dataset/44k/yuuka/9_80.wav
166
+ ./dataset/44k/yuuka/3_14.wav
167
+ ./dataset/44k/yuuka/9_32.wav
168
+ ./dataset/44k/yuuka/audio_12.wav
169
+ ./dataset/44k/yuuka/7_164.wav
170
+ ./dataset/44k/yuuka/4_56.wav
171
+ ./dataset/44k/yuuka/5_36.wav
172
+ ./dataset/44k/yuuka/359799.wav
173
+ ./dataset/44k/yuuka/6_0.wav
174
+ ./dataset/44k/yuuka/5_85.wav
175
+ ./dataset/44k/yuuka/6_4.wav
176
+ ./dataset/44k/yuuka/537888.wav
177
+ ./dataset/44k/yuuka/7_108.wav
178
+ ./dataset/44k/yuuka/352307.wav
179
+ ./dataset/44k/yuuka/3_18.wav
180
+ ./dataset/44k/yuuka/3_51.wav
181
+ ./dataset/44k/yuuka/8_26.wav
182
+ ./dataset/44k/yuuka/7_49.wav
183
+ ./dataset/44k/yuuka/3_129.wav
184
+ ./dataset/44k/yuuka/2_13.wav
185
+ ./dataset/44k/yuuka/7_44.wav
186
+ ./dataset/44k/yuuka/3_50.wav
187
+ ./dataset/44k/yuuka/5_95.wav
188
+ ./dataset/44k/yuuka/audio_29.wav
189
+ ./dataset/44k/yuuka/6_21.wav
190
+ ./dataset/44k/yuuka/8_15.wav
191
+ ./dataset/44k/yuuka/963257.wav
192
+ ./dataset/44k/yuuka/7_95.wav
193
+ ./dataset/44k/yuuka/2_11.wav
194
+ ./dataset/44k/yuuka/4_38.wav
195
+ ./dataset/44k/yuuka/1_68.wav
196
+ ./dataset/44k/yuuka/1_58.wav
197
+ ./dataset/44k/yuuka/3_181.wav
198
+ ./dataset/44k/yuuka/3_29.wav
199
+ ./dataset/44k/yuuka/7_76.wav
200
+ ./dataset/44k/yuuka/2_24.wav
201
+ ./dataset/44k/yuuka/6_7.wav
202
+ ./dataset/44k/yuuka/7_134.wav
203
+ ./dataset/44k/yuuka/3_89.wav
204
+ ./dataset/44k/yuuka/audio_19.wav
205
+ ./dataset/44k/yuuka/3_41.wav
206
+ ./dataset/44k/yuuka/9_59.wav
207
+ ./dataset/44k/yuuka/7_56.wav
208
+ ./dataset/44k/yuuka/3_167.wav
209
+ ./dataset/44k/yuuka/1_31.wav
210
+ ./dataset/44k/yuuka/8_24.wav
211
+ ./dataset/44k/yuuka/4_54.wav
212
+ ./dataset/44k/yuuka/7_53.wav
213
+ ./dataset/44k/yuuka/7_120.wav
214
+ ./dataset/44k/yuuka/3_132.wav
215
+ ./dataset/44k/yuuka/9_11.wav
216
+ ./dataset/44k/yuuka/3_65.wav
217
+ ./dataset/44k/yuuka/5_8.wav
218
+ ./dataset/44k/yuuka/3_2.wav
219
+ ./dataset/44k/yuuka/519313.wav
220
+ ./dataset/44k/yuuka/audio_16.wav
221
+ ./dataset/44k/yuuka/283655.wav
222
+ ./dataset/44k/yuuka/6_41.wav
223
+ ./dataset/44k/yuuka/5_74.wav
224
+ ./dataset/44k/yuuka/5_88.wav
225
+ ./dataset/44k/yuuka/9_56.wav
226
+ ./dataset/44k/yuuka/2_23.wav
227
+ ./dataset/44k/yuuka/3_22.wav
228
+ ./dataset/44k/yuuka/4_41.wav
229
+ ./dataset/44k/yuuka/9_47.wav
230
+ ./dataset/44k/yuuka/4_5.wav
231
+ ./dataset/44k/yuuka/974105.wav
232
+ ./dataset/44k/yuuka/2_2.wav
233
+ ./dataset/44k/yuuka/86716.wav
234
+ ./dataset/44k/yuuka/300145.wav
235
+ ./dataset/44k/yuuka/9_60.wav
236
+ ./dataset/44k/yuuka/3_36.wav
237
+ ./dataset/44k/yuuka/3_77.wav
238
+ ./dataset/44k/yuuka/287748.wav
239
+ ./dataset/44k/yuuka/7_37.wav
240
+ ./dataset/44k/yuuka/3_11.wav
241
+ ./dataset/44k/yuuka/5_3.wav
242
+ ./dataset/44k/yuuka/1_62.wav
243
+ ./dataset/44k/yuuka/8_3.wav
244
+ ./dataset/44k/yuuka/audio_5.wav
245
+ ./dataset/44k/yuuka/9_14.wav
246
+ ./dataset/44k/yuuka/5_25.wav
247
+ ./dataset/44k/yuuka/5_24.wav
248
+ ./dataset/44k/yuuka/1_66.wav
249
+ ./dataset/44k/yuuka/484944.wav
250
+ ./dataset/44k/yuuka/171951.wav
251
+ ./dataset/44k/yuuka/102566.wav
252
+ ./dataset/44k/yuuka/3_27.wav
253
+ ./dataset/44k/yuuka/3_108.wav
254
+ ./dataset/44k/yuuka/audio_9.wav
255
+ ./dataset/44k/yuuka/4_80.wav
256
+ ./dataset/44k/yuuka/3_56.wav
257
+ ./dataset/44k/yuuka/9_63.wav
258
+ ./dataset/44k/yuuka/7_51.wav
259
+ ./dataset/44k/yuuka/1_51.wav
260
+ ./dataset/44k/yuuka/5_90.wav
261
+ ./dataset/44k/yuuka/356679.wav
262
+ ./dataset/44k/yuuka/724651.wav
263
+ ./dataset/44k/yuuka/7_65.wav
264
+ ./dataset/44k/yuuka/251091.wav
265
+ ./dataset/44k/yuuka/9_10.wav
266
+ ./dataset/44k/yuuka/7_2.wav
267
+ ./dataset/44k/yuuka/4_10.wav
268
+ ./dataset/44k/yuuka/3_182.wav
269
+ ./dataset/44k/yuuka/3_55.wav
270
+ ./dataset/44k/yuuka/1_9.wav
271
+ ./dataset/44k/yuuka/3_97.wav
272
+ ./dataset/44k/yuuka/1_25.wav
273
+ ./dataset/44k/yuuka/96411.wav
274
+ ./dataset/44k/yuuka/7_31.wav
275
+ ./dataset/44k/yuuka/427153.wav
276
+ ./dataset/44k/yuuka/4_48.wav
277
+ ./dataset/44k/yuuka/1_89.wav
278
+ ./dataset/44k/yuuka/audio_30.wav
279
+ ./dataset/44k/yuuka/135370.wav
280
+ ./dataset/44k/yuuka/7_166.wav
281
+ ./dataset/44k/yuuka/7_39.wav
282
+ ./dataset/44k/yuuka/4_39.wav
283
+ ./dataset/44k/yuuka/6_36.wav
284
+ ./dataset/44k/yuuka/8_9.wav
285
+ ./dataset/44k/yuuka/4_24.wav
286
+ ./dataset/44k/yuuka/4_72.wav
287
+ ./dataset/44k/yuuka/5_58.wav
288
+ ./dataset/44k/yuuka/7_162.wav
289
+ ./dataset/44k/yuuka/6_11.wav
290
+ ./dataset/44k/yuuka/audio_13.wav
291
+ ./dataset/44k/yuuka/3_67.wav
292
+ ./dataset/44k/yuuka/9_15.wav
293
+ ./dataset/44k/yuuka/3_93.wav
294
+ ./dataset/44k/yuuka/8_25.wav
295
+ ./dataset/44k/yuuka/1_74.wav
296
+ ./dataset/44k/yuuka/7_137.wav
297
+ ./dataset/44k/yuuka/9_74.wav
298
+ ./dataset/44k/yuuka/3_131.wav
299
+ ./dataset/44k/yuuka/3_31.wav
300
+ ./dataset/44k/yuuka/3_95.wav
301
+ ./dataset/44k/yuuka/445323.wav
302
+ ./dataset/44k/yuuka/1_48.wav
303
+ ./dataset/44k/yuuka/audio_23.wav
304
+ ./dataset/44k/yuuka/5_62.wav
305
+ ./dataset/44k/yuuka/5_67.wav
306
+ ./dataset/44k/yuuka/4_74.wav
307
+ ./dataset/44k/yuuka/audio_35.wav
308
+ ./dataset/44k/yuuka/9_3.wav
309
+ ./dataset/44k/yuuka/379745.wav
310
+ ./dataset/44k/yuuka/6_17.wav
311
+ ./dataset/44k/yuuka/audio_4.wav
312
+ ./dataset/44k/yuuka/3_160.wav
313
+ ./dataset/44k/yuuka/9_5.wav
314
+ ./dataset/44k/yuuka/9_22.wav
315
+ ./dataset/44k/yuuka/1_4.wav
316
+ ./dataset/44k/yuuka/2_1.wav
317
+ ./dataset/44k/yuuka/9_51.wav
318
+ ./dataset/44k/yuuka/6_38.wav
319
+ ./dataset/44k/yuuka/3_30.wav
320
+ ./dataset/44k/yuuka/3_180.wav
321
+ ./dataset/44k/yuuka/5_69.wav
322
+ ./dataset/44k/yuuka/3_44.wav
323
+ ./dataset/44k/yuuka/3_45.wav
324
+ ./dataset/44k/yuuka/7_17.wav
325
+ ./dataset/44k/yuuka/audio_41.wav
326
+ ./dataset/44k/yuuka/1_24.wav
327
+ ./dataset/44k/yuuka/7_132.wav
328
+ ./dataset/44k/yuuka/9_44.wav
329
+ ./dataset/44k/yuuka/9_43.wav
330
+ ./dataset/44k/yuuka/1_15.wav
331
+ ./dataset/44k/yuuka/469368.wav
332
+ ./dataset/44k/yuuka/144449.wav
333
+ ./dataset/44k/yuuka/2_7.wav
334
+ ./dataset/44k/yuuka/audio_17.wav
335
+ ./dataset/44k/yuuka/5_92.wav
336
+ ./dataset/44k/yuuka/7_96.wav
337
+ ./dataset/44k/yuuka/5_53.wav
338
+ ./dataset/44k/yuuka/6_20.wav
339
+ ./dataset/44k/yuuka/8_19.wav
340
+ ./dataset/44k/yuuka/5_12.wav
341
+ ./dataset/44k/yuuka/3_38.wav
342
+ ./dataset/44k/yuuka/7_57.wav
343
+ ./dataset/44k/yuuka/6_32.wav
344
+ ./dataset/44k/yuuka/3_48.wav
345
+ ./dataset/44k/yuuka/5_0.wav
346
+ ./dataset/44k/yuuka/7_1.wav
347
+ ./dataset/44k/yuuka/3_52.wav
348
+ ./dataset/44k/yuuka/7_135.wav
349
+ ./dataset/44k/yuuka/1_20.wav
350
+ ./dataset/44k/yuuka/206478.wav
351
+ ./dataset/44k/yuuka/7_6.wav
352
+ ./dataset/44k/yuuka/7_165.wav
353
+ ./dataset/44k/yuuka/271096.wav
354
+ ./dataset/44k/yuuka/1_17.wav
355
+ ./dataset/44k/yuuka/6_9.wav
356
+ ./dataset/44k/yuuka/3_122.wav
357
+ ./dataset/44k/yuuka/7_10.wav
358
+ ./dataset/44k/yuuka/audio_38.wav
359
+ ./dataset/44k/yuuka/507694.wav
360
+ ./dataset/44k/yuuka/1_28.wav
361
+ ./dataset/44k/yuuka/9_7.wav
362
+ ./dataset/44k/yuuka/8_27.wav
363
+ ./dataset/44k/yuuka/7_8.wav
364
+ ./dataset/44k/yuuka/8_29.wav
365
+ ./dataset/44k/yuuka/2_12.wav
366
+ ./dataset/44k/yuuka/8_12.wav
367
+ ./dataset/44k/yuuka/7_26.wav
368
+ ./dataset/44k/yuuka/4_9.wav
369
+ ./dataset/44k/yuuka/3_21.wav
370
+ ./dataset/44k/yuuka/3_61.wav
371
+ ./dataset/44k/yuuka/64918.wav
372
+ ./dataset/44k/yuuka/7_172.wav
373
+ ./dataset/44k/yuuka/5_27.wav
374
+ ./dataset/44k/yuuka/256460.wav
375
+ ./dataset/44k/yuuka/1_7.wav
376
+ ./dataset/44k/yuuka/7_185.wav
377
+ ./dataset/44k/yuuka/3_62.wav
378
+ ./dataset/44k/yuuka/5_40.wav
379
+ ./dataset/44k/yuuka/6_30.wav
380
+ ./dataset/44k/yuuka/7_32.wav
381
+ ./dataset/44k/yuuka/4_76.wav
382
+ ./dataset/44k/yuuka/3_185.wav
383
+ ./dataset/44k/yuuka/622091.wav
384
+ ./dataset/44k/yuuka/3_33.wav
385
+ ./dataset/44k/yuuka/9_70.wav
386
+ ./dataset/44k/yuuka/9_66.wav
387
+ ./dataset/44k/yuuka/7_40.wav
388
+ ./dataset/44k/yuuka/813875.wav
389
+ ./dataset/44k/yuuka/7_176.wav
390
+ ./dataset/44k/yuuka/4_55.wav
391
+ ./dataset/44k/yuuka/3_91.wav
392
+ ./dataset/44k/yuuka/4_4.wav
393
+ ./dataset/44k/yuuka/5_72.wav
394
+ ./dataset/44k/yuuka/551231.wav
395
+ ./dataset/44k/yuuka/7_64.wav
396
+ ./dataset/44k/yuuka/7_143.wav
397
+ ./dataset/44k/yuuka/1_37.wav
398
+ ./dataset/44k/yuuka/5_54.wav
399
+ ./dataset/44k/yuuka/5_26.wav
400
+ ./dataset/44k/yuuka/audio_0.wav
401
+ ./dataset/44k/yuuka/3_125.wav
402
+ ./dataset/44k/yuuka/1_41.wav
403
+ ./dataset/44k/yuuka/7_142.wav
404
+ ./dataset/44k/yuuka/4_23.wav
405
+ ./dataset/44k/yuuka/3_184.wav
406
+ ./dataset/44k/yuuka/6_6.wav
407
+ ./dataset/44k/yuuka/9_73.wav
408
+ ./dataset/44k/yuuka/3_166.wav
409
+ ./dataset/44k/yuuka/2_28.wav
410
+ ./dataset/44k/yuuka/9_0.wav
411
+ ./dataset/44k/yuuka/1_12.wav
412
+ ./dataset/44k/yuuka/6_18.wav
413
+ ./dataset/44k/yuuka/349028.wav
414
+ ./dataset/44k/yuuka/547091.wav
415
+ ./dataset/44k/yuuka/audio_14.wav
416
+ ./dataset/44k/yuuka/5_34.wav
417
+ ./dataset/44k/yuuka/4_19.wav
418
+ ./dataset/44k/yuuka/7_27.wav
419
+ ./dataset/44k/yuuka/7_20.wav
420
+ ./dataset/44k/yuuka/9_35.wav
421
+ ./dataset/44k/yuuka/8_16.wav
422
+ ./dataset/44k/yuuka/7_102.wav
423
+ ./dataset/44k/yuuka/3_6.wav
424
+ ./dataset/44k/yuuka/798678.wav
425
+ ./dataset/44k/yuuka/915260.wav
426
+ ./dataset/44k/yuuka/7_103.wav
427
+ ./dataset/44k/yuuka/5_18.wav
428
+ ./dataset/44k/yuuka/3_13.wav
429
+ ./dataset/44k/yuuka/7_85.wav
430
+ ./dataset/44k/yuuka/85191.wav
431
+ ./dataset/44k/yuuka/5_76.wav
432
+ ./dataset/44k/yuuka/3_4.wav
433
+ ./dataset/44k/yuuka/3_142.wav
434
+ ./dataset/44k/yuuka/4_59.wav
435
+ ./dataset/44k/yuuka/711779.wav
436
+ ./dataset/44k/yuuka/7_104.wav
437
+ ./dataset/44k/yuuka/7_129.wav
438
+ ./dataset/44k/yuuka/470902.wav
439
+ ./dataset/44k/yuuka/1_49.wav
440
+ ./dataset/44k/yuuka/7_11.wav
441
+ ./dataset/44k/yuuka/6_1.wav
442
+ ./dataset/44k/yuuka/1_67.wav
443
+ ./dataset/44k/yuuka/7_170.wav
444
+ ./dataset/44k/yuuka/1_39.wav
445
+ ./dataset/44k/yuuka/550982.wav
446
+ ./dataset/44k/yuuka/7_125.wav
447
+ ./dataset/44k/yuuka/9_75.wav
448
+ ./dataset/44k/yuuka/8_21.wav
449
+ ./dataset/44k/yuuka/3_0.wav
450
+ ./dataset/44k/yuuka/1_18.wav
451
+ ./dataset/44k/yuuka/audio_42.wav
452
+ ./dataset/44k/yuuka/5_20.wav
453
+ ./dataset/44k/yuuka/4_46.wav
454
+ ./dataset/44k/yuuka/253501.wav
455
+ ./dataset/44k/yuuka/7_184.wav
456
+ ./dataset/44k/yuuka/8_30.wav
457
+ ./dataset/44k/yuuka/2_0.wav
458
+ ./dataset/44k/yuuka/7_140.wav
459
+ ./dataset/44k/yuuka/9_77.wav
460
+ ./dataset/44k/yuuka/7_89.wav
461
+ ./dataset/44k/yuuka/56932.wav
462
+ ./dataset/44k/yuuka/audio_32.wav
463
+ ./dataset/44k/yuuka/7_29.wav
464
+ ./dataset/44k/yuuka/7_50.wav
465
+ ./dataset/44k/yuuka/9_64.wav
466
+ ./dataset/44k/yuuka/3_34.wav
467
+ ./dataset/44k/yuuka/4_36.wav
468
+ ./dataset/44k/yuuka/1_38.wav
469
+ ./dataset/44k/yuuka/9_34.wav
470
+ ./dataset/44k/yuuka/705069.wav
471
+ ./dataset/44k/yuuka/7_54.wav
472
+ ./dataset/44k/yuuka/3_121.wav
473
+ ./dataset/44k/yuuka/7_177.wav
474
+ ./dataset/44k/yuuka/audio_3.wav
475
+ ./dataset/44k/yuuka/437916.wav
476
+ ./dataset/44k/yuuka/7_169.wav
477
+ ./dataset/44k/yuuka/6_24.wav
478
+ ./dataset/44k/yuuka/2_5.wav
479
+ ./dataset/44k/yuuka/5_48.wav
480
+ ./dataset/44k/yuuka/3_47.wav
481
+ ./dataset/44k/yuuka/3_78.wav
482
+ ./dataset/44k/yuuka/3_187.wav
483
+ ./dataset/44k/yuuka/7_124.wav
484
+ ./dataset/44k/yuuka/3_169.wav
485
+ ./dataset/44k/yuuka/321860.wav
486
+ ./dataset/44k/yuuka/5_46.wav
487
+ ./dataset/44k/yuuka/3_86.wav
488
+ ./dataset/44k/yuuka/3_87.wav
489
+ ./dataset/44k/yuuka/1_83.wav
490
+ ./dataset/44k/yuuka/1_36.wav
491
+ ./dataset/44k/yuuka/1_116.wav
492
+ ./dataset/44k/yuuka/687395.wav
493
+ ./dataset/44k/yuuka/1_35.wav
494
+ ./dataset/44k/yuuka/7_186.wav
495
+ ./dataset/44k/yuuka/9_49.wav
496
+ ./dataset/44k/yuuka/8_18.wav
497
+ ./dataset/44k/yuuka/6_14.wav
498
+ ./dataset/44k/yuuka/5_4.wav
499
+ ./dataset/44k/yuuka/9_58.wav
500
+ ./dataset/44k/yuuka/498387.wav
501
+ ./dataset/44k/yuuka/5_42.wav
502
+ ./dataset/44k/yuuka/3_17.wav
503
+ ./dataset/44k/yuuka/4_3.wav
504
+ ./dataset/44k/yuuka/7_24.wav
505
+ ./dataset/44k/yuuka/314228.wav
506
+ ./dataset/44k/yuuka/652599.wav
507
+ ./dataset/44k/yuuka/7_28.wav
508
+ ./dataset/44k/yuuka/3_140.wav
509
+ ./dataset/44k/yuuka/7_3.wav
510
+ ./dataset/44k/yuuka/915926.wav
511
+ ./dataset/44k/yuuka/3_183.wav
512
+ ./dataset/44k/yuuka/7_13.wav
513
+ ./dataset/44k/yuuka/3_137.wav
514
+ ./dataset/44k/yuuka/968783.wav
515
+ ./dataset/44k/yuuka/1_52.wav
516
+ ./dataset/44k/yuuka/4_66.wav
517
+ ./dataset/44k/yuuka/5_2.wav
518
+ ./dataset/44k/yuuka/5_9.wav
519
+ ./dataset/44k/yuuka/5_70.wav
520
+ ./dataset/44k/yuuka/7_83.wav
521
+ ./dataset/44k/yuuka/8_17.wav
522
+ ./dataset/44k/yuuka/5_7.wav
523
+ ./dataset/44k/yuuka/1_70.wav
524
+ ./dataset/44k/yuuka/5_89.wav
525
+ ./dataset/44k/yuuka/3_9.wav
526
+ ./dataset/44k/yuuka/3_84.wav
527
+ ./dataset/44k/yuuka/1_29.wav
528
+ ./dataset/44k/yuuka/6_15.wav
529
+ ./dataset/44k/yuuka/884738.wav
530
+ ./dataset/44k/yuuka/1_72.wav
531
+ ./dataset/44k/yuuka/168875.wav
532
+ ./dataset/44k/yuuka/833141.wav
533
+ ./dataset/44k/yuuka/7_68.wav
534
+ ./dataset/44k/yuuka/7_41.wav
535
+ ./dataset/44k/yuuka/4_0.wav
536
+ ./dataset/44k/yuuka/7_48.wav
537
+ ./dataset/44k/yuuka/9_81.wav
538
+ ./dataset/44k/yuuka/4_44.wav
539
+ ./dataset/44k/yuuka/958019.wav
540
+ ./dataset/44k/yuuka/9_50.wav
541
+ ./dataset/44k/yuuka/5_68.wav
542
+ ./dataset/44k/yuuka/3_32.wav
543
+ ./dataset/44k/yuuka/7_106.wav
544
+ ./dataset/44k/yuuka/1_16.wav
545
+ ./dataset/44k/yuuka/5_16.wav
546
+ ./dataset/44k/yuuka/3_20.wav
547
+ ./dataset/44k/yuuka/502529.wav
548
+ ./dataset/44k/yuuka/237547.wav
549
+ ./dataset/44k/yuuka/3_186.wav
550
+ ./dataset/44k/yuuka/audio_27.wav
551
+ ./dataset/44k/yuuka/5_5.wav
552
+ ./dataset/44k/yuuka/7_35.wav
553
+ ./dataset/44k/yuuka/3_120.wav
554
+ ./dataset/44k/yuuka/5_59.wav
555
+ ./dataset/44k/yuuka/7_78.wav
556
+ ./dataset/44k/yuuka/650180.wav
557
+ ./dataset/44k/yuuka/audio_24.wav
558
+ ./dataset/44k/yuuka/678092.wav
559
+ ./dataset/44k/yuuka/6_2.wav
560
+ ./dataset/44k/yuuka/5_23.wav
561
+ ./dataset/44k/yuuka/1_88.wav
562
+ ./dataset/44k/yuuka/240071.wav
563
+ ./dataset/44k/yuuka/1_46.wav
564
+ ./dataset/44k/yuuka/15940.wav
565
+ ./dataset/44k/yuuka/8_22.wav
566
+ ./dataset/44k/yuuka/4_2.wav
567
+ ./dataset/44k/yuuka/5_93.wav
568
+ ./dataset/44k/yuuka/7_87.wav
569
+ ./dataset/44k/yuuka/454791.wav
570
+ ./dataset/44k/yuuka/5_73.wav
571
+ ./dataset/44k/yuuka/1_0.wav
572
+ ./dataset/44k/yuuka/7_4.wav
573
+ ./dataset/44k/yuuka/9_1.wav
574
+ ./dataset/44k/yuuka/586033.wav
575
+ ./dataset/44k/yuuka/1_23.wav
576
+ ./dataset/44k/yuuka/2_27.wav
577
+ ./dataset/44k/yuuka/5_38.wav
578
+ ./dataset/44k/yuuka/4_34.wav
579
+ ./dataset/44k/yuuka/347125.wav
580
+ ./dataset/44k/yuuka/2_15.wav
581
+ ./dataset/44k/yuuka/6_12.wav
582
+ ./dataset/44k/yuuka/1_84.wav
583
+ ./dataset/44k/yuuka/975179.wav
584
+ ./dataset/44k/yuuka/2_25.wav
585
+ ./dataset/44k/yuuka/4_65.wav
586
+ ./dataset/44k/yuuka/9_72.wav
587
+ ./dataset/44k/yuuka/6_8.wav
588
+ ./dataset/44k/yuuka/380298.wav
589
+ ./dataset/44k/yuuka/1_56.wav
590
+ ./dataset/44k/yuuka/1_5.wav
591
+ ./dataset/44k/yuuka/1_94.wav
592
+ ./dataset/44k/yuuka/7_86.wav
593
+ ./dataset/44k/yuuka/7_42.wav
594
+ ./dataset/44k/yuuka/1_64.wav
595
+ ./dataset/44k/yuuka/5_115.wav
596
+ ./dataset/44k/yuuka/audio_26.wav
597
+ ./dataset/44k/yuuka/4_63.wav
598
+ ./dataset/44k/yuuka/5_83.wav
599
+ ./dataset/44k/yuuka/5_64.wav
600
+ ./dataset/44k/yuuka/7_150.wav
601
+ ./dataset/44k/yuuka/7_179.wav
602
+ ./dataset/44k/yuuka/6_35.wav
603
+ ./dataset/44k/yuuka/7_9.wav
604
+ ./dataset/44k/yuuka/3_127.wav
605
+ ./dataset/44k/yuuka/1_21.wav
606
+ ./dataset/44k/yuuka/5_31.wav
607
+ ./dataset/44k/yuuka/5_78.wav
608
+ ./dataset/44k/yuuka/9_6.wav
609
+ ./dataset/44k/yuuka/4_71.wav
610
+ ./dataset/44k/yuuka/2_9.wav
611
+ ./dataset/44k/yuuka/617112.wav
612
+ ./dataset/44k/yuuka/8_28.wav
613
+ ./dataset/44k/yuuka/5_11.wav
614
+ ./dataset/44k/yuuka/832708.wav
615
+ ./dataset/44k/yuuka/8_0.wav
616
+ ./dataset/44k/yuuka/540598.wav
617
+ ./dataset/44k/yuuka/7_38.wav
618
+ ./dataset/44k/yuuka/1_71.wav
619
+ ./dataset/44k/yuuka/6_37.wav
620
+ ./dataset/44k/yuuka/394815.wav
621
+ ./dataset/44k/yuuka/9_24.wav
622
+ ./dataset/44k/yuuka/5_49.wav
623
+ ./dataset/44k/yuuka/3_103.wav
624
+ ./dataset/44k/yuuka/1_90.wav
625
+ ./dataset/44k/yuuka/9_13.wav
626
+ ./dataset/44k/yuuka/66052.wav
627
+ ./dataset/44k/yuuka/1_96.wav
628
+ ./dataset/44k/yuuka/3_141.wav
629
+ ./dataset/44k/yuuka/1_40.wav
630
+ ./dataset/44k/yuuka/2_17.wav
631
+ ./dataset/44k/yuuka/7_88.wav
632
+ ./dataset/44k/yuuka/386393.wav
633
+ ./dataset/44k/yuuka/2_10.wav
634
+ ./dataset/44k/yuuka/4_79.wav
635
+ ./dataset/44k/yuuka/9_33.wav
636
+ ./dataset/44k/yuuka/7_91.wav
637
+ ./dataset/44k/yuuka/audio_33.wav
638
+ ./dataset/44k/yuuka/7_0.wav
639
+ ./dataset/44k/yuuka/3_138.wav
640
+ ./dataset/44k/yuuka/872587.wav
641
+ ./dataset/44k/yuuka/7_122.wav
642
+ ./dataset/44k/yuuka/40927.wav
643
+ ./dataset/44k/yuuka/5_33.wav
644
+ ./dataset/44k/yuuka/4_11.wav
645
+ ./dataset/44k/yuuka/4_40.wav
646
+ ./dataset/44k/yuuka/3_28.wav
647
+ ./dataset/44k/yuuka/audio_37.wav
648
+ ./dataset/44k/yuuka/228114.wav
649
+ ./dataset/44k/yuuka/629546.wav
650
+ ./dataset/44k/yuuka/1_100.wav
651
+ ./dataset/44k/yuuka/4_62.wav
652
+ ./dataset/44k/yuuka/1_6.wav
653
+ ./dataset/44k/yuuka/650930.wav
654
+ ./dataset/44k/yuuka/7_121.wav
655
+ ./dataset/44k/yuuka/1_95.wav
656
+ ./dataset/44k/yuuka/audio_20.wav
657
+ ./dataset/44k/yuuka/752079.wav
658
+ ./dataset/44k/yuuka/7_33.wav
659
+ ./dataset/44k/yuuka/1_99.wav
660
+ ./dataset/44k/yuuka/5_1.wav
661
+ ./dataset/44k/yuuka/571895.wav
662
+ ./dataset/44k/yuuka/3_8.wav
663
+ ./dataset/44k/yuuka/5_99.wav
664
+ ./dataset/44k/yuuka/5_14.wav
665
+ ./dataset/44k/yuuka/3_68.wav
666
+ ./dataset/44k/yuuka/7_161.wav
667
+ ./dataset/44k/yuuka/2_16.wav
668
+ ./dataset/44k/yuuka/audio_2.wav
669
+ ./dataset/44k/yuuka/2_4.wav
670
+ ./dataset/44k/yuuka/1_3.wav
671
+ ./dataset/44k/yuuka/260935.wav
672
+ ./dataset/44k/yuuka/3_152.wav
673
+ ./dataset/44k/yuuka/4_35.wav
674
+ ./dataset/44k/yuuka/617923.wav
675
+ ./dataset/44k/yuuka/5_98.wav
676
+ ./dataset/44k/yuuka/4_49.wav
677
+ ./dataset/44k/yuuka/audio_43.wav
678
+ ./dataset/44k/yuuka/73560.wav
679
+ ./dataset/44k/yuuka/3_144.wav
680
+ ./dataset/44k/yuuka/5_82.wav
681
+ ./dataset/44k/yuuka/4_7.wav
682
+ ./dataset/44k/yuuka/651496.wav
683
+ ./dataset/44k/yuuka/3_49.wav
684
+ ./dataset/44k/yuuka/audio_6.wav
685
+ ./dataset/44k/yuuka/9_71.wav
686
+ ./dataset/44k/yuuka/1_59.wav
687
+ ./dataset/44k/yuuka/3_25.wav
688
+ ./dataset/44k/yuuka/7_92.wav
689
+ ./dataset/44k/yuuka/7_46.wav
690
+ ./dataset/44k/yuuka/4_73.wav
691
+ ./dataset/44k/yuuka/7_136.wav
692
+ ./dataset/44k/yuuka/9_79.wav
693
+ ./dataset/44k/yuuka/3_175.wav
694
+ ./dataset/44k/yuuka/9_41.wav
695
+ ./dataset/44k/yuuka/9_31.wav
696
+ ./dataset/44k/yuuka/761979.wav
697
+ ./dataset/44k/yuuka/3_83.wav
698
+ ./dataset/44k/yuuka/3_177.wav
699
+ ./dataset/44k/yuuka/7_163.wav
700
+ ./dataset/44k/yuuka/3_43.wav
701
+ ./dataset/44k/yuuka/3_37.wav
702
+ ./dataset/44k/yuuka/8_2.wav
703
+ ./dataset/44k/yuuka/8_10.wav
704
+ ./dataset/44k/yuuka/820939.wav
705
+ ./dataset/44k/yuuka/778182.wav
706
+ ./dataset/44k/yuuka/6_31.wav
707
+ ./dataset/44k/yuuka/3_164.wav
708
+ ./dataset/44k/yuuka/5_32.wav
709
+ ./dataset/44k/yuuka/215854.wav
710
+ ./dataset/44k/yuuka/6_5.wav
711
+ ./dataset/44k/yuuka/3_109.wav
712
+ ./dataset/44k/yuuka/6_42.wav
713
+ ./dataset/44k/yuuka/188142.wav
714
+ ./dataset/44k/yuuka/6_40.wav
715
+ ./dataset/44k/yuuka/4_30.wav
716
+ ./dataset/44k/yuuka/3_161.wav
717
+ ./dataset/44k/yuuka/7_62.wav
718
+ ./dataset/44k/yuuka/2_22.wav
719
+ ./dataset/44k/yuuka/4_69.wav
720
+ ./dataset/44k/yuuka/4_6.wav
721
+ ./dataset/44k/yuuka/577791.wav
722
+ ./dataset/44k/yuuka/723735.wav
723
+ ./dataset/44k/yuuka/7_90.wav
724
+ ./dataset/44k/yuuka/5_96.wav
725
+ ./dataset/44k/yuuka/1_82.wav
726
+ ./dataset/44k/yuuka/225368.wav
727
+ ./dataset/44k/yuuka/audio_31.wav
728
+ ./dataset/44k/yuuka/3_130.wav
729
+ ./dataset/44k/yuuka/audio_39.wav
730
+ ./dataset/44k/yuuka/7_153.wav
731
+ ./dataset/44k/yuuka/7_183.wav
732
+ ./dataset/44k/yuuka/870812.wav
733
+ ./dataset/44k/yuuka/5_114.wav
734
+ ./dataset/44k/yuuka/719896.wav
735
+ ./dataset/44k/yuuka/5_65.wav
736
+ ./dataset/44k/yuuka/269297.wav
737
+ ./dataset/44k/yuuka/3_124.wav
738
+ ./dataset/44k/yuuka/9_57.wav
739
+ ./dataset/44k/yuuka/7_18.wav
740
+ ./dataset/44k/yuuka/619226.wav
741
+ ./dataset/44k/yuuka/207781.wav
742
+ ./dataset/44k/yuuka/5_28.wav
743
+ ./dataset/44k/yuuka/5_71.wav
744
+ ./dataset/44k/yuuka/143646.wav
745
+ ./dataset/44k/yuuka/383188.wav
746
+ ./dataset/44k/yuuka/7_131.wav
747
+ ./dataset/44k/yuuka/3_92.wav
748
+ ./dataset/44k/yuuka/892318.wav
749
+ ./dataset/44k/yuuka/1_57.wav
750
+ ./dataset/44k/yuuka/audio_21.wav
751
+ ./dataset/44k/yuuka/4_57.wav
752
+ ./dataset/44k/yuuka/3_96.wav
753
+ ./dataset/44k/yuuka/7_12.wav
754
+ ./dataset/44k/yuuka/6_29.wav
755
+ ./dataset/44k/yuuka/3_3.wav
756
+ ./dataset/44k/yuuka/7_97.wav
757
+ ./dataset/44k/yuuka/1_54.wav
758
+ ./dataset/44k/yuuka/9_78.wav
759
+ ./dataset/44k/yuuka/76879.wav
760
+ ./dataset/44k/yuuka/3_123.wav
761
+ ./dataset/44k/yuuka/1_91.wav
762
+ ./dataset/44k/yuuka/7_138.wav
763
+ ./dataset/44k/yuuka/7_77.wav
764
+ ./dataset/44k/yuuka/5_55.wav
765
+ ./dataset/44k/yuuka/2_29.wav
766
+ ./dataset/44k/yuuka/2_19.wav
767
+ ./dataset/44k/yuuka/4_45.wav
768
+ ./dataset/44k/yuuka/7_84.wav
769
+ ./dataset/44k/yuuka/3_143.wav
770
+ ./dataset/44k/yuuka/1_8.wav
771
+ ./dataset/44k/yuuka/3_64.wav
772
+ ./dataset/44k/yuuka/1_30.wav
773
+ ./dataset/44k/yuuka/3_10.wav
774
+ ./dataset/44k/yuuka/854231.wav
775
+ ./dataset/44k/yuuka/6_26.wav
776
+ ./dataset/44k/yuuka/3_23.wav
777
+ ./dataset/44k/yuuka/5_44.wav
778
+ ./dataset/44k/yuuka/7_45.wav
779
+ ./dataset/44k/yuuka/5_10.wav
780
+ ./dataset/44k/yuuka/7_180.wav
781
+ ./dataset/44k/yuuka/9_12.wav
782
+ ./dataset/44k/yuuka/audio_8.wav
783
+ ./dataset/44k/yuuka/3_35.wav
784
+ ./dataset/44k/yuuka/565217.wav
785
+ ./dataset/44k/yuuka/7_63.wav
786
+ ./dataset/44k/yuuka/5_75.wav
787
+ ./dataset/44k/yuuka/1_2.wav
788
+ ./dataset/44k/yuuka/9_8.wav
789
+ ./dataset/44k/yuuka/5_94.wav
790
+ ./dataset/44k/yuuka/1_75.wav
791
+ ./dataset/44k/yuuka/8_8.wav
792
+ ./dataset/44k/yuuka/7_141.wav
793
+ ./dataset/44k/yuuka/5_17.wav
794
+ ./dataset/44k/yuuka/853514.wav
795
+ ./dataset/44k/yuuka/4_78.wav
796
+ ./dataset/44k/yuuka/5_116.wav
797
+ ./dataset/44k/yuuka/448774.wav
798
+ ./dataset/44k/yuuka/8_13.wav
799
+ ./dataset/44k/yuuka/4_13.wav
800
+ ./dataset/44k/yuuka/4_8.wav
801
+ ./dataset/44k/yuuka/5_60.wav
802
+ ./dataset/44k/yuuka/321094.wav
803
+ ./dataset/44k/yuuka/859348.wav
804
+ ./dataset/44k/yuuka/9_19.wav
805
+ ./dataset/44k/yuuka/1_27.wav
806
+ ./dataset/44k/yuuka/4_58.wav
807
+ ./dataset/44k/yuuka/1_53.wav
808
+ ./dataset/44k/yuuka/522647.wav
809
+ ./dataset/44k/yuuka/73298.wav
810
+ ./dataset/44k/yuuka/9_2.wav
811
+ ./dataset/44k/yuuka/3_139.wav
812
+ ./dataset/44k/yuuka/9_55.wav
813
+ ./dataset/44k/yuuka/1_115.wav
814
+ ./dataset/44k/yuuka/796714.wav
815
+ ./dataset/44k/yuuka/5_43.wav
816
+ ./dataset/44k/yuuka/3_57.wav
817
+ ./dataset/44k/yuuka/4_70.wav
818
+ ./dataset/44k/yuuka/4_81.wav
819
+ ./dataset/44k/yuuka/4_31.wav
820
+ ./dataset/44k/yuuka/3_88.wav
821
+ ./dataset/44k/yuuka/5_57.wav
822
+ ./dataset/44k/yuuka/6_19.wav
823
+ ./dataset/44k/yuuka/6_10.wav
824
+ ./dataset/44k/yuuka/9_20.wav
825
+ ./dataset/44k/yuuka/5_37.wav
826
+ ./dataset/44k/yuuka/6_43.wav
827
+ ./dataset/44k/yuuka/9_23.wav
828
+ ./dataset/44k/yuuka/7_60.wav
829
+ ./dataset/44k/yuuka/3_159.wav
830
+ ./dataset/44k/yuuka/182426.wav
831
+ ./dataset/44k/yuuka/1_50.wav
832
+ ./dataset/44k/yuuka/5_81.wav
833
+ ./dataset/44k/yuuka/4_64.wav
834
+ ./dataset/44k/yuuka/5_84.wav
835
+ ./dataset/44k/yuuka/5_29.wav
836
+ ./dataset/44k/yuuka/2_8.wav
837
+ ./dataset/44k/yuuka/4_32.wav
838
+ ./dataset/44k/yuuka/7_47.wav
839
+ ./dataset/44k/yuuka/7_109.wav
840
+ ./dataset/44k/yuuka/130059.wav
841
+ ./dataset/44k/yuuka/1_42.wav
842
+ ./dataset/44k/yuuka/5_47.wav
843
+ ./dataset/44k/yuuka/9_40.wav
844
+ ./dataset/44k/yuuka/4_75.wav
845
+ ./dataset/44k/yuuka/1_63.wav
846
+ ./dataset/44k/yuuka/9_9.wav
847
+ ./dataset/44k/yuuka/208859.wav
848
+ ./dataset/44k/yuuka/5_56.wav
849
+ ./dataset/44k/yuuka/9_36.wav
850
+ ./dataset/44k/yuuka/187864.wav
851
+ ./dataset/44k/yuuka/7_21.wav
852
+ ./dataset/44k/yuuka/7_144.wav
853
+ ./dataset/44k/yuuka/7_22.wav
854
+ ./dataset/44k/yuuka/7_34.wav
855
+ ./dataset/44k/yuuka/1_65.wav
856
+ ./dataset/44k/yuuka/6_28.wav
857
+ ./dataset/44k/yuuka/7_19.wav
filelists/val.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ ./dataset/44k/yuuka/3_106.wav
2
+ ./dataset/44k/yuuka/3_7.wav
flask_api.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import io
2
+ import logging
3
+
4
+ import librosa
5
+ import soundfile
6
+ import paddle
7
+ import paddle.audio as paddleaudio
8
+ from flask import Flask, request, send_file
9
+ from flask_cors import CORS
10
+
11
+ from inference.infer_tool import Svc, RealTimeVC
12
+
13
+ app = Flask(__name__)
14
+
15
+ CORS(app)
16
+
17
+ logging.getLogger('numba').setLevel(logging.WARNING)
18
+
19
+
20
+ @app.route("/voiceChangeModel", methods=["POST"])
21
+ def voice_change_model():
22
+ request_form = request.form
23
+ wave_file = request.files.get("sample", None)
24
+ # 变调信息
25
+ f_pitch_change = float(request_form.get("fPitchChange", 0))
26
+ # DAW所需的采样率
27
+ daw_sample = int(float(request_form.get("sampleRate", 0)))
28
+ speaker_id = int(float(request_form.get("sSpeakId", 0)))
29
+ # http获得wav文件并转换
30
+ input_wav_path = io.BytesIO(wave_file.read())
31
+
32
+ # 模型推理
33
+ if raw_infer:
34
+ out_audio, out_sr = svc_model.infer(speaker_id, f_pitch_change, input_wav_path)
35
+ tar_audio = librosa.resample(out_audio.numpy(), svc_model.target_sample, daw_sample)
36
+ else:
37
+ out_audio = svc.process(svc_model, speaker_id, f_pitch_change, input_wav_path)
38
+ tar_audio = librosa.resample(out_audio, svc_model.target_sample, daw_sample)
39
+ # 返回音频
40
+ out_wav_path = io.BytesIO()
41
+ soundfile.write(out_wav_path, tar_audio, daw_sample, format="wav")
42
+ out_wav_path.seek(0)
43
+ return send_file(out_wav_path, download_name="temp.wav", as_attachment=True)
44
+
45
+
46
+ if __name__ == '__main__':
47
+ # 启用则为直接切片合成,False为交叉淡化方式
48
+ # vst插件调整0.3-0.5s切片时间可以降低延迟,直接切片方法会有连接处爆音、交叉淡化会有轻微重叠声音
49
+ # 自行选择能接受的方法,或将vst最大切片时间调整为1s,此处设为Ture,延迟大音质稳定一些
50
+ raw_infer = True
51
+ # 每个模型和config是唯一对应的
52
+ model_name = "logs/44k/G_1005.pdparams"
53
+ config_name = "configs/config.json"
54
+ svc_model = Svc(model_name, config_name)
55
+ svc = RealTimeVC()
56
+ # 此处与vst插件对应,不建议更改
57
+ app.run(port=6842, host="0.0.0.0", debug=False, threaded=False)
hubert/__init__.py ADDED
File without changes
hubert/hubert4.0.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cc348818d386f8cff3332ab4bcd77e5870c373c492c896664092fd7230122a32
3
+ size 293347531
hubert/hubert_model.py ADDED
@@ -0,0 +1,226 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import copy
2
+ import random
3
+ from typing import Optional, Tuple
4
+
5
+ import paddle
6
+ import paddle.nn as nn
7
+ import paddle.nn.functional as t_func
8
+ #from torch.nn.modules.utils import consume_prefix_in_state_dict_if_present
9
+
10
+
11
+ class Hubert(paddle.nn.Layer):
12
+ def __init__(self, num_label_embeddings: int = 100, mask: bool = True):
13
+ super().__init__()
14
+ self._mask = mask
15
+ self.feature_extractor = FeatureExtractor()
16
+ self.feature_projection = FeatureProjection()
17
+ self.positional_embedding = PositionalConvEmbedding()
18
+ self.norm = nn.LayerNorm(768)
19
+ self.dropout = nn.Dropout(0.1)
20
+ self.encoder = TransformerEncoder(
21
+ nn.TransformerEncoderLayer(
22
+ 768, 12, 3072, activation="gelu"
23
+ ),
24
+ 12,
25
+ )
26
+ self.proj = nn.Linear(768, 256)
27
+
28
+ self.masked_spec_embed = paddle.create_parameter([768],dtype = 'float32')
29
+ self.label_embedding = nn.Embedding(num_label_embeddings, 256)
30
+
31
+ def mask(self, x: paddle.Tensor) -> Tuple[paddle.Tensor, paddle.Tensor]:
32
+ mask = None
33
+ if self.training and self._mask:
34
+ mask = _compute_mask((x.size(0), x.size(1)), 0.8, 10, None, 2)
35
+ x[mask] = self.masked_spec_embed
36
+ return x, mask
37
+
38
+ def encode(
39
+ self, x: paddle.Tensor, layer: Optional[int] = None
40
+ ) -> Tuple[paddle.Tensor, paddle.Tensor]:
41
+ x = self.feature_extractor(x)
42
+ x = self.feature_projection(x.transpose([0, 2, 1]))
43
+ x, mask = self.mask(x)
44
+ x = x + self.positional_embedding(x)
45
+ x = self.dropout(self.norm(x))
46
+ x = self.encoder(x, output_layer=layer)
47
+ return x, mask
48
+
49
+ def logits(self, x: paddle.Tensor) -> paddle.Tensor:
50
+ logits = t_func.cosine_similarity(
51
+ x.unsqueeze(2),
52
+ self.label_embedding.weight.unsqueeze(0).unsqueeze(0),
53
+ axis=-1,
54
+ )
55
+ return logits / 0.1
56
+
57
+ def forward(self, x: paddle.Tensor) -> Tuple[paddle.Tensor, paddle.Tensor]:
58
+ x, mask = self.encode(x)
59
+ x = self.proj(x)
60
+ logits = self.logits(x)
61
+ return logits, mask
62
+
63
+
64
+ class HubertSoft(Hubert):
65
+ def __init__(self):
66
+ super().__init__()
67
+
68
+ def units(self, wav: paddle.Tensor) -> paddle.Tensor:
69
+ wav = t_func.pad(wav, ((400 - 320) // 2, (400 - 320) // 2),data_format='NCL')
70
+ x, _ = self.encode(wav)
71
+ return self.proj(x)
72
+
73
+
74
+ class FeatureExtractor(paddle.nn.Layer):
75
+ def __init__(self):
76
+ super().__init__()
77
+ self.conv0 = nn.Conv1D(1, 512, 10, 5, bias_attr=False)
78
+ self.norm0 = nn.GroupNorm(512, 512)
79
+ self.conv1 = nn.Conv1D(512, 512, 3, 2, bias_attr=False)
80
+ self.conv2 = nn.Conv1D(512, 512, 3, 2, bias_attr=False)
81
+ self.conv3 = nn.Conv1D(512, 512, 3, 2, bias_attr=False)
82
+ self.conv4 = nn.Conv1D(512, 512, 3, 2, bias_attr=False)
83
+ self.conv5 = nn.Conv1D(512, 512, 2, 2, bias_attr=False)
84
+ self.conv6 = nn.Conv1D(512, 512, 2, 2, bias_attr=False)
85
+
86
+ def forward(self, x: paddle.Tensor) -> paddle.Tensor:
87
+ x = t_func.gelu(self.norm0(self.conv0(x)))
88
+ x = t_func.gelu(self.conv1(x))
89
+ x = t_func.gelu(self.conv2(x))
90
+ x = t_func.gelu(self.conv3(x))
91
+ x = t_func.gelu(self.conv4(x))
92
+ x = t_func.gelu(self.conv5(x))
93
+ x = t_func.gelu(self.conv6(x))
94
+ return x
95
+
96
+
97
+ class FeatureProjection(paddle.nn.Layer):
98
+ def __init__(self):
99
+ super().__init__()
100
+ self.norm = nn.LayerNorm(512)
101
+ self.projection = nn.Linear(512, 768)
102
+ self.dropout = nn.Dropout(0.1)
103
+
104
+ def forward(self, x: paddle.Tensor) -> paddle.Tensor:
105
+ x = self.norm(x)
106
+ x = self.projection(x)
107
+ x = self.dropout(x)
108
+ return x
109
+
110
+
111
+ class PositionalConvEmbedding(paddle.nn.Layer):
112
+ def __init__(self):
113
+ super().__init__()
114
+ self.conv = nn.Conv1D(
115
+ 768,
116
+ 768,
117
+ kernel_size=128,
118
+ padding=128 // 2,
119
+ groups=16,
120
+ )
121
+ self.conv = nn.utils.weight_norm(self.conv, name="weight", dim=2)
122
+
123
+ def forward(self, x: paddle.Tensor) -> paddle.Tensor:
124
+ x = self.conv(x.transpose([0, 2, 1]))
125
+ x = t_func.gelu(x[:, :, :-1])
126
+ return x.transpose([0, 2, 1])
127
+
128
+
129
+ class TransformerEncoder(paddle.nn.Layer):
130
+ def __init__(
131
+ self, encoder_layer: nn.TransformerEncoderLayer, num_layers: int
132
+ ) -> None:
133
+ super(TransformerEncoder, self).__init__()
134
+ self.layers = nn.LayerList(
135
+ [copy.deepcopy(encoder_layer) for _ in range(num_layers)]
136
+ )
137
+ self.num_layers = num_layers
138
+
139
+ def forward(
140
+ self,
141
+ src: paddle.Tensor,
142
+ mask: paddle.Tensor = None,
143
+ src_key_padding_mask: paddle.Tensor = None,
144
+ output_layer: Optional[int] = None,
145
+ ) -> paddle.Tensor:
146
+ output = src
147
+ for layer in self.layers[:output_layer]:
148
+ output = layer(
149
+ output, src_mask=mask, src_key_padding_mask=src_key_padding_mask
150
+ )
151
+ return output
152
+
153
+
154
+ def _compute_mask(
155
+ shape: Tuple[int, int],
156
+ mask_prob: float,
157
+ mask_length: int,
158
+ device: None,
159
+ min_masks: int = 0,
160
+ ) -> paddle.Tensor:
161
+ batch_size, sequence_length = shape
162
+
163
+ if mask_length < 1:
164
+ raise ValueError("`mask_length` has to be bigger than 0.")
165
+
166
+ if mask_length > sequence_length:
167
+ raise ValueError(
168
+ f"`mask_length` has to be smaller than `sequence_length`, but got `mask_length`: {mask_length} and `sequence_length`: {sequence_length}`"
169
+ )
170
+
171
+ # compute number of masked spans in batch
172
+ num_masked_spans = int(mask_prob * sequence_length / mask_length + random.random())
173
+ num_masked_spans = max(num_masked_spans, min_masks)
174
+
175
+ # make sure num masked indices <= sequence_length
176
+ if num_masked_spans * mask_length > sequence_length:
177
+ num_masked_spans = sequence_length // mask_length
178
+
179
+ # SpecAugment mask to fill
180
+ mask = paddle.zeros((batch_size, sequence_length), dtype='bool')
181
+
182
+ # uniform distribution to sample from, make sure that offset samples are < sequence_length
183
+ uniform_dist = paddle.ones(
184
+ (batch_size, sequence_length - (mask_length - 1))
185
+ )
186
+
187
+ # get random indices to mask
188
+ mask_indices = paddle.multinomial(uniform_dist, num_masked_spans)
189
+
190
+ # expand masked indices to masked spans
191
+ mask_indices = (
192
+ mask_indices.unsqueeze(dim=-1)
193
+ .expand((batch_size, num_masked_spans, mask_length))
194
+ .reshape(batch_size, num_masked_spans * mask_length)
195
+ )
196
+ offsets = (
197
+ paddle.arange(mask_length)[None, None, :]
198
+ .expand((batch_size, num_masked_spans, mask_length))
199
+ .reshape(batch_size, num_masked_spans * mask_length)
200
+ )
201
+ mask_idxs = mask_indices + offsets
202
+
203
+ # scatter indices to mask
204
+ mask = mask.scatter(1, mask_idxs, True)
205
+
206
+ return mask
207
+
208
+
209
+ def hubert_soft(
210
+ path: str,
211
+ ) -> HubertSoft:
212
+ r"""HuBERT-Soft from `"A Comparison of Discrete and Soft Speech Units for Improved Voice Conversion"`.
213
+ Args:
214
+ path (str): path of a pretrained model
215
+ """
216
+ hubert = HubertSoft()
217
+ checkpoint = paddle.load(path)
218
+ #consume_prefix_in_state_dict_if_present(checkpoint, "module.")
219
+ hubert.set_state_dict(checkpoint)
220
+ hubert.eval()
221
+ return hubert
222
+
223
+ if __name__ == '__main__':
224
+ hubert = HubertSoft()
225
+ d = paddle.load(r'E:\trans\hubert\final.pdparams')
226
+ hubert.set_state_dict(d)
hubert/hubert_model_onnx.py ADDED
@@ -0,0 +1,217 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import copy
2
+ import random
3
+ from typing import Optional, Tuple
4
+
5
+ import torch
6
+ import torch.nn as nn
7
+ import torch.nn.functional as t_func
8
+ from torch.nn.modules.utils import consume_prefix_in_state_dict_if_present
9
+
10
+
11
+ class Hubert(nn.Layer):
12
+ def __init__(self, num_label_embeddings: int = 100, mask: bool = True):
13
+ super().__init__()
14
+ self._mask = mask
15
+ self.feature_extractor = FeatureExtractor()
16
+ self.feature_projection = FeatureProjection()
17
+ self.positional_embedding = PositionalConvEmbedding()
18
+ self.norm = nn.LayerNorm(768)
19
+ self.dropout = nn.Dropout(0.1)
20
+ self.encoder = TransformerEncoder(
21
+ nn.TransformerEncoderLayer(
22
+ 768, 12, 3072, activation="gelu", batch_first=True
23
+ ),
24
+ 12,
25
+ )
26
+ self.proj = nn.Linear(768, 256)
27
+
28
+ self.masked_spec_embed = nn.Parameter(torch.FloatTensor(768).uniform_())
29
+ self.label_embedding = nn.Embedding(num_label_embeddings, 256)
30
+
31
+ def mask(self, x: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor]:
32
+ mask = None
33
+ if self.training and self._mask:
34
+ mask = _compute_mask((x.size(0), x.size(1)), 0.8, 10, x.device, 2)
35
+ x[mask] = self.masked_spec_embed.to(x.dtype)
36
+ return x, mask
37
+
38
+ def encode(
39
+ self, x: torch.Tensor, layer: Optional[int] = None
40
+ ) -> Tuple[torch.Tensor, torch.Tensor]:
41
+ x = self.feature_extractor(x)
42
+ x = self.feature_projection(x.transpose(1, 2))
43
+ x, mask = self.mask(x)
44
+ x = x + self.positional_embedding(x)
45
+ x = self.dropout(self.norm(x))
46
+ x = self.encoder(x, output_layer=layer)
47
+ return x, mask
48
+
49
+ def logits(self, x: torch.Tensor) -> torch.Tensor:
50
+ logits = torch.cosine_similarity(
51
+ x.unsqueeze(2),
52
+ self.label_embedding.weight.unsqueeze(0).unsqueeze(0),
53
+ dim=-1,
54
+ )
55
+ return logits / 0.1
56
+
57
+
58
+ class HubertSoft(Hubert):
59
+ def __init__(self):
60
+ super().__init__()
61
+
62
+ def units(self, wav: torch.Tensor) -> torch.Tensor:
63
+ wav = t_func.pad(wav, ((400 - 320) // 2, (400 - 320) // 2))
64
+ x, _ = self.encode(wav)
65
+ return self.proj(x)
66
+
67
+ def forward(self, x):
68
+ return self.units(x)
69
+
70
+ class FeatureExtractor(nn.Layer):
71
+ def __init__(self):
72
+ super().__init__()
73
+ self.conv0 = nn.Conv1d(1, 512, 10, 5, bias=False)
74
+ self.norm0 = nn.GroupNorm(512, 512)
75
+ self.conv1 = nn.Conv1d(512, 512, 3, 2, bias=False)
76
+ self.conv2 = nn.Conv1d(512, 512, 3, 2, bias=False)
77
+ self.conv3 = nn.Conv1d(512, 512, 3, 2, bias=False)
78
+ self.conv4 = nn.Conv1d(512, 512, 3, 2, bias=False)
79
+ self.conv5 = nn.Conv1d(512, 512, 2, 2, bias=False)
80
+ self.conv6 = nn.Conv1d(512, 512, 2, 2, bias=False)
81
+
82
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
83
+ x = t_func.gelu(self.norm0(self.conv0(x)))
84
+ x = t_func.gelu(self.conv1(x))
85
+ x = t_func.gelu(self.conv2(x))
86
+ x = t_func.gelu(self.conv3(x))
87
+ x = t_func.gelu(self.conv4(x))
88
+ x = t_func.gelu(self.conv5(x))
89
+ x = t_func.gelu(self.conv6(x))
90
+ return x
91
+
92
+
93
+ class FeatureProjection(nn.Layer):
94
+ def __init__(self):
95
+ super().__init__()
96
+ self.norm = nn.LayerNorm(512)
97
+ self.projection = nn.Linear(512, 768)
98
+ self.dropout = nn.Dropout(0.1)
99
+
100
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
101
+ x = self.norm(x)
102
+ x = self.projection(x)
103
+ x = self.dropout(x)
104
+ return x
105
+
106
+
107
+ class PositionalConvEmbedding(nn.Layer):
108
+ def __init__(self):
109
+ super().__init__()
110
+ self.conv = nn.Conv1d(
111
+ 768,
112
+ 768,
113
+ kernel_size=128,
114
+ padding=128 // 2,
115
+ groups=16,
116
+ )
117
+ self.conv = nn.utils.weight_norm(self.conv, name="weight", dim=2)
118
+
119
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
120
+ x = self.conv(x.transpose(1, 2))
121
+ x = t_func.gelu(x[:, :, :-1])
122
+ return x.transpose(1, 2)
123
+
124
+
125
+ class TransformerEncoder(nn.Layer):
126
+ def __init__(
127
+ self, encoder_layer: nn.TransformerEncoderLayer, num_layers: int
128
+ ) -> None:
129
+ super(TransformerEncoder, self).__init__()
130
+ self.layers = nn.LayerList(
131
+ [copy.deepcopy(encoder_layer) for _ in range(num_layers)]
132
+ )
133
+ self.num_layers = num_layers
134
+
135
+ def forward(
136
+ self,
137
+ src: torch.Tensor,
138
+ mask: torch.Tensor = None,
139
+ src_key_padding_mask: torch.Tensor = None,
140
+ output_layer: Optional[int] = None,
141
+ ) -> torch.Tensor:
142
+ output = src
143
+ for layer in self.layers[:output_layer]:
144
+ output = layer(
145
+ output, src_mask=mask, src_key_padding_mask=src_key_padding_mask
146
+ )
147
+ return output
148
+
149
+
150
+ def _compute_mask(
151
+ shape: Tuple[int, int],
152
+ mask_prob: float,
153
+ mask_length: int,
154
+ device: torch.device,
155
+ min_masks: int = 0,
156
+ ) -> torch.Tensor:
157
+ batch_size, sequence_length = shape
158
+
159
+ if mask_length < 1:
160
+ raise ValueError("`mask_length` has to be bigger than 0.")
161
+
162
+ if mask_length > sequence_length:
163
+ raise ValueError(
164
+ f"`mask_length` has to be smaller than `sequence_length`, but got `mask_length`: {mask_length} and `sequence_length`: {sequence_length}`"
165
+ )
166
+
167
+ # compute number of masked spans in batch
168
+ num_masked_spans = int(mask_prob * sequence_length / mask_length + random.random())
169
+ num_masked_spans = max(num_masked_spans, min_masks)
170
+
171
+ # make sure num masked indices <= sequence_length
172
+ if num_masked_spans * mask_length > sequence_length:
173
+ num_masked_spans = sequence_length // mask_length
174
+
175
+ # SpecAugment mask to fill
176
+ mask = torch.zeros((batch_size, sequence_length), device=device, dtype=torch.bool)
177
+
178
+ # uniform distribution to sample from, make sure that offset samples are < sequence_length
179
+ uniform_dist = torch.ones(
180
+ (batch_size, sequence_length - (mask_length - 1)), device=device
181
+ )
182
+
183
+ # get random indices to mask
184
+ mask_indices = torch.multinomial(uniform_dist, num_masked_spans)
185
+
186
+ # expand masked indices to masked spans
187
+ mask_indices = (
188
+ mask_indices.unsqueeze(dim=-1)
189
+ .expand((batch_size, num_masked_spans, mask_length))
190
+ .reshape(batch_size, num_masked_spans * mask_length)
191
+ )
192
+ offsets = (
193
+ torch.arange(mask_length, device=device)[None, None, :]
194
+ .expand((batch_size, num_masked_spans, mask_length))
195
+ .reshape(batch_size, num_masked_spans * mask_length)
196
+ )
197
+ mask_idxs = mask_indices + offsets
198
+
199
+ # scatter indices to mask
200
+ mask = mask.scatter(1, mask_idxs, True)
201
+
202
+ return mask
203
+
204
+
205
+ def hubert_soft(
206
+ path: str,
207
+ ) -> HubertSoft:
208
+ r"""HuBERT-Soft from `"A Comparison of Discrete and Soft Speech Units for Improved Voice Conversion"`.
209
+ Args:
210
+ path (str): path of a pretrained model
211
+ """
212
+ hubert = HubertSoft()
213
+ checkpoint = torch.load(path)
214
+ consume_prefix_in_state_dict_if_present(checkpoint, "module.")
215
+ hubert.load_state_dict(checkpoint)
216
+ hubert.eval()
217
+ return hubert
inference/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ '''梅花三弄再回首花了一个小时迁移的模块'''
inference/chunks_temp.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {}
inference/infer_tool.py ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import hashlib
2
+ import io
3
+ import json
4
+ import logging
5
+ import os
6
+ import time
7
+ from pathlib import Path
8
+ from inference import slicer
9
+
10
+ import librosa
11
+ import numpy as np
12
+ # import onnxruntime
13
+ import parselmouth
14
+ import soundfile
15
+ import paddle
16
+ import paddle.audio as paddleaudio
17
+ import paddleaudio
18
+
19
+ import cluster
20
+ #from hubert import hubert_model
21
+ import utils
22
+ from models import SynthesizerTrn,SynthesizerTrn_test
23
+
24
+ logging.getLogger('matplotlib').setLevel(logging.WARNING)
25
+ paddle.audio.backends.set_backend('soundfile')
26
+
27
+ def read_temp(file_name):
28
+ if not os.path.exists(file_name):
29
+ with open(file_name, "w") as f:
30
+ f.write(json.dumps({"info": "temp_dict"}))
31
+ return {}
32
+ else:
33
+ try:
34
+ with open(file_name, "r") as f:
35
+ data = f.read()
36
+ data_dict = json.loads(data)
37
+ if os.path.getsize(file_name) > 50 * 1024 * 1024:
38
+ f_name = file_name.replace("\\", "/").split("/")[-1]
39
+ print(f"clean {f_name}")
40
+ for wav_hash in list(data_dict.keys()):
41
+ if int(time.time()) - int(data_dict[wav_hash]["time"]) > 14 * 24 * 3600:
42
+ del data_dict[wav_hash]
43
+ except Exception as e:
44
+ print(e)
45
+ print(f"{file_name} error,auto rebuild file")
46
+ data_dict = {"info": "temp_dict"}
47
+ return data_dict
48
+
49
+
50
+ def write_temp(file_name, data):
51
+ with open(file_name, "w") as f:
52
+ f.write(json.dumps(data))
53
+
54
+
55
+ def timeit(func):
56
+ def run(*args, **kwargs):
57
+ t = time.time()
58
+ res = func(*args, **kwargs)
59
+ print('executing \'%s\' costed %.3fs' % (func.__name__, time.time() - t))
60
+ return res
61
+
62
+ return run
63
+
64
+
65
+ def format_wav(audio_path):
66
+ if Path(audio_path).suffix == '.wav':
67
+ return
68
+ raw_audio, raw_sample_rate = librosa.load(audio_path, mono=True, sr=None)
69
+ soundfile.write(Path(audio_path).with_suffix(".wav"), raw_audio, raw_sample_rate)
70
+
71
+
72
+ def get_end_file(dir_path, end):
73
+ file_lists = []
74
+ for root, dirs, files in os.walk(dir_path):
75
+ files = [f for f in files if f[0] != '.']
76
+ dirs[:] = [d for d in dirs if d[0] != '.']
77
+ for f_file in files:
78
+ if f_file.endswith(end):
79
+ file_lists.append(os.path.join(root, f_file).replace("\\", "/"))
80
+ return file_lists
81
+
82
+
83
+ def get_md5(content):
84
+ return hashlib.new("md5", content).hexdigest()
85
+
86
+ def fill_a_to_b(a, b):
87
+ if len(a) < len(b):
88
+ for _ in range(0, len(b) - len(a)):
89
+ a.append(a[0])
90
+
91
+ def mkdir(paths: list):
92
+ for path in paths:
93
+ if not os.path.exists(path):
94
+ os.mkdir(path)
95
+
96
+ def pad_array(arr, target_length):
97
+ current_length = arr.shape[0]
98
+ if current_length >= target_length:
99
+ return arr
100
+ else:
101
+ pad_width = target_length - current_length
102
+ pad_left = pad_width // 2
103
+ pad_right = pad_width - pad_left
104
+ padded_arr = np.pad(arr, (pad_left, pad_right), 'constant', constant_values=(0, 0))
105
+ return padded_arr
106
+
107
+
108
+ class Svc(object):
109
+ def __init__(self, net_g_path, config_path,
110
+ device=None,
111
+ cluster_model_path="./logs/44k/kmeans_10000.pdparams",mode="train"):
112
+ self.net_g_path = net_g_path
113
+ if device is None:
114
+ self.dev = "gpu:0" if paddle.device.is_compiled_with_cuda() else "cpu"
115
+ else:
116
+ self.dev = device
117
+ self.net_g_ms = None
118
+ self.hps_ms = utils.get_hparams_from_file(config_path)
119
+ self.target_sample = self.hps_ms.data.sampling_rate
120
+ self.hop_size = self.hps_ms.data.hop_length
121
+ self.spk2id = self.hps_ms.spk
122
+ # 加载hubert
123
+ self.hubert_model = utils.get_hubert_model()
124
+ self.load_model(mode)
125
+ if os.path.exists(cluster_model_path):
126
+ self.cluster_model = cluster.get_cluster_model(cluster_model_path)
127
+
128
+ def load_model(self,mode):
129
+ # 获取模型配置
130
+ if mode == "train":
131
+ self.net_g_ms = SynthesizerTrn(
132
+ self.hps_ms.data.filter_length // 2 + 1,
133
+ self.hps_ms.train.segment_size // self.hps_ms.data.hop_length,
134
+ **self.hps_ms.model)
135
+ elif mode == "test":
136
+ self.net_g_ms = SynthesizerTrn_test(
137
+ self.hps_ms.data.filter_length // 2 + 1,
138
+ self.hps_ms.train.segment_size // self.hps_ms.data.hop_length,
139
+ **self.hps_ms.model)
140
+ _ = utils.load_checkpoint(self.net_g_path, self.net_g_ms, None)
141
+ if "half" in self.net_g_path and paddle.device.is_compiled_with_cuda():
142
+ self.net_g_ms.half().eval()
143
+ self.net_g_ms.half().to(self.dev)
144
+ else:
145
+ self.net_g_ms.eval()
146
+ self.net_g_ms.to(self.dev)
147
+
148
+
149
+
150
+ def get_unit_f0(self, in_path, tran, cluster_infer_ratio, speaker):
151
+
152
+ wav, sr = librosa.load(in_path, sr=self.target_sample)
153
+
154
+ f0 = utils.compute_f0_parselmouth(wav, sampling_rate=self.target_sample, hop_length=self.hop_size)
155
+ f0, uv = utils.interpolate_f0(f0)
156
+ f0 = paddle.to_tensor(f0,dtype = ('float32'))
157
+ uv = paddle.to_tensor(uv,dtype = ('float32'))
158
+ f0 = f0 * 2 ** (tran / 12)
159
+ f0 = f0.unsqueeze(0)
160
+ uv = uv.unsqueeze(0)
161
+
162
+ wav16k = librosa.resample(wav, orig_sr=self.target_sample, target_sr=16000)
163
+ wav16k = paddle.to_tensor(wav16k)
164
+ c = utils.get_hubert_content(self.hubert_model, wav_16k_tensor=wav16k)
165
+ c = utils.repeat_expand_2d(c.squeeze(0), f0.shape[1])
166
+
167
+ if cluster_infer_ratio !=0:
168
+ cluster_c = cluster.get_cluster_center_result(self.cluster_model, c.cpu().numpy().T, speaker).T
169
+ cluster_c = paddle.to_tensor(cluster_c,dtype = 'float32')
170
+ c = cluster_infer_ratio * cluster_c + (1 - cluster_infer_ratio) * c
171
+
172
+ c = c.unsqueeze(0)
173
+ return c, f0, uv
174
+
175
+ def infer(self, speaker, tran, raw_path,
176
+ cluster_infer_ratio=0,
177
+ auto_predict_f0=False,
178
+ noice_scale=0.4):
179
+ speaker_id = 0
180
+ sid = paddle.to_tensor([int(speaker_id)],dtype = 'int64').unsqueeze(0)
181
+ c, f0, uv = self.get_unit_f0(raw_path, tran, cluster_infer_ratio, speaker)
182
+ if "half" in self.net_g_path and paddle.device.is_compiled_with_cuda():
183
+ c = c.half()
184
+ with paddle.no_grad():
185
+ start = time.time()
186
+ audio = self.net_g_ms.infer(c, f0=f0, g=sid, uv=uv, predict_f0=auto_predict_f0, noice_scale=noice_scale)[0,0].detach().astype('float32')
187
+ use_time = time.time() - start
188
+ print("vits耗时:{}".format(use_time))
189
+ return audio, audio.shape[-1]
190
+
191
+ def slice_inference(self,raw_audio_path, spk, tran, slice_db,cluster_infer_ratio, auto_predict_f0,noice_scale, pad_seconds=0.5,empty_cache=False):
192
+ wav_path = raw_audio_path
193
+ chunks = slicer.cut(wav_path, db_thresh=slice_db)
194
+ audio_data, audio_sr = slicer.chunks2audio(wav_path, chunks)
195
+
196
+ audio = []
197
+ for (slice_tag, data) in audio_data:
198
+ print(f'#=====分段开始,耗时{round(len(data) / audio_sr, 3)}秒======')
199
+ # padd
200
+ pad_len = int(audio_sr * pad_seconds)
201
+ data = np.concatenate([np.zeros([pad_len]), data, np.zeros([pad_len])])
202
+ length = int(np.ceil(len(data) / audio_sr * self.target_sample))
203
+ raw_path = io.BytesIO()
204
+ soundfile.write(raw_path, data, audio_sr, format="wav")
205
+ raw_path.seek(0)
206
+ if slice_tag:
207
+ print('跳过空段')
208
+ _audio = np.zeros(length)
209
+ else:
210
+ out_audio, out_sr = self.infer(spk, tran, raw_path,
211
+ cluster_infer_ratio=cluster_infer_ratio,
212
+ auto_predict_f0=auto_predict_f0,
213
+ noice_scale=noice_scale
214
+ )
215
+ _audio = out_audio.cpu().numpy()
216
+
217
+ pad_len = int(self.target_sample * pad_seconds)
218
+ _audio = _audio[pad_len:-pad_len]
219
+ audio.extend(list(_audio))
220
+ if empty_cache == True:
221
+ paddle.device.cuda.empty_cache()
222
+ return np.array(audio)
223
+
224
+
225
+ class RealTimeVC:
226
+ def __init__(self):
227
+ self.last_chunk = None
228
+ self.last_o = None
229
+ self.chunk_len = 16000 # 区块长度
230
+ self.pre_len = 3840 # 交叉淡化长度,640的倍数
231
+
232
+ """输入输出都是1维numpy 音频波形数组"""
233
+
234
+ def process(self, svc_model, speaker_id, f_pitch_change, input_wav_path):
235
+ import maad
236
+ audio, sr = paddleaudio.load(input_wav_path)
237
+ audio = audio.cpu().numpy()[0]
238
+ temp_wav = io.BytesIO()
239
+ if self.last_chunk is None:
240
+ input_wav_path.seek(0)
241
+ audio, sr = svc_model.infer(speaker_id, f_pitch_change, input_wav_path)
242
+ audio = audio.cpu().numpy()
243
+ self.last_chunk = audio[-self.pre_len:]
244
+ self.last_o = audio
245
+ return audio[-self.chunk_len:]
246
+ else:
247
+ audio = np.concatenate([self.last_chunk, audio])
248
+ soundfile.write(temp_wav, audio, sr, format="wav")
249
+ temp_wav.seek(0)
250
+ audio, sr = svc_model.infer(speaker_id, f_pitch_change, temp_wav)
251
+ audio = audio.cpu().numpy()
252
+ ret = maad.util.crossfade(self.last_o, audio, self.pre_len)
253
+ self.last_chunk = audio[-self.pre_len:]
254
+ self.last_o = audio
255
+ return ret[self.chunk_len:2 * self.chunk_len]
inference/infer_tool_grad.py ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import hashlib
2
+ import json
3
+ import logging
4
+ import os
5
+ import time
6
+ from pathlib import Path
7
+ import io
8
+ import librosa
9
+ import maad
10
+ import numpy as np
11
+ from inference import slicer
12
+ import parselmouth
13
+ import soundfile
14
+ import paddle
15
+ import paddle.audio as paddleaudio
16
+
17
+ from hubert import hubert_model
18
+ import utils
19
+ from models import SynthesizerTrn
20
+ logging.getLogger('numba').setLevel(logging.WARNING)
21
+ logging.getLogger('matplotlib').setLevel(logging.WARNING)
22
+
23
+ def resize2d_f0(x, target_len):
24
+ source = np.array(x)
25
+ source[source < 0.001] = np.nan
26
+ target = np.interp(np.arange(0, len(source) * target_len, len(source)) / target_len, np.arange(0, len(source)),
27
+ source)
28
+ res = np.nan_to_num(target)
29
+ return res
30
+
31
+ def get_f0(x, p_len,f0_up_key=0):
32
+
33
+ time_step = 160 / 16000 * 1000
34
+ f0_min = 50
35
+ f0_max = 1100
36
+ f0_mel_min = 1127 * np.log(1 + f0_min / 700)
37
+ f0_mel_max = 1127 * np.log(1 + f0_max / 700)
38
+
39
+ f0 = parselmouth.Sound(x, 16000).to_pitch_ac(
40
+ time_step=time_step / 1000, voicing_threshold=0.6,
41
+ pitch_floor=f0_min, pitch_ceiling=f0_max).selected_array['frequency']
42
+
43
+ pad_size=(p_len - len(f0) + 1) // 2
44
+ if(pad_size>0 or p_len - len(f0) - pad_size>0):
45
+ f0 = np.pad(f0,[[pad_size,p_len - len(f0) - pad_size]], mode='constant')
46
+
47
+ f0 *= pow(2, f0_up_key / 12)
48
+ f0_mel = 1127 * np.log(1 + f0 / 700)
49
+ f0_mel[f0_mel > 0] = (f0_mel[f0_mel > 0] - f0_mel_min) * 254 / (f0_mel_max - f0_mel_min) + 1
50
+ f0_mel[f0_mel <= 1] = 1
51
+ f0_mel[f0_mel > 255] = 255
52
+ f0_coarse = np.rint(f0_mel).astype(np.int)
53
+ return f0_coarse, f0
54
+
55
+ def clean_pitch(input_pitch):
56
+ num_nan = np.sum(input_pitch == 1)
57
+ if num_nan / len(input_pitch) > 0.9:
58
+ input_pitch[input_pitch != 1] = 1
59
+ return input_pitch
60
+
61
+
62
+ def plt_pitch(input_pitch):
63
+ input_pitch = input_pitch.astype(float)
64
+ input_pitch[input_pitch == 1] = np.nan
65
+ return input_pitch
66
+
67
+
68
+ def f0_to_pitch(ff):
69
+ f0_pitch = 69 + 12 * np.log2(ff / 440)
70
+ return f0_pitch
71
+
72
+
73
+ def fill_a_to_b(a, b):
74
+ if len(a) < len(b):
75
+ for _ in range(0, len(b) - len(a)):
76
+ a.append(a[0])
77
+
78
+
79
+ def mkdir(paths: list):
80
+ for path in paths:
81
+ if not os.path.exists(path):
82
+ os.mkdir(path)
83
+
84
+
85
+ class VitsSvc(object):
86
+ def __init__(self):
87
+ self.device = "gpu:0" if paddle.device.is_compiled_with_cuda() else "cpu"
88
+ self.SVCVITS = None
89
+ self.hps = None
90
+ self.speakers = None
91
+ self.hubert_soft = utils.get_hubert_model()
92
+
93
+ def set_device(self, device):
94
+ self.device = device
95
+ #self.hubert_soft.to(self.device)
96
+ if self.SVCVITS != None:
97
+ self.SVCVITS.to(self.device)
98
+
99
+ def loadCheckpoint(self, path):
100
+ self.hps = utils.get_hparams_from_file(f"checkpoints/{path}/config.json")
101
+ self.SVCVITS = SynthesizerTrn(
102
+ self.hps.data.filter_length // 2 + 1,
103
+ self.hps.train.segment_size // self.hps.data.hop_length,
104
+ **self.hps.model)
105
+ _ = utils.load_checkpoint(f"checkpoints/{path}/model.pdparams", self.SVCVITS, None)
106
+ _ = self.SVCVITS.eval().to(self.device)
107
+ self.speakers = self.hps.spk
108
+
109
+ def get_units(self, source, sr):
110
+ source = source.unsqueeze(0).cuda() if self.device == 'gpu:0' else source.unsqueeze(0).cpu()
111
+ # hubert没有迁移到paddle上。这里也就不迁移了。
112
+ with torch.inference_mode():
113
+ units = self.hubert_soft.units(source)
114
+ return units
115
+
116
+
117
+ def get_unit_pitch(self, in_path, tran):
118
+ source, sr = torchaudio.load(in_path)
119
+ source = torchaudio.functional.resample(source, sr, 16000)
120
+ if len(source.shape) == 2 and source.shape[1] >= 2:
121
+ source = torch.mean(source, dim=0).unsqueeze(0)
122
+ soft = self.get_units(source, sr).squeeze(0).cpu().numpy()
123
+ f0_coarse, f0 = get_f0(source.cpu().numpy()[0], soft.shape[0]*2, tran)
124
+ return soft, f0
125
+
126
+ def infer(self, speaker_id, tran, raw_path):
127
+ speaker_id = self.speakers[speaker_id]
128
+ sid = torch.LongTensor([int(speaker_id)]).to(self.device).unsqueeze(0)
129
+ soft, pitch = self.get_unit_pitch(raw_path, tran)
130
+ f0 = torch.FloatTensor(clean_pitch(pitch)).unsqueeze(0).to(self.device)
131
+ stn_tst = torch.FloatTensor(soft)
132
+ with torch.no_grad():
133
+ x_tst = stn_tst.unsqueeze(0).to(self.device)
134
+ x_tst = torch.repeat_interleave(x_tst, repeats=2, dim=1).transpose(1, 2)
135
+ audio = self.SVCVITS.infer(x_tst, f0=f0, g=sid)[0,0].data.float()
136
+ return audio, audio.shape[-1]
137
+
138
+ def inference(self,srcaudio,chara,tran,slice_db):
139
+ sampling_rate, audio = srcaudio
140
+ audio = (audio / np.iinfo(audio.dtype).max).astype(np.float32)
141
+ if len(audio.shape) > 1:
142
+ audio = librosa.to_mono(audio.transpose(1, 0))
143
+ if sampling_rate != 16000:
144
+ audio = librosa.resample(audio, orig_sr=sampling_rate, target_sr=16000)
145
+ soundfile.write("tmpwav.wav", audio, 16000, format="wav")
146
+ chunks = slicer.cut("tmpwav.wav", db_thresh=slice_db)
147
+ audio_data, audio_sr = slicer.chunks2audio("tmpwav.wav", chunks)
148
+ audio = []
149
+ for (slice_tag, data) in audio_data:
150
+ length = int(np.ceil(len(data) / audio_sr * self.hps.data.sampling_rate))
151
+ raw_path = io.BytesIO()
152
+ soundfile.write(raw_path, data, audio_sr, format="wav")
153
+ raw_path.seek(0)
154
+ if slice_tag:
155
+ _audio = np.zeros(length)
156
+ else:
157
+ out_audio, out_sr = self.infer(chara, tran, raw_path)
158
+ _audio = out_audio.cpu().numpy()
159
+ audio.extend(list(_audio))
160
+ audio = (np.array(audio) * 32768.0).astype('int16')
161
+ return (self.hps.data.sampling_rate,audio)
inference/slicer.py ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import librosa
2
+ import paddle
3
+ import paddle.audio as paddleaudio
4
+
5
+
6
+ class Slicer:
7
+ def __init__(self,
8
+ sr: int,
9
+ threshold: float = -40.,
10
+ min_length: int = 5000,
11
+ min_interval: int = 300,
12
+ hop_size: int = 20,
13
+ max_sil_kept: int = 5000):
14
+ if not min_length >= min_interval >= hop_size:
15
+ raise ValueError('The following condition must be satisfied: min_length >= min_interval >= hop_size')
16
+ if not max_sil_kept >= hop_size:
17
+ raise ValueError('The following condition must be satisfied: max_sil_kept >= hop_size')
18
+ min_interval = sr * min_interval / 1000
19
+ self.threshold = 10 ** (threshold / 20.)
20
+ self.hop_size = round(sr * hop_size / 1000)
21
+ self.win_size = min(round(min_interval), 4 * self.hop_size)
22
+ self.min_length = round(sr * min_length / 1000 / self.hop_size)
23
+ self.min_interval = round(min_interval / self.hop_size)
24
+ self.max_sil_kept = round(sr * max_sil_kept / 1000 / self.hop_size)
25
+
26
+ def _apply_slice(self, waveform, begin, end):
27
+ if len(waveform.shape) > 1:
28
+ return waveform[:, begin * self.hop_size: min(waveform.shape[1], end * self.hop_size)]
29
+ else:
30
+ return waveform[begin * self.hop_size: min(waveform.shape[0], end * self.hop_size)]
31
+
32
+ # @timeit
33
+ def slice(self, waveform):
34
+ if len(waveform.shape) > 1:
35
+ samples = librosa.to_mono(waveform)
36
+ else:
37
+ samples = waveform
38
+ if samples.shape[0] <= self.min_length:
39
+ return {"0": {"slice": False, "split_time": f"0,{len(waveform)}"}}
40
+ rms_list = librosa.feature.rms(y=samples, frame_length=self.win_size, hop_length=self.hop_size).squeeze(0)
41
+ sil_tags = []
42
+ silence_start = None
43
+ clip_start = 0
44
+ for i, rms in enumerate(rms_list):
45
+ # Keep looping while frame is silent.
46
+ if rms < self.threshold:
47
+ # Record start of silent frames.
48
+ if silence_start is None:
49
+ silence_start = i
50
+ continue
51
+ # Keep looping while frame is not silent and silence start has not been recorded.
52
+ if silence_start is None:
53
+ continue
54
+ # Clear recorded silence start if interval is not enough or clip is too short
55
+ is_leading_silence = silence_start == 0 and i > self.max_sil_kept
56
+ need_slice_middle = i - silence_start >= self.min_interval and i - clip_start >= self.min_length
57
+ if not is_leading_silence and not need_slice_middle:
58
+ silence_start = None
59
+ continue
60
+ # Need slicing. Record the range of silent frames to be removed.
61
+ if i - silence_start <= self.max_sil_kept:
62
+ pos = rms_list[silence_start: i + 1].argmin() + silence_start
63
+ if silence_start == 0:
64
+ sil_tags.append((0, pos))
65
+ else:
66
+ sil_tags.append((pos, pos))
67
+ clip_start = pos
68
+ elif i - silence_start <= self.max_sil_kept * 2:
69
+ pos = rms_list[i - self.max_sil_kept: silence_start + self.max_sil_kept + 1].argmin()
70
+ pos += i - self.max_sil_kept
71
+ pos_l = rms_list[silence_start: silence_start + self.max_sil_kept + 1].argmin() + silence_start
72
+ pos_r = rms_list[i - self.max_sil_kept: i + 1].argmin() + i - self.max_sil_kept
73
+ if silence_start == 0:
74
+ sil_tags.append((0, pos_r))
75
+ clip_start = pos_r
76
+ else:
77
+ sil_tags.append((min(pos_l, pos), max(pos_r, pos)))
78
+ clip_start = max(pos_r, pos)
79
+ else:
80
+ pos_l = rms_list[silence_start: silence_start + self.max_sil_kept + 1].argmin() + silence_start
81
+ pos_r = rms_list[i - self.max_sil_kept: i + 1].argmin() + i - self.max_sil_kept
82
+ if silence_start == 0:
83
+ sil_tags.append((0, pos_r))
84
+ else:
85
+ sil_tags.append((pos_l, pos_r))
86
+ clip_start = pos_r
87
+ silence_start = None
88
+ # Deal with trailing silence.
89
+ total_frames = rms_list.shape[0]
90
+ if silence_start is not None and total_frames - silence_start >= self.min_interval:
91
+ silence_end = min(total_frames, silence_start + self.max_sil_kept)
92
+ pos = rms_list[silence_start: silence_end + 1].argmin() + silence_start
93
+ sil_tags.append((pos, total_frames + 1))
94
+ # Apply and return slices.
95
+ if len(sil_tags) == 0:
96
+ return {"0": {"slice": False, "split_time": f"0,{len(waveform)}"}}
97
+ else:
98
+ chunks = []
99
+ # 第一段静音并非从头开始,补上有声片段
100
+ if sil_tags[0][0]:
101
+ chunks.append(
102
+ {"slice": False, "split_time": f"0,{min(waveform.shape[0], sil_tags[0][0] * self.hop_size)}"})
103
+ for i in range(0, len(sil_tags)):
104
+ # 标识有声片段(跳过第一段)
105
+ if i:
106
+ chunks.append({"slice": False,
107
+ "split_time": f"{sil_tags[i - 1][1] * self.hop_size},{min(waveform.shape[0], sil_tags[i][0] * self.hop_size)}"})
108
+ # 标识所有静音片段
109
+ chunks.append({"slice": True,
110
+ "split_time": f"{sil_tags[i][0] * self.hop_size},{min(waveform.shape[0], sil_tags[i][1] * self.hop_size)}"})
111
+ # 最后一段静音并非结尾,补上结尾片段
112
+ if sil_tags[-1][1] * self.hop_size < len(waveform):
113
+ chunks.append({"slice": False, "split_time": f"{sil_tags[-1][1] * self.hop_size},{len(waveform)}"})
114
+ chunk_dict = {}
115
+ for i in range(len(chunks)):
116
+ chunk_dict[str(i)] = chunks[i]
117
+ return chunk_dict
118
+
119
+
120
+ def cut(audio_path, db_thresh=-30, min_len=5000):
121
+ audio, sr = librosa.load(audio_path, sr=None)
122
+ slicer = Slicer(
123
+ sr=sr,
124
+ threshold=db_thresh,
125
+ min_length=min_len
126
+ )
127
+ chunks = slicer.slice(audio)
128
+ return chunks
129
+
130
+
131
+ def chunks2audio(audio_path, chunks):
132
+ chunks = dict(chunks)
133
+ audio, sr = paddleaudio.load(audio_path)
134
+ if len(audio.shape) == 2 and audio.shape[1] >= 2:
135
+ audio = paddle.mean(audio, axis=0).unsqueeze(0)
136
+ audio = audio.cpu().numpy()[0]
137
+ result = []
138
+ for k, v in chunks.items():
139
+ tag = v["split_time"].split(",")
140
+ if tag[0] != tag[1]:
141
+ result.append((v["slice"], audio[int(tag[0]):int(tag[1])]))
142
+ return result, sr
inference_main.py ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import io
2
+ import logging
3
+ import time
4
+ from pathlib import Path
5
+
6
+ import librosa
7
+ import matplotlib.pyplot as plt
8
+ import numpy as np
9
+ import soundfile
10
+
11
+ from inference import infer_tool
12
+ from inference import slicer
13
+ from inference.infer_tool import Svc
14
+
15
+ logging.getLogger('numba').setLevel(logging.WARNING)
16
+ chunks_dict = infer_tool.read_temp("inference/chunks_temp.json")
17
+
18
+ # 这里是推理用到的所有参数,从这里修改参数即可
19
+ 模型路径:str = "./logs/44k/G_10000.pdparams" # 模型路径
20
+ 推理文件列表:list = ["1.wav"] # wav文件名列表,放在raw文件夹下
21
+ 音高调整:list = [0] # 音高调整,支持正负(半音)
22
+ 合成目标说话人名称:list = ['yuuka'] # 合成目标说话人名称
23
+ 自动预测音高:bool = False # 语音转换自动预测音高,转换歌声时不要打开这个会严重跑调
24
+ 聚类模型路径:str = "logs/44k/kmeans_10000.pdparams" # 聚类模型路径,如果没有训练聚类则随便填
25
+ 聚类方案占比:float = 0 # 聚类方案占比,范围0-1,若没有训练聚类模型则填0即可
26
+ 静音分贝:int = -40 # 静音分贝阈值,默认-40,嘈杂的音频可以-30,干声保留呼吸可以-50
27
+ 推理设备:str or None = None # 推理设备,None则为自动选择cpu和gpu
28
+ 音频输出格式:str = 'flac' # 音频输出格式
29
+ 噪音比例:float = 0.4 # 声音有点电的话可以尝试调高这个,但是会降低音质,较为玄学
30
+
31
+ def main():
32
+ import argparse
33
+
34
+ parser = argparse.ArgumentParser(description='飞桨sovits4 推理模块')
35
+ parser.add_argument('-m', '--model_path', type=str, default=模型路径, help='模型路径')
36
+ parser.add_argument('-c', '--config_path', type=str, default="./logs/44k/config.json", help='配置文件路径')
37
+ parser.add_argument('-n', '--clean_names', type=str, nargs='+', default=推理文件列表, help='wav文件名列表,放在raw文件夹下')
38
+ parser.add_argument('-t', '--trans', type=int, nargs='+', default=音高调整, help='音高调整,支持正负(半音)')
39
+ parser.add_argument('-s', '--spk_list', type=str, nargs='+', default=合成目标说话人名称, help='合成目标说话人名称')
40
+
41
+ parser.add_argument('-a', '--auto_predict_f0', action='store_true', default=自动预测音高,
42
+ help='语音转换自动预测音高,转换歌声时不要打开这个会严重跑调')
43
+ parser.add_argument('-cm', '--cluster_model_path', type=str, default=聚类模型路径, help='聚类模型路径,如果没有训练聚类则随便填')
44
+ parser.add_argument('-cr', '--cluster_infer_ratio', type=float, default=聚类方案占比, help='聚类方案占比,范围0-1,若没有训练聚类模型则填0即可')
45
+
46
+ parser.add_argument('-sd', '--slice_db', type=int, default=静音分贝, help='默认-40,嘈杂的音频可以-30,干声保留呼吸可以-50')
47
+ parser.add_argument('-d', '--device', type=str, default=推理设备, help='推理设备,None则为自动选择cpu和gpu')
48
+ parser.add_argument('-ns', '--noice_scale', type=float, default=噪音比例, help='噪音级别,会影响咬字和音质,较为玄学')
49
+ parser.add_argument('-p', '--pad_seconds', type=float, default=0.5, help='推理音频pad秒数,由于未知原因开头结尾会有异响,pad一小段静音段后就不会出现')
50
+ parser.add_argument('-wf', '--wav_format', type=str, default=音频输出格式, help='音频输出格式')
51
+
52
+ args = parser.parse_args()
53
+
54
+ svc_model = Svc(args.model_path, args.config_path, args.device, args.cluster_model_path)
55
+ infer_tool.mkdir(["raw", "results"])
56
+ clean_names = args.clean_names
57
+ trans = args.trans
58
+ spk_list = args.spk_list
59
+ slice_db = args.slice_db
60
+ wav_format = args.wav_format
61
+ auto_predict_f0 = args.auto_predict_f0
62
+ cluster_infer_ratio = args.cluster_infer_ratio
63
+ noice_scale = args.noice_scale
64
+ pad_seconds = args.pad_seconds
65
+
66
+ infer_tool.fill_a_to_b(trans, clean_names)
67
+ for clean_name, tran in zip(clean_names, trans):
68
+ raw_audio_path = f"raw/{clean_name}"
69
+ if "." not in raw_audio_path:
70
+ raw_audio_path += ".wav"
71
+ infer_tool.format_wav(raw_audio_path)
72
+ wav_path = Path(raw_audio_path).with_suffix('.wav')
73
+ chunks = slicer.cut(wav_path, db_thresh=slice_db)
74
+ audio_data, audio_sr = slicer.chunks2audio(wav_path, chunks)
75
+
76
+ for spk in spk_list:
77
+ audio = []
78
+ for (slice_tag, data) in audio_data:
79
+ print(f'#=====分段开始,{round(len(data) / audio_sr, 3)}秒======')
80
+
81
+ length = int(np.ceil(len(data) / audio_sr * svc_model.target_sample))
82
+ if slice_tag:
83
+ print('跳过空段')
84
+ _audio = np.zeros(length)
85
+ else:
86
+ # padd
87
+ pad_len = int(audio_sr * pad_seconds)
88
+ data = np.concatenate([np.zeros([pad_len]), data, np.zeros([pad_len])])
89
+ raw_path = io.BytesIO()
90
+ soundfile.write(raw_path, data, audio_sr, format="wav")
91
+ raw_path.seek(0)
92
+ out_audio, out_sr = svc_model.infer(spk, tran, raw_path,
93
+ cluster_infer_ratio=cluster_infer_ratio,
94
+ auto_predict_f0=auto_predict_f0,
95
+ noice_scale=noice_scale
96
+ )
97
+ _audio = out_audio.detach().cpu().numpy()
98
+ pad_len = int(svc_model.target_sample * pad_seconds)
99
+ _audio = _audio[pad_len:-pad_len]
100
+
101
+ audio.extend(list(infer_tool.pad_array(_audio, length)))
102
+ key = "auto" if auto_predict_f0 else f"{tran}key"
103
+ cluster_name = "" if cluster_infer_ratio == 0 else f"_{cluster_infer_ratio}"
104
+ res_path = f'./results/{clean_name}_{key}_{spk}{cluster_name}.{wav_format}'
105
+ soundfile.write(res_path, audio, svc_model.target_sample, format=wav_format)
106
+
107
+ if __name__ == '__main__':
108
+ main()
logs/44k/config.json ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "train": {
3
+ "log_interval": 800,
4
+ "eval_interval": 400,
5
+ "seed": 1234,
6
+ "epochs": 114514,
7
+ "learning_rate": 0.0001,
8
+ "betas": [
9
+ 0.8,
10
+ 0.99
11
+ ],
12
+ "eps": 1e-05,
13
+ "batch_size": 2,
14
+ "fp16_run": true,
15
+ "lr_decay": 0.999875,
16
+ "segment_size": 10240,
17
+ "init_lr_ratio": 1,
18
+ "warmup_epochs": 0,
19
+ "c_mel": 45,
20
+ "c_kl": 1.0,
21
+ "use_sr": true,
22
+ "max_speclen": 512,
23
+ "port": "8001",
24
+ "keep_ckpts": 5
25
+ },
26
+ "data": {
27
+ "training_files": "filelists/train.txt",
28
+ "validation_files": "filelists/val.txt",
29
+ "max_wav_value": 32768.0,
30
+ "sampling_rate": 44100,
31
+ "filter_length": 2048,
32
+ "hop_length": 512,
33
+ "win_length": 2048,
34
+ "n_mel_channels": 80,
35
+ "mel_fmin": 0.0,
36
+ "mel_fmax": 22050
37
+ },
38
+ "model": {
39
+ "inter_channels": 192,
40
+ "hidden_channels": 192,
41
+ "filter_channels": 768,
42
+ "n_heads": 2,
43
+ "n_layers": 6,
44
+ "kernel_size": 3,
45
+ "p_dropout": 0.1,
46
+ "resblock": "1",
47
+ "resblock_kernel_sizes": [
48
+ 3,
49
+ 7,
50
+ 11
51
+ ],
52
+ "resblock_dilation_sizes": [
53
+ [
54
+ 1,
55
+ 3,
56
+ 5
57
+ ],
58
+ [
59
+ 1,
60
+ 3,
61
+ 5
62
+ ],
63
+ [
64
+ 1,
65
+ 3,
66
+ 5
67
+ ]
68
+ ],
69
+ "upsample_rates": [
70
+ 8,
71
+ 8,
72
+ 2,
73
+ 2,
74
+ 2
75
+ ],
76
+ "upsample_initial_channel": 512,
77
+ "upsample_kernel_sizes": [
78
+ 16,
79
+ 16,
80
+ 4,
81
+ 4,
82
+ 4
83
+ ],
84
+ "n_layers_q": 3,
85
+ "use_spectral_norm": false,
86
+ "gin_channels": 256,
87
+ "ssl_dim": 256,
88
+ "n_speakers": 200
89
+ },
90
+ "spk": {
91
+ "yuuka": 0
92
+ },
93
+ "clean_logs": true,
94
+ "trainer": "admin"
95
+ }
logs/44k/eval/vdlrecords.1690034156.log ADDED
Binary file (948 kB). View file
 
logs/44k/train.log ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ 2023-07-22 21:55:56,616 44k INFO {'train': {'log_interval': 800, 'eval_interval': 400, 'seed': 1234, 'epochs': 114514, 'learning_rate': 0.0001, 'betas': [0.8, 0.99], 'eps': 1e-05, 'batch_size': 2, 'fp16_run': True, 'lr_decay': 0.999875, 'segment_size': 10240, 'init_lr_ratio': 1, 'warmup_epochs': 0, 'c_mel': 45, 'c_kl': 1.0, 'use_sr': True, 'max_speclen': 512, 'port': '8001', 'keep_ckpts': 5}, 'data': {'training_files': 'filelists/train.txt', 'validation_files': 'filelists/val.txt', 'max_wav_value': 32768.0, 'sampling_rate': 44100, 'filter_length': 2048, 'hop_length': 512, 'win_length': 2048, 'n_mel_channels': 80, 'mel_fmin': 0.0, 'mel_fmax': 22050}, 'model': {'inter_channels': 192, 'hidden_channels': 192, 'filter_channels': 768, 'n_heads': 2, 'n_layers': 6, 'kernel_size': 3, 'p_dropout': 0.1, 'resblock': '1', 'resblock_kernel_sizes': [3, 7, 11], 'resblock_dilation_sizes': [[1, 3, 5], [1, 3, 5], [1, 3, 5]], 'upsample_rates': [8, 8, 2, 2, 2], 'upsample_initial_channel': 512, 'upsample_kernel_sizes': [16, 16, 4, 4, 4], 'n_layers_q': 3, 'use_spectral_norm': False, 'gin_channels': 256, 'ssl_dim': 256, 'n_speakers': 200}, 'spk': {'yuuka': 0}, 'clean_logs': True, 'trainer': 'admin', 'model_dir': './logs/44k'}
2
+ 2023-07-22 21:55:56,617 44k WARNING /home/aistudio/build不是git存储库,因此将忽略哈希值比较。
3
+ 2023-07-22 21:55:59,336 44k INFO 加载检查点 './logs/44k/G_0.pdparams' (迭代次数 1)
4
+ 2023-07-22 21:55:59,680 44k INFO 加载检查点 './logs/44k/D_0.pdparams' (迭代次数 1)
5
+ 2023-07-22 21:56:12,355 44k INFO 训练回合:1 [0%]
6
+ 2023-07-22 21:56:12,356 44k INFO 损失:[2.723755359649658, 2.7280983924865723, 7.272645950317383, 30.232248306274414, 3.609935998916626],步数:0,学习率:0.0001
7
+ 2023-07-22 21:56:20,694 44k INFO 保存模型和优化器状态位于迭代次数1 到 ./logs/44k/G_0.pdparams
8
+ 2023-07-22 21:56:22,248 44k INFO 保存模型和优化器状态位于迭代次数1 到 ./logs/44k/D_0.pdparams
logs/44k/vdlrecords.1690034156.log ADDED
Binary file (325 kB). View file
 
models.py ADDED
@@ -0,0 +1,556 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import copy
2
+ import math
3
+ import paddle
4
+ from paddle import nn
5
+ from paddle.nn import functional as F
6
+
7
+ import modules.attentions as attentions
8
+ import modules.commons as commons
9
+ import modules.modules as modules
10
+
11
+ from paddle.nn import Conv1D, Conv1DTranspose, AvgPool1D, Conv2D
12
+ from paddle.nn.utils import weight_norm, remove_weight_norm, spectral_norm
13
+
14
+ import utils
15
+ from modules.commons import init_weights, get_padding
16
+ from vdecoder.hifigan.models import Generator
17
+ from utils import f0_to_coarse
18
+ import random
19
+ import string
20
+ import time
21
+
22
+ class ResidualCouplingBlock(nn.Layer):
23
+ def __init__(self,
24
+ channels,
25
+ hidden_channels,
26
+ kernel_size,
27
+ dilation_rate,
28
+ n_layers,
29
+ n_flows=4,
30
+ gin_channels=0):
31
+ super().__init__()
32
+ self.channels = channels
33
+ self.hidden_channels = hidden_channels
34
+ self.kernel_size = kernel_size
35
+ self.dilation_rate = dilation_rate
36
+ self.n_layers = n_layers
37
+ self.n_flows = n_flows
38
+ self.gin_channels = gin_channels
39
+
40
+ self.flows = nn.LayerList()
41
+ for i in range(n_flows):
42
+ self.flows.append(modules.ResidualCouplingLayer(channels, hidden_channels, kernel_size, dilation_rate, n_layers, gin_channels=gin_channels, mean_only=True))
43
+ self.flows.append(modules.Flip())
44
+
45
+ def forward(self, x, x_mask, g=None, reverse=False):
46
+ if not reverse:
47
+ for flow in self.flows:
48
+ x, _ = flow(x, x_mask, g=g, reverse=reverse)
49
+ else:
50
+ for flow in reversed(self.flows):
51
+ x = flow(x, x_mask, g=g, reverse=reverse)
52
+ return x
53
+
54
+
55
+ class Encoder(nn.Layer):
56
+ def __init__(self,
57
+ in_channels,
58
+ out_channels,
59
+ hidden_channels,
60
+ kernel_size,
61
+ dilation_rate,
62
+ n_layers,
63
+ gin_channels=0):
64
+ super().__init__()
65
+ self.in_channels = in_channels
66
+ self.out_channels = out_channels
67
+ self.hidden_channels = hidden_channels
68
+ self.kernel_size = kernel_size
69
+ self.dilation_rate = dilation_rate
70
+ self.n_layers = n_layers
71
+ self.gin_channels = gin_channels
72
+
73
+ self.pre = nn.Conv1D(in_channels, hidden_channels, 1)
74
+ self.enc = modules.WN(hidden_channels, kernel_size, dilation_rate, n_layers, gin_channels=gin_channels)
75
+ self.proj = nn.Conv1D(hidden_channels, out_channels * 2, 1)
76
+
77
+ def forward(self, x, x_lengths, g=None):
78
+ # print(x.shape,x_lengths.shape)
79
+ x_mask = paddle.unsqueeze(commons.sequence_mask(x_lengths, x.shape[2]), 1).cast(x.dtype)
80
+ x = self.pre(x) * x_mask
81
+ x = self.enc(x, x_mask, g=g)
82
+ stats = self.proj(x) * x_mask
83
+ m, logs = paddle.split(stats, [self.out_channels,self.out_channels], axis=1)
84
+ z = (m + paddle.randn(m.shape,m.dtype) * paddle.exp(logs)) * x_mask
85
+ return z, m, logs, x_mask
86
+
87
+
88
+ class TextEncoder(nn.Layer):
89
+ def __init__(self,
90
+ out_channels,
91
+ hidden_channels,
92
+ kernel_size,
93
+ n_layers,
94
+ gin_channels=0,
95
+ filter_channels=None,
96
+ n_heads=None,
97
+ p_dropout=None):
98
+ super().__init__()
99
+ self.out_channels = out_channels
100
+ self.hidden_channels = hidden_channels
101
+ self.kernel_size = kernel_size
102
+ self.n_layers = n_layers
103
+ self.gin_channels = gin_channels
104
+ self.proj = nn.Conv1D(hidden_channels, out_channels * 2, 1)
105
+ self.f0_emb = nn.Embedding(256, hidden_channels)
106
+
107
+ self.enc_ = attentions.Encoder(
108
+ hidden_channels,
109
+ filter_channels,
110
+ n_heads,
111
+ n_layers,
112
+ kernel_size,
113
+ p_dropout)
114
+
115
+ def forward(self, x, x_mask, f0=None, noice_scale=1):
116
+ x = x + self.f0_emb(f0).transpose((0,2,1))
117
+ x = self.enc_(x * x_mask, x_mask)
118
+ stats = self.proj(x) * x_mask
119
+ m, logs = paddle.split(stats, [self.out_channels,self.out_channels], axis = 1)
120
+ z = (m + paddle.randn(m.shape,m.dtype) * paddle.exp(logs) * noice_scale) * x_mask
121
+ return z, m, logs, x_mask
122
+
123
+
124
+
125
+ class DiscriminatorP(paddle.nn.Layer):
126
+ def __init__(self, period, kernel_size=5, stride=3, use_spectral_norm=False):
127
+ super(DiscriminatorP, self).__init__()
128
+ self.period = period
129
+ self.use_spectral_norm = use_spectral_norm
130
+ norm_f = weight_norm if use_spectral_norm == False else spectral_norm
131
+ self.convs = nn.LayerList([
132
+ norm_f(Conv2D(1, 32, (kernel_size, 1), (stride, 1), padding=(get_padding(kernel_size, 1), 0))),
133
+ norm_f(Conv2D(32, 128, (kernel_size, 1), (stride, 1), padding=(get_padding(kernel_size, 1), 0))),
134
+ norm_f(Conv2D(128, 512, (kernel_size, 1), (stride, 1), padding=(get_padding(kernel_size, 1), 0))),
135
+ norm_f(Conv2D(512, 1024, (kernel_size, 1), (stride, 1), padding=(get_padding(kernel_size, 1), 0))),
136
+ norm_f(Conv2D(1024, 1024, (kernel_size, 1), 1, padding=(get_padding(kernel_size, 1), 0))),
137
+ ])
138
+ self.conv_post = norm_f(Conv2D(1024, 1, (3, 1), 1, padding=(1, 0)))
139
+
140
+ def forward(self, x):
141
+ fmap = []
142
+
143
+ # 1d to 2d
144
+ b, c, t = x.shape
145
+ if t % self.period != 0: # pad first
146
+ n_pad = self.period - (t % self.period)
147
+ x = F.pad(x, (0, n_pad), "reflect",data_format='NCL')
148
+ t = t + n_pad
149
+ x = x.reshape((b, c, t // self.period, self.period))
150
+
151
+ for l in self.convs:
152
+ x = l(x)
153
+ x = F.leaky_relu(x, modules.LRELU_SLOPE)
154
+ fmap.append(x)
155
+ x = self.conv_post(x)
156
+ fmap.append(x)
157
+ x = paddle.flatten(x, 1, -1)
158
+
159
+ return x, fmap
160
+
161
+
162
+ class DiscriminatorS(paddle.nn.Layer):
163
+ def __init__(self, use_spectral_norm=False):
164
+ super(DiscriminatorS, self).__init__()
165
+ norm_f = weight_norm if use_spectral_norm == False else spectral_norm
166
+ self.convs = nn.LayerList([
167
+ norm_f(Conv1D(1, 16, 15, 1, padding=7)),
168
+ norm_f(Conv1D(16, 64, 41, 4, groups=4, padding=20)),
169
+ norm_f(Conv1D(64, 256, 41, 4, groups=16, padding=20)),
170
+ norm_f(Conv1D(256, 1024, 41, 4, groups=64, padding=20)),
171
+ norm_f(Conv1D(1024, 1024, 41, 4, groups=256, padding=20)),
172
+ norm_f(Conv1D(1024, 1024, 5, 1, padding=2)),
173
+ ])
174
+ self.conv_post = norm_f(Conv1D(1024, 1, 3, 1, padding=1))
175
+
176
+ def forward(self, x):
177
+ fmap = []
178
+
179
+ for l in self.convs:
180
+ x = l(x)
181
+ x = F.leaky_relu(x, modules.LRELU_SLOPE)
182
+ fmap.append(x)
183
+ x = self.conv_post(x)
184
+ fmap.append(x)
185
+ x = paddle.flatten(x, 1, -1)
186
+
187
+ return x, fmap
188
+
189
+
190
+ class MultiPeriodDiscriminator(paddle.nn.Layer):
191
+ def __init__(self, use_spectral_norm=False):
192
+ super(MultiPeriodDiscriminator, self).__init__()
193
+ periods = [2,3,5,7,11]
194
+
195
+ discs = [DiscriminatorS(use_spectral_norm=use_spectral_norm)]
196
+ discs = discs + [DiscriminatorP(i, use_spectral_norm=use_spectral_norm) for i in periods]
197
+ self.discriminators = nn.LayerList(discs)
198
+
199
+ def forward(self, y, y_hat):
200
+ y_d_rs = []
201
+ y_d_gs = []
202
+ fmap_rs = []
203
+ fmap_gs = []
204
+ for i, d in enumerate(self.discriminators):
205
+ y_d_r, fmap_r = d(y)
206
+ y_d_g, fmap_g = d(y_hat)
207
+ y_d_rs.append(y_d_r)
208
+ y_d_gs.append(y_d_g)
209
+ fmap_rs.append(fmap_r)
210
+ fmap_gs.append(fmap_g)
211
+
212
+ return y_d_rs, y_d_gs, fmap_rs, fmap_gs
213
+
214
+
215
+ class SpeakerEncoder(paddle.nn.Layer):
216
+ def __init__(self, mel_n_channels=80, model_num_layers=3, model_hidden_size=256, model_embedding_size=256):
217
+ super(SpeakerEncoder, self).__init__()
218
+ self.lstm = nn.LSTM(mel_n_channels, model_hidden_size, model_num_layers)
219
+ self.linear = nn.Linear(model_hidden_size, model_embedding_size)
220
+ self.relu = nn.ReLU()
221
+
222
+ def forward(self, mels):
223
+ self.lstm.flatten_parameters()
224
+ _, (hidden, _) = self.lstm(mels)
225
+ embeds_raw = self.relu(self.linear(hidden[-1]))
226
+ return embeds_raw / paddle.norm(embeds_raw, axis=1, keepdim=True)
227
+
228
+ def compute_partial_slices(self, total_frames, partial_frames, partial_hop):
229
+ mel_slices = []
230
+ for i in range(0, total_frames-partial_frames, partial_hop):
231
+ mel_range = paddle.arange(i, i+partial_frames)
232
+ mel_slices.append(mel_range)
233
+
234
+ return mel_slices
235
+
236
+ def embed_utterance(self, mel, partial_frames=128, partial_hop=64):
237
+ mel_len = mel.shape[1]
238
+ last_mel = mel[:,-partial_frames:]
239
+
240
+ if mel_len > partial_frames:
241
+ mel_slices = self.compute_partial_slices(mel_len, partial_frames, partial_hop)
242
+ mels = list(mel[:,s] for s in mel_slices)
243
+ mels.append(last_mel)
244
+ mels = paddle.stack(tuple(mels), 0).squeeze(1)
245
+
246
+ with paddle.no_grad():
247
+ partial_embeds = self(mels)
248
+ embed = paddle.mean(partial_embeds, axis=0).unsqueeze(0)
249
+ #embed = embed / torch.linalg.norm(embed, 2)
250
+ else:
251
+ with paddle.no_grad():
252
+ embed = self(last_mel)
253
+
254
+ return embed
255
+
256
+ class F0Decoder(nn.Layer):
257
+ def __init__(self,
258
+ out_channels,
259
+ hidden_channels,
260
+ filter_channels,
261
+ n_heads,
262
+ n_layers,
263
+ kernel_size,
264
+ p_dropout,
265
+ spk_channels=0):
266
+ super().__init__()
267
+ self.out_channels = out_channels
268
+ self.hidden_channels = hidden_channels
269
+ self.filter_channels = filter_channels
270
+ self.n_heads = n_heads
271
+ self.n_layers = n_layers
272
+ self.kernel_size = kernel_size
273
+ self.p_dropout = p_dropout
274
+ self.spk_channels = spk_channels
275
+
276
+ self.prenet = nn.Conv1D(hidden_channels, hidden_channels, 3, padding=1)
277
+ self.decoder = attentions.FFT(
278
+ hidden_channels,
279
+ filter_channels,
280
+ n_heads,
281
+ n_layers,
282
+ kernel_size,
283
+ p_dropout)
284
+ self.proj = nn.Conv1D(hidden_channels, out_channels, 1)
285
+ self.f0_prenet = nn.Conv1D(1, hidden_channels , 3, padding=1)
286
+ self.cond = nn.Conv1D(spk_channels, hidden_channels, 1)
287
+
288
+ def forward(self, x, norm_f0, x_mask, spk_emb=None):
289
+ x = x.detach()
290
+ if (spk_emb is not None):
291
+ x = x + self.cond(spk_emb)
292
+ x += self.f0_prenet(norm_f0)
293
+ x = self.prenet(x) * x_mask
294
+ x = self.decoder(x * x_mask, x_mask)
295
+ x = self.proj(x) * x_mask
296
+ return x
297
+
298
+ class SynthesizerTrn_test(nn.Layer):
299
+ """
300
+ Synthesizer for Training
301
+ """
302
+
303
+ def __init__(self,
304
+ spec_channels,
305
+ segment_size,
306
+ inter_channels,
307
+ hidden_channels,
308
+ filter_channels,
309
+ n_heads,
310
+ n_layers,
311
+ kernel_size,
312
+ p_dropout,
313
+ resblock,
314
+ resblock_kernel_sizes,
315
+ resblock_dilation_sizes,
316
+ upsample_rates,
317
+ upsample_initial_channel,
318
+ upsample_kernel_sizes,
319
+ gin_channels,
320
+ ssl_dim,
321
+ n_speakers,
322
+ sampling_rate=44100,
323
+ **kwargs):
324
+
325
+ super().__init__()
326
+ self.spec_channels = spec_channels
327
+ self.inter_channels = inter_channels
328
+ self.hidden_channels = hidden_channels
329
+ self.filter_channels = filter_channels
330
+ self.n_heads = n_heads
331
+ self.n_layers = n_layers
332
+ self.kernel_size = kernel_size
333
+ self.p_dropout = p_dropout
334
+ self.resblock = resblock
335
+ self.resblock_kernel_sizes = resblock_kernel_sizes
336
+ self.resblock_dilation_sizes = resblock_dilation_sizes
337
+ self.upsample_rates = upsample_rates
338
+ self.upsample_initial_channel = upsample_initial_channel
339
+ self.upsample_kernel_sizes = upsample_kernel_sizes
340
+ self.segment_size = segment_size
341
+ self.gin_channels = gin_channels
342
+ self.ssl_dim = ssl_dim
343
+
344
+ init = paddle.nn.initializer.Normal(0.001,1)
345
+ pa = paddle.ParamAttr(f'emb_g_pa_{int(time.time())}',init)
346
+ self.emb_g = nn.Embedding(n_speakers, gin_channels, weight_attr = pa)
347
+
348
+ init = paddle.nn.initializer.Normal(2.7973e-06,0.0161)
349
+ pre_pa = paddle.ParamAttr(f'pre_pa_{int(time.time())}',init)
350
+ self.pre = nn.Conv1D(ssl_dim, hidden_channels, kernel_size=5, padding=2, weight_attr = pre_pa)
351
+
352
+ self.enc_p = TextEncoder(
353
+ inter_channels,
354
+ hidden_channels,
355
+ filter_channels=filter_channels,
356
+ n_heads=n_heads,
357
+ n_layers=n_layers,
358
+ kernel_size=kernel_size,
359
+ p_dropout=p_dropout
360
+ )
361
+ hps = {
362
+ "sampling_rate": sampling_rate,
363
+ "inter_channels": inter_channels,
364
+ "resblock": resblock,
365
+ "resblock_kernel_sizes": resblock_kernel_sizes,
366
+ "resblock_dilation_sizes": resblock_dilation_sizes,
367
+ "upsample_rates": upsample_rates,
368
+ "upsample_initial_channel": upsample_initial_channel,
369
+ "upsample_kernel_sizes": upsample_kernel_sizes,
370
+ "gin_channels": gin_channels,
371
+ }
372
+ self.dec = Generator(h=hps)
373
+ self.enc_q = Encoder(spec_channels, inter_channels, hidden_channels, 5, 1, 16, gin_channels=gin_channels)
374
+ self.flow = ResidualCouplingBlock(inter_channels, hidden_channels, 5, 1, 4, gin_channels=gin_channels)
375
+ self.f0_decoder = F0Decoder(
376
+ 1,
377
+ hidden_channels,
378
+ filter_channels,
379
+ n_heads,
380
+ n_layers,
381
+ kernel_size,
382
+ p_dropout,
383
+ spk_channels=gin_channels
384
+ )
385
+ initer = paddle.nn.initializer.Normal(mean = 0.202, std = 0.9640, name = f'emb_uv_init_weight_{time.time}')
386
+ emb_uv_pa = paddle.ParamAttr(f'emb_uv_init_weight_pa_{int(time.time())}',initer)
387
+ self.emb_uv = nn.Embedding(2, hidden_channels, weight_attr = emb_uv_pa)
388
+
389
+ def forward(self, c, f0, uv, spec, g=None, c_lengths=None, spec_lengths=None):
390
+ g = self.emb_g(g).transpose([0,2,1])
391
+ # ssl prenet
392
+ x_mask = paddle.unsqueeze(commons.sequence_mask(c_lengths, c.shape[2]), 1).astype(c.dtype)
393
+ emb_uv = self.emb_uv(uv.cast('int64')).transpose([0,2,1])
394
+ prec = self.pre(c)
395
+ x = prec * x_mask + emb_uv
396
+ # f0 predict
397
+ lf0 = 2595. * paddle.log10(1. + f0.unsqueeze(1) / 700.) / 500
398
+ norm_lf0 = utils.normalize_f0(lf0, x_mask, uv)
399
+ pred_lf0 = self.f0_decoder(x, norm_lf0, x_mask, spk_emb=g)
400
+
401
+ # encoder
402
+ z_ptemp, m_p, logs_p, _ = self.enc_p(x, x_mask, f0 = f0_to_coarse(f0))
403
+ z, m_q, logs_q, spec_mask = self.enc_q(spec, spec_lengths, g=g)
404
+
405
+ # flow
406
+ z_p = self.flow(z, spec_mask, g=g)
407
+ z_slice, pitch_slice, ids_slice = commons.rand_slice_segments_with_pitch(z, f0, spec_lengths, self.segment_size)
408
+ # nsf decoder
409
+ o = self.dec(z_slice, g=g, f0=pitch_slice)
410
+
411
+ return o, ids_slice, spec_mask, (z, z_p, m_p, logs_p, m_q, logs_q), pred_lf0, norm_lf0, lf0
412
+
413
+ def infer(self, c, f0, uv, g=None, noice_scale=0.35, predict_f0=False):
414
+ c_lengths = ((paddle.ones((c.shape[0],)) * c.shape[-1])).cpu() if 'cpu'in str(c.place) else ((paddle.ones((c.shape[0],)) * c.shape[-1])).cuda()
415
+ g = self.emb_g(g).transpose([0,2,1])
416
+ x_mask = paddle.unsqueeze(commons.sequence_mask(c_lengths, c.shape[2]), 1).astype(c.dtype)
417
+ x = self.pre(c) * x_mask + self.emb_uv(uv.astype('int64')).transpose([0,2,1])
418
+ if predict_f0:
419
+ lf0 = 2595. * paddle.log10(1. + f0.unsqueeze(1) / 700.) / 500
420
+ norm_lf0 = utils.normalize_f0(lf0, x_mask, uv, random_scale=False)
421
+ pred_lf0 = self.f0_decoder(x, norm_lf0, x_mask, spk_emb=g)
422
+ f0 = (700 * (paddle.pow(paddle.to_tensor(10.), pred_lf0 * 500 / 2595) - 1)).squeeze(1)
423
+ z_p, m_p, logs_p, c_mask = self.enc_p(x, x_mask, f0=f0_to_coarse(f0), noice_scale=noice_scale)
424
+ z = self.flow(z_p, c_mask, g=g, reverse=True)
425
+ o = self.dec(z * c_mask, g=g, f0=f0)
426
+ return o
427
+
428
+ class SynthesizerTrn(nn.Layer):
429
+ """
430
+ Synthesizer for Training
431
+ """
432
+
433
+ def __init__(self,
434
+ spec_channels,
435
+ segment_size,
436
+ inter_channels,
437
+ hidden_channels,
438
+ filter_channels,
439
+ n_heads,
440
+ n_layers,
441
+ kernel_size,
442
+ p_dropout,
443
+ resblock,
444
+ resblock_kernel_sizes,
445
+ resblock_dilation_sizes,
446
+ upsample_rates,
447
+ upsample_initial_channel,
448
+ upsample_kernel_sizes,
449
+ gin_channels,
450
+ ssl_dim,
451
+ n_speakers,
452
+ sampling_rate=44100,
453
+ **kwargs):
454
+
455
+ super().__init__()
456
+ self.spec_channels = spec_channels
457
+ self.inter_channels = inter_channels
458
+ self.hidden_channels = hidden_channels
459
+ self.filter_channels = filter_channels
460
+ self.n_heads = n_heads
461
+ self.n_layers = n_layers
462
+ self.kernel_size = kernel_size
463
+ self.p_dropout = p_dropout
464
+ self.resblock = resblock
465
+ self.resblock_kernel_sizes = resblock_kernel_sizes
466
+ self.resblock_dilation_sizes = resblock_dilation_sizes
467
+ self.upsample_rates = upsample_rates
468
+ self.upsample_initial_channel = upsample_initial_channel
469
+ self.upsample_kernel_sizes = upsample_kernel_sizes
470
+ self.segment_size = segment_size
471
+ self.gin_channels = gin_channels
472
+ self.ssl_dim = ssl_dim
473
+
474
+ init = paddle.nn.initializer.Normal(0.001,1)
475
+ pa = paddle.ParamAttr('emb_g_pa',init)
476
+ self.emb_g = nn.Embedding(n_speakers, gin_channels, weight_attr = pa)
477
+
478
+ init = paddle.nn.initializer.Normal(2.7973e-06,0.0161)
479
+ pre_pa = paddle.ParamAttr('pre_pa',init)
480
+ self.pre = nn.Conv1D(ssl_dim, hidden_channels, kernel_size=5, padding=2, weight_attr = pre_pa)
481
+
482
+ self.enc_p = TextEncoder(
483
+ inter_channels,
484
+ hidden_channels,
485
+ filter_channels=filter_channels,
486
+ n_heads=n_heads,
487
+ n_layers=n_layers,
488
+ kernel_size=kernel_size,
489
+ p_dropout=p_dropout
490
+ )
491
+ hps = {
492
+ "sampling_rate": sampling_rate,
493
+ "inter_channels": inter_channels,
494
+ "resblock": resblock,
495
+ "resblock_kernel_sizes": resblock_kernel_sizes,
496
+ "resblock_dilation_sizes": resblock_dilation_sizes,
497
+ "upsample_rates": upsample_rates,
498
+ "upsample_initial_channel": upsample_initial_channel,
499
+ "upsample_kernel_sizes": upsample_kernel_sizes,
500
+ "gin_channels": gin_channels,
501
+ }
502
+ self.dec = Generator(h=hps)
503
+ self.enc_q = Encoder(spec_channels, inter_channels, hidden_channels, 5, 1, 16, gin_channels=gin_channels)
504
+ self.flow = ResidualCouplingBlock(inter_channels, hidden_channels, 5, 1, 4, gin_channels=gin_channels)
505
+ self.f0_decoder = F0Decoder(
506
+ 1,
507
+ hidden_channels,
508
+ filter_channels,
509
+ n_heads,
510
+ n_layers,
511
+ kernel_size,
512
+ p_dropout,
513
+ spk_channels=gin_channels
514
+ )
515
+ initer = paddle.nn.initializer.Normal(mean = 0.202, std = 0.9640, name = f'emb_uv_init_weight')
516
+ emb_uv_pa = paddle.ParamAttr('emb_uv_init_weight_pa',initer)
517
+ self.emb_uv = nn.Embedding(2, hidden_channels, weight_attr = emb_uv_pa)
518
+
519
+ def forward(self, c, f0, uv, spec, g=None, c_lengths=None, spec_lengths=None):
520
+ g = self.emb_g(g).transpose([0,2,1])
521
+ # ssl prenet
522
+ x_mask = paddle.unsqueeze(commons.sequence_mask(c_lengths, c.shape[2]), 1).astype(c.dtype)
523
+ emb_uv = self.emb_uv(uv.cast('int64')).transpose([0,2,1])
524
+ prec = self.pre(c)
525
+ x = prec * x_mask + emb_uv
526
+ # f0 predict
527
+ lf0 = 2595. * paddle.log10(1. + f0.unsqueeze(1) / 700.) / 500
528
+ norm_lf0 = utils.normalize_f0(lf0, x_mask, uv)
529
+ pred_lf0 = self.f0_decoder(x, norm_lf0, x_mask, spk_emb=g)
530
+
531
+ # encoder
532
+ z_ptemp, m_p, logs_p, _ = self.enc_p(x, x_mask, f0 = f0_to_coarse(f0))
533
+ z, m_q, logs_q, spec_mask = self.enc_q(spec, spec_lengths, g=g)
534
+
535
+ # flow
536
+ z_p = self.flow(z, spec_mask, g=g)
537
+ z_slice, pitch_slice, ids_slice = commons.rand_slice_segments_with_pitch(z, f0, spec_lengths, self.segment_size)
538
+ # nsf decoder
539
+ o = self.dec(z_slice, g=g, f0=pitch_slice)
540
+
541
+ return o, ids_slice, spec_mask, (z, z_p, m_p, logs_p, m_q, logs_q), pred_lf0, norm_lf0, lf0
542
+
543
+ def infer(self, c, f0, uv, g=None, noice_scale=0.35, predict_f0=False):
544
+ c_lengths = ((paddle.ones((c.shape[0],)) * c.shape[-1])).cpu() if 'cpu'in str(c.place) else ((paddle.ones((c.shape[0],)) * c.shape[-1])).cuda()
545
+ g = self.emb_g(g).transpose([0,2,1])
546
+ x_mask = paddle.unsqueeze(commons.sequence_mask(c_lengths, c.shape[2]), 1).astype(c.dtype)
547
+ x = self.pre(c) * x_mask + self.emb_uv(uv.astype('int64')).transpose([0,2,1])
548
+ if predict_f0:
549
+ lf0 = 2595. * paddle.log10(1. + f0.unsqueeze(1) / 700.) / 500
550
+ norm_lf0 = utils.normalize_f0(lf0, x_mask, uv, random_scale=False)
551
+ pred_lf0 = self.f0_decoder(x, norm_lf0, x_mask, spk_emb=g)
552
+ f0 = (700 * (paddle.pow(paddle.to_tensor(10.), pred_lf0 * 500 / 2595) - 1)).squeeze(1)
553
+ z_p, m_p, logs_p, c_mask = self.enc_p(x, x_mask, f0=f0_to_coarse(f0), noice_scale=noice_scale)
554
+ z = self.flow(z_p, c_mask, g=g, reverse=True)
555
+ o = self.dec(z * c_mask, g=g, f0=f0)
556
+ return o
modules/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ '''由梅花三弄再回首花了一个下午迁移的模块。'''
modules/attentions.py ADDED
@@ -0,0 +1,377 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import copy
2
+ import math
3
+ import numpy as np
4
+ import paddle
5
+ from paddle import nn
6
+ from paddle.nn import functional as F
7
+
8
+ import modules.commons as commons
9
+ import modules.modules as modules
10
+ from modules.modules import LayerNorm
11
+
12
+
13
+ class FFT(nn.Layer):
14
+ def __init__(self, hidden_channels, filter_channels, n_heads, n_layers=1, kernel_size=1, p_dropout=0.,
15
+ proximal_bias=False, proximal_init=True, **kwargs):
16
+ super().__init__()
17
+ self.hidden_channels = hidden_channels
18
+ self.filter_channels = filter_channels
19
+ self.n_heads = n_heads
20
+ self.n_layers = n_layers
21
+ self.kernel_size = kernel_size
22
+ self.p_dropout = p_dropout
23
+ self.proximal_bias = proximal_bias
24
+ self.proximal_init = proximal_init
25
+
26
+ self.drop = nn.Dropout(p_dropout)
27
+ self.self_attn_layers = nn.LayerList()
28
+ self.norm_layers_0 = nn.LayerList()
29
+ self.ffn_layers = nn.LayerList()
30
+ self.norm_layers_1 = nn.LayerList()
31
+ for i in range(self.n_layers):
32
+ self.self_attn_layers.append(
33
+ MultiHeadAttention(hidden_channels, hidden_channels, n_heads, p_dropout=p_dropout, proximal_bias=proximal_bias,
34
+ proximal_init=proximal_init))
35
+ self.norm_layers_0.append(LayerNorm(hidden_channels))
36
+ self.ffn_layers.append(
37
+ FFN(hidden_channels, hidden_channels, filter_channels, kernel_size, p_dropout=p_dropout, causal=True))
38
+ self.norm_layers_1.append(LayerNorm(hidden_channels))
39
+
40
+ def forward(self, x, x_mask):
41
+ """
42
+ x: decoder input
43
+ h: encoder output
44
+ """
45
+ self_attn_mask = commons.subsequent_mask(x_mask.shape[2]).astype(dtype=x.dtype)
46
+ x = x * x_mask
47
+ for i in range(self.n_layers):
48
+ y = self.self_attn_layers[i](x, x, self_attn_mask)
49
+ y = self.drop(y)
50
+ x = self.norm_layers_0[i](x + y)
51
+
52
+ y = self.ffn_layers[i](x, x_mask)
53
+ y = self.drop(y)
54
+ x = self.norm_layers_1[i](x + y)
55
+ x = x * x_mask
56
+ return x
57
+
58
+
59
+ class Encoder(nn.Layer):
60
+ def __init__(self, hidden_channels, filter_channels, n_heads, n_layers, kernel_size=1, p_dropout=0., window_size=4, **kwargs):
61
+ super().__init__()
62
+ self.hidden_channels = hidden_channels
63
+ self.filter_channels = filter_channels
64
+ self.n_heads = n_heads
65
+ self.n_layers = n_layers
66
+ self.kernel_size = kernel_size
67
+ self.p_dropout = p_dropout
68
+ self.window_size = window_size
69
+
70
+ self.drop = nn.Dropout(p_dropout)
71
+ self.attn_layers = nn.LayerList()
72
+ self.norm_layers_1 = nn.LayerList()
73
+ self.ffn_layers = nn.LayerList()
74
+ self.norm_layers_2 = nn.LayerList()
75
+ for i in range(self.n_layers):
76
+ self.attn_layers.append(MultiHeadAttention(hidden_channels, hidden_channels, n_heads, p_dropout=p_dropout, window_size=window_size))
77
+ self.norm_layers_1.append(LayerNorm(hidden_channels))
78
+ self.ffn_layers.append(FFN(hidden_channels, hidden_channels, filter_channels, kernel_size, p_dropout=p_dropout))
79
+ self.norm_layers_2.append(LayerNorm(hidden_channels))
80
+
81
+ def forward(self, x, x_mask):
82
+ attn_mask = x_mask.unsqueeze(2) * x_mask.unsqueeze(-1)
83
+ x = x * x_mask
84
+ for i in range(self.n_layers):
85
+ y = self.attn_layers[i](x, x, attn_mask)
86
+ y = self.drop(y)
87
+ x = self.norm_layers_1[i](x + y)
88
+ y = self.ffn_layers[i](x, x_mask)
89
+ y = self.drop(y)
90
+ x = self.norm_layers_2[i](x + y)
91
+ x = x * x_mask
92
+ return x
93
+
94
+
95
+ class Decoder(nn.Layer):
96
+ def __init__(self, hidden_channels, filter_channels, n_heads, n_layers, kernel_size=1, p_dropout=0., proximal_bias=False, proximal_init=True, **kwargs):
97
+ super().__init__()
98
+ self.hidden_channels = hidden_channels
99
+ self.filter_channels = filter_channels
100
+ self.n_heads = n_heads
101
+ self.n_layers = n_layers
102
+ self.kernel_size = kernel_size
103
+ self.p_dropout = p_dropout
104
+ self.proximal_bias = proximal_bias
105
+ self.proximal_init = proximal_init
106
+
107
+ self.drop = nn.Dropout(p_dropout)
108
+ self.self_attn_layers = nn.LayerList()
109
+ self.norm_layers_0 = nn.LayerList()
110
+ self.encdec_attn_layers = nn.LayerList()
111
+ self.norm_layers_1 = nn.LayerList()
112
+ self.ffn_layers = nn.LayerList()
113
+ self.norm_layers_2 = nn.LayerList()
114
+ for i in range(self.n_layers):
115
+ self.self_attn_layers.append(MultiHeadAttention(hidden_channels, hidden_channels, n_heads, p_dropout=p_dropout, proximal_bias=proximal_bias, proximal_init=proximal_init))
116
+ self.norm_layers_0.append(LayerNorm(hidden_channels))
117
+ self.encdec_attn_layers.append(MultiHeadAttention(hidden_channels, hidden_channels, n_heads, p_dropout=p_dropout))
118
+ self.norm_layers_1.append(LayerNorm(hidden_channels))
119
+ self.ffn_layers.append(FFN(hidden_channels, hidden_channels, filter_channels, kernel_size, p_dropout=p_dropout, causal=True))
120
+ self.norm_layers_2.append(LayerNorm(hidden_channels))
121
+
122
+ def forward(self, x, x_mask, h, h_mask):
123
+ """
124
+ x: decoder input
125
+ h: encoder output
126
+ """
127
+ self_attn_mask = commons.subsequent_mask(x_mask.size(2)).astype(dtype=x.dtype)
128
+ encdec_attn_mask = h_mask.unsqueeze(2) * x_mask.unsqueeze(-1)
129
+ x = x * x_mask
130
+ for i in range(self.n_layers):
131
+ y = self.self_attn_layers[i](x, x, self_attn_mask)
132
+ y = self.drop(y)
133
+ x = self.norm_layers_0[i](x + y)
134
+
135
+ y = self.encdec_attn_layers[i](x, h, encdec_attn_mask)
136
+ y = self.drop(y)
137
+ x = self.norm_layers_1[i](x + y)
138
+
139
+ y = self.ffn_layers[i](x, x_mask)
140
+ y = self.drop(y)
141
+ x = self.norm_layers_2[i](x + y)
142
+ x = x * x_mask
143
+ return x
144
+
145
+
146
+ class MultiHeadAttention(nn.Layer):
147
+ def __init__(self, channels, out_channels, n_heads, p_dropout=0., window_size=None, heads_share=True, block_length=None, proximal_bias=False, proximal_init=False):
148
+ super().__init__()
149
+ assert channels % n_heads == 0
150
+
151
+ self.channels = channels
152
+ self.out_channels = out_channels
153
+ self.n_heads = n_heads
154
+ self.p_dropout = p_dropout
155
+ self.window_size = window_size
156
+ self.heads_share = heads_share
157
+ self.block_length = block_length
158
+ self.proximal_bias = proximal_bias
159
+ self.proximal_init = proximal_init
160
+ self.attn = None
161
+
162
+ self.k_channels = channels // n_heads
163
+
164
+ self.conv_q = nn.Conv1D(channels, channels, 1,)# weight_attr=attr)
165
+ self.conv_k = nn.Conv1D(channels, channels, 1,)# weight_attr=attr)
166
+ self.conv_v = nn.Conv1D(channels, channels, 1,)# weight_attr=attr)
167
+ self.conv_o = nn.Conv1D(channels, out_channels, 1)
168
+ self.drop = nn.Dropout(p_dropout)
169
+
170
+ if window_size is not None:
171
+ n_heads_rel = 1 if heads_share else n_heads
172
+ rel_stddev = self.k_channels**-0.5
173
+
174
+ rand = paddle.randn((n_heads_rel, window_size * 2 + 1, self.k_channels)) * rel_stddev
175
+
176
+ self.emb_rel_k = paddle.create_parameter(rand.shape,'float32',None)
177
+ self.emb_rel_v = paddle.create_parameter(rand.shape,'float32',None)
178
+
179
+ #nn.init.xavier_uniform_(self.conv_q.weight)
180
+ #nn.init.xavier_uniform_(self.conv_k.weight)
181
+ #nn.init.xavier_uniform_(self.conv_v.weight)
182
+ if proximal_init:
183
+ with paddle.no_grad():
184
+ self.conv_k.weight = (self.conv_q.weight)
185
+ self.conv_k.bias = (self.conv_q.bias)
186
+
187
+ def forward(self, x, c, attn_mask=None):
188
+ #print(x)
189
+ #print(self.conv_q.weight)
190
+ q = self.conv_q(x)
191
+ k = self.conv_k(c)
192
+ v = self.conv_v(c)
193
+
194
+ x, self.attn = self.attention(q, k, v, mask=attn_mask)
195
+
196
+ x = self.conv_o(x)
197
+ return x
198
+
199
+ @staticmethod
200
+ def _masked_fill(x, mask, value:float):
201
+ y = paddle.full(x.shape, value, x.dtype)
202
+ return paddle.where(mask, y, x)
203
+
204
+ def attention(self, query, key, value, mask=None):
205
+ # reshape [b, d, t] -> [b, n_h, t, d_k]
206
+ b, d, t_s, t_t = (*key.shape, query.shape[2])
207
+ query = query.reshape((b, self.n_heads, self.k_channels, t_t)).transpose([0,1,3,2])
208
+ key = key.reshape((b, self.n_heads, self.k_channels, t_s)).transpose([0,1,3,2])
209
+ value = value.reshape((b, self.n_heads, self.k_channels, t_s)).transpose([0,1,3,2])
210
+
211
+ scores = paddle.matmul(query / math.sqrt(self.k_channels), key.transpose([0,1,3,2])) # 0 1 2 3 -4 -3 -2 -1
212
+ if self.window_size is not None:
213
+ assert t_s == t_t, "Relative attention is only available for self-attention."
214
+
215
+ key_relative_embeddings = self._get_relative_embeddings(self.emb_rel_k, t_s)
216
+ rel_logits = self._matmul_with_relative_keys(query /math.sqrt(self.k_channels), key_relative_embeddings)
217
+ scores_local = self._relative_position_to_absolute_position(rel_logits)
218
+ scores = scores + scores_local
219
+ if self.proximal_bias:
220
+ assert t_s == t_t, "Proximal bias is only available for self-attention."
221
+ scores = scores + self._attention_bias_proximal(t_s).astype(dtype=scores.dtype)
222
+ if mask is not None:
223
+ scores = self._masked_fill(scores, mask == 0, -1e4)
224
+ if self.block_length is not None:
225
+ assert t_s == t_t, "Local attention is only available for self-attention."
226
+ block_mask = paddle.tril(paddle.triu(paddle.ones_like(scores), -self.block_length),self.block_length)
227
+ scores = self._masked_fill(scores, block_mask == 0, -1e4)
228
+ p_attn = F.softmax(scores, axis=-1) # [b, n_h, t_t, t_s]
229
+ p_attn = self.drop(p_attn)
230
+ output = paddle.matmul(p_attn, value)
231
+ if self.window_size is not None:
232
+ relative_weights = self._absolute_position_to_relative_position(p_attn)
233
+ value_relative_embeddings = self._get_relative_embeddings(self.emb_rel_v, t_s)
234
+ output = output + self._matmul_with_relative_values(relative_weights, value_relative_embeddings)
235
+ output = output.transpose([0,1,3,2]).reshape((b, d, t_t)) # [b, n_h, t_t, d_k] -> [b, d, t_t]
236
+ return output, p_attn
237
+
238
+ def _matmul_with_relative_values(self, x, y):
239
+ """
240
+ x: [b, h, l, m]
241
+ y: [h or 1, m, d]
242
+ ret: [b, h, l, d]
243
+ """
244
+ ret = paddle.matmul(x, y.unsqueeze(0))
245
+ return ret
246
+
247
+ def _matmul_with_relative_keys(self, x, y):
248
+ """
249
+ x: [b, h, l, d]
250
+ y: [h or 1, m, d]
251
+ ret: [b, h, l, m]
252
+ """
253
+ ret = paddle.matmul(x, y.unsqueeze(0).transpose([0,1,3,2]))
254
+ return ret
255
+
256
+ def _get_relative_embeddings(self, relative_embeddings, length):
257
+ max_relative_position = 2 * self.window_size + 1
258
+ # Pad first before slice to avoid using cond ops.
259
+ pad_length = max(length - (self.window_size + 1), 0)
260
+ slice_start_position = max((self.window_size + 1) - length, 0)
261
+ slice_end_position = slice_start_position + 2 * length - 1
262
+ if pad_length > 0:
263
+ padding = commons.convert_pad_shape([[0, 0], [pad_length, pad_length], [0, 0]])
264
+
265
+ padded_relative_embeddings = F.pad(
266
+ x = relative_embeddings.unsqueeze(0),
267
+ pad = padding[0:4]).squeeze(0)
268
+
269
+ else:
270
+ padded_relative_embeddings = relative_embeddings
271
+ used_relative_embeddings = padded_relative_embeddings[:,slice_start_position:slice_end_position]
272
+ return used_relative_embeddings
273
+
274
+ def _relative_position_to_absolute_position(self, x):
275
+ """
276
+ x: [b, h, l, 2*l-1]
277
+ ret: [b, h, l, l]
278
+ """
279
+ batch, heads, length, _ = x.shape
280
+ # Concat columns of pad to shift from relative to absolute indexing.
281
+ pad_shape = commons.convert_pad_shape([[0,0],[0,0],[0,0],[0,1]])
282
+ pad_shape = commons.fix_pad_shape(pad_shape, x)
283
+ x = F.pad(x, pad_shape)
284
+ # Concat extra elements so to add up to shape (len+1, 2*len-1).
285
+ x_flat = x.reshape([batch, heads, length * 2 * length])
286
+ pad_shape = commons.convert_pad_shape([[0,0],[0,0],[0,length-1]])
287
+ pad_shape = commons.fix_pad_shape(pad_shape,x_flat)
288
+ x_flat = F.pad(x_flat, pad_shape, data_format='NCL')
289
+ # Reshape and slice out the padded elements.
290
+ x_final = x_flat.reshape([batch, heads, length+1, 2*length-1])[:, :, :length, length-1:]
291
+ return x_final
292
+
293
+ def _absolute_position_to_relative_position(self, x):
294
+ """
295
+ x: [b, h, l, l]
296
+ ret: [b, h, l, 2*l-1]
297
+ """
298
+ batch, heads, length, _ = x.shape
299
+ # padd along column
300
+ pad_shape = commons.convert_pad_shape([[0, 0], [0, 0], [0, 0], [0, length-1]])
301
+ pad_shape = commons.fix_pad_shape(pad_shape, x)
302
+ x = F.pad(x, pad_shape)
303
+ x_flat = x.reshape([batch, heads, length**2 + length*(length -1)])
304
+ # add 0's in the beginning that will skew the elements after reshape
305
+ pad_shape = commons.convert_pad_shape([[0, 0], [0, 0], [length, 0]])
306
+ pad_shape = commons.fix_pad_shape(pad_shape, x_flat)
307
+ x_flat = F.pad(x_flat, pad_shape, data_format='NCL')
308
+ x_final = x_flat.reshape([batch, heads, length, 2*length])[:,:,:,1:]
309
+ return x_final
310
+
311
+ def _attention_bias_proximal(self, length):
312
+ """Bias for self-attention to encourage attention to close positions.
313
+ Args:
314
+ length: an integer scalar.
315
+ Returns:
316
+ a Tensor with shape [1, 1, length, length]
317
+ """
318
+ r = paddle.arange(length, dtype=np.float32)
319
+ diff = paddle.unsqueeze(r, 0) - paddle.unsqueeze(r, 1)
320
+ return paddle.unsqueeze(paddle.unsqueeze(-paddle.log1p(paddle.abs(diff)), 0), 0)
321
+
322
+
323
+ class FFN(nn.Layer):
324
+ def __init__(self, in_channels, out_channels, filter_channels, kernel_size, p_dropout=0., activation=None, causal=False):
325
+ super().__init__()
326
+ self.in_channels = in_channels
327
+ self.out_channels = out_channels
328
+ self.filter_channels = filter_channels
329
+ self.kernel_size = kernel_size
330
+ self.p_dropout = p_dropout
331
+ self.activation = activation
332
+ self.causal = causal
333
+
334
+ if causal:
335
+ self.padding = self._causal_padding
336
+ else:
337
+ self.padding = self._same_padding
338
+
339
+ self.conv_1 = nn.Conv1D(in_channels, filter_channels, kernel_size)
340
+ self.conv_2 = nn.Conv1D(filter_channels, out_channels, kernel_size)
341
+ self.drop = nn.Dropout(p_dropout)
342
+
343
+ def forward(self, x, x_mask):
344
+ x = x * x_mask
345
+ x = self.padding(x)
346
+ x = self.conv_1(x)
347
+ if self.activation == "gelu":
348
+ x = x * F.sigmoid(1.702 * x)
349
+ else:
350
+ x = F.relu(x)
351
+ x = self.drop(x)
352
+ x = x * x_mask
353
+ x = self.padding(x)
354
+ x = self.conv_2(x)
355
+ return x * x_mask
356
+
357
+ def _causal_padding(self, x):
358
+ if self.kernel_size == 1:
359
+ return x
360
+ pad_l = self.kernel_size - 1
361
+ pad_r = 0
362
+ padding = [[0, 0], [0, 0], [pad_l, pad_r]]
363
+ pad_shape:list = commons.convert_pad_shape(padding)
364
+ pad_shape = commons.fix_pad_shape(pad_shape, x)
365
+ x = F.pad(x, pad_shape,data_format='NCL')
366
+ return x
367
+
368
+ def _same_padding(self, x):
369
+ if self.kernel_size == 1:
370
+ return x
371
+ pad_l = (self.kernel_size - 1) // 2
372
+ pad_r = self.kernel_size // 2
373
+ padding = [[0, 0], [0, 0], [pad_l, pad_r]]
374
+ pad_shape = commons.convert_pad_shape(padding)
375
+ pad_shape = commons.fix_pad_shape(pad_shape, x)
376
+ x = F.pad(x, pad_shape, data_format='NCL')
377
+ return x
modules/commons.py ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+ import numpy as np
3
+ import paddle
4
+ from paddle import nn
5
+ from paddle.nn import functional as F
6
+
7
+ def slice_pitch_segments(x, ids_str, segment_size=4):
8
+ ret = paddle.zeros_like(x[:, :segment_size])
9
+ for i in range(x.shape[0]):
10
+ idx_str = ids_str[i]
11
+ idx_end = idx_str + segment_size
12
+ ret[i] = x[i, idx_str:idx_end]
13
+ return ret
14
+
15
+ def rand_slice_segments_with_pitch(x, pitch, x_lengths=None, segment_size=4):
16
+ b, d, t = x.shape
17
+ if x_lengths is None:
18
+ x_lengths = t
19
+ ids_str_max = x_lengths - segment_size + 1
20
+ ids_str = (paddle.rand([b]) * ids_str_max.astype('float32')).astype(dtype='int64')
21
+ ret = slice_segments(x, ids_str, segment_size)
22
+ ret_pitch = slice_pitch_segments(pitch, ids_str, segment_size)
23
+ return ret, ret_pitch, ids_str
24
+
25
+ def init_weights(m, mean=0.0, std=0.01):
26
+ classname = m.__class__.__name__
27
+ if classname.find("Conv") != -1:
28
+ m.weight.data.normal_(mean, std)
29
+
30
+
31
+ def get_padding(kernel_size, dilation=1):
32
+ return int((kernel_size*dilation - dilation)/2)
33
+
34
+
35
+ def convert_pad_shape(pad_shape):
36
+ l = pad_shape[::-1]
37
+ pad_shape = paddle.to_tensor([item for sublist in l for item in sublist],).flatten().astype('int32')
38
+ return pad_shape
39
+
40
+
41
+ def intersperse(lst, item):
42
+ result = [item] * (len(lst) * 2 + 1)
43
+ result[1::2] = lst
44
+ return result
45
+
46
+
47
+ def kl_divergence(m_p, logs_p, m_q, logs_q):
48
+ """KL(P||Q)"""
49
+ kl = (logs_q - logs_p) - 0.5
50
+ kl += 0.5 * (paddle.exp(2. * logs_p) + ((m_p - m_q)**2)) * paddle.exp(-2. * logs_q)
51
+ return kl
52
+
53
+
54
+ def rand_gumbel(shape):
55
+ """Sample from the Gumbel distribution, protect from overflows."""
56
+ uniform_samples = paddle.rand(shape) * 0.99998 + 0.00001
57
+ return -paddle.log(-paddle.log(uniform_samples))
58
+
59
+
60
+ def rand_gumbel_like(x):
61
+ g = rand_gumbel(x.shape).astype(dtype=x.dtype)
62
+ return g
63
+
64
+
65
+ def slice_segments(x, ids_str, segment_size=4):
66
+ ret = paddle.zeros_like(x[:, :, :segment_size])
67
+ for i in range(x.shape[0]):
68
+ idx_str = ids_str[i]
69
+ idx_end = idx_str + segment_size
70
+ ret[i] = x[i, :, idx_str:idx_end]
71
+ return ret
72
+
73
+
74
+ def rand_slice_segments(x, x_lengths=None, segment_size=4):
75
+ b, d, t = x.size()
76
+ if x_lengths is None:
77
+ x_lengths = t
78
+ ids_str_max = x_lengths - segment_size + 1
79
+ ids_str = (paddle.rand([b]) * ids_str_max).astype('int64')
80
+ ret = slice_segments(x, ids_str, segment_size)
81
+ return ret, ids_str
82
+
83
+
84
+ def rand_spec_segments(x, x_lengths=None, segment_size=4):
85
+ b, d, t = x.size()
86
+ if x_lengths is None:
87
+ x_lengths = t
88
+ ids_str_max = x_lengths - segment_size
89
+ ids_str = (paddle.rand([b]) * ids_str_max).astype('int64')
90
+ ret = slice_segments(x, ids_str, segment_size)
91
+ return ret, ids_str
92
+
93
+
94
+ def get_timing_signal_1d(
95
+ length, channels, min_timescale=1.0, max_timescale=1.0e4):
96
+ position = paddle.arange(length, dtype=np.float32)
97
+ num_timescales = channels // 2
98
+ log_timescale_increment = (
99
+ math.log(float(max_timescale) / float(min_timescale)) /
100
+ (num_timescales - 1))
101
+ inv_timescales = min_timescale * paddle.exp(
102
+ paddle.arange(num_timescales, dtype=np.float32) * -log_timescale_increment)
103
+ scaled_time = position.unsqueeze(0) * inv_timescales.unsqueeze(1)
104
+ signal = paddle.concat([paddle.sin(scaled_time), paddle.cos(scaled_time)], 0)
105
+ signal = F.pad(signal, [0, 0, 0, channels % 2])
106
+ signal = signal.reshape((1, channels, length))
107
+ return signal
108
+
109
+
110
+ def add_timing_signal_1d(x, min_timescale=1.0, max_timescale=1.0e4):
111
+ b, channels, length = x.shape
112
+ signal = get_timing_signal_1d(length, channels, min_timescale, max_timescale)
113
+ return x + signal.astype(dtype=x.dtype)
114
+
115
+
116
+ def cat_timing_signal_1d(x, min_timescale=1.0, max_timescale=1.0e4, axis=1):
117
+ b, channels, length = x.size()
118
+ signal = get_timing_signal_1d(length, channels, min_timescale, max_timescale)
119
+ return paddle.concat([x, signal.astype(dtype=x.dtype)], axis)
120
+
121
+
122
+ def subsequent_mask(length):
123
+ mask = paddle.tril(paddle.ones((length, length))).unsqueeze(0).unsqueeze(0)
124
+ return mask
125
+
126
+
127
+ #@paddle.jit.to_static # @torch.jit.script
128
+ def fused_add_tanh_sigmoid_multiply(input_a, input_b, n_channels):
129
+ n_channels_int = n_channels[0]
130
+ in_act = input_a + input_b
131
+ t_act = paddle.tanh(in_act[:, :n_channels_int, :])
132
+ s_act = paddle.nn.functional.sigmoid(in_act[:, n_channels_int:, :])
133
+ print(t_act)
134
+ print(s_act)
135
+ acts = t_act * s_act
136
+ return acts
137
+
138
+ def fix_pad_shape(pad_shape:paddle.Tensor, pad_tensor) -> paddle.Tensor: # 飞桨里面的padding函数对pad_shape有比较严格的要求,需要自己修正一下~~~
139
+ if len(pad_tensor.shape) == 3:
140
+ return pad_shape[0:2].astype('int32')
141
+ elif len(pad_tensor.shape) == 4:
142
+ return pad_shape[0:4].astype('int32')
143
+ elif len(pad_tensor.shape) == 5:
144
+ return pad_shape[0:6].astype('int32')
145
+ return pad_shape.astype('int32')
146
+
147
+ def shift_1d(x):
148
+ x = F.pad(x, convert_pad_shape([[0, 0], [0, 0], [1, 0]]))[:, :, :-1]
149
+ return x
150
+
151
+
152
+ def sequence_mask(length:paddle.Tensor, max_length=None):
153
+ if max_length is None:
154
+ max_length = length.max()
155
+ x = paddle.arange(max_length, dtype=length.dtype)
156
+ return x.unsqueeze(0) < length.unsqueeze(1)
157
+
158
+
159
+ def generate_path(duration, mask):
160
+ """
161
+ duration: [b, 1, t_x]
162
+ mask: [b, 1, t_y, t_x]
163
+ """
164
+ device = duration.device
165
+
166
+ b, _, t_y, t_x = mask.shape
167
+ cum_duration = paddle.cumsum(duration, -1)
168
+
169
+ cum_duration_flat = cum_duration.reshape((b * t_x))
170
+ path = sequence_mask(cum_duration_flat, t_y).astype(mask.dtype)
171
+ path = path.reshape((b, t_x, t_y))
172
+ path = path - F.pad(path, convert_pad_shape([[0, 0], [1, 0], [0, 0]]))[:, :-1]
173
+ path = path.unsqueeze(1).transpose([0,1,3,2]) * mask
174
+ return path
175
+
176
+
177
+ def clip_grad_value_(parameters, clip_value, norm_type=2):
178
+ if isinstance(parameters, paddle.Tensor):
179
+ parameters = [parameters]
180
+ parameters = list(filter(lambda p: p.grad is not None, parameters))
181
+ norm_type = float(norm_type)
182
+ if clip_value is not None:
183
+ clip_value = float(clip_value)
184
+
185
+ total_norm = 0
186
+ for p in parameters:
187
+ param_norm = paddle.to_tensor(p.grad).norm(norm_type)
188
+ total_norm += param_norm.item() ** norm_type
189
+ if clip_value is not None:
190
+ paddle.to_tensor(p.grad).clip_(min=-clip_value, max=clip_value)
191
+ total_norm = total_norm ** (1. / norm_type)
192
+ return total_norm
modules/losses.py ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import paddle
2
+ from paddle.nn import functional as F
3
+
4
+ import modules.commons as commons
5
+
6
+
7
+ def feature_loss(fmap_r, fmap_g):
8
+ loss = 0
9
+ for dr, dg in zip(fmap_r, fmap_g):
10
+ for rl, gl in zip(dr, dg):
11
+ rl = rl.astype('float32').detach()
12
+ gl = gl.astype('float32')
13
+ loss += paddle.mean(paddle.abs(rl - gl))
14
+
15
+ return loss * 2
16
+
17
+
18
+ def discriminator_loss(disc_real_outputs, disc_generated_outputs):
19
+ loss = 0
20
+ r_losses = []
21
+ g_losses = []
22
+ for dr, dg in zip(disc_real_outputs, disc_generated_outputs):
23
+ dr = dr.astype('float32')
24
+ dg = dg.astype('float32')
25
+ r_loss = paddle.mean((1-dr)**2)
26
+ g_loss = paddle.mean(dg**2)
27
+ loss += (r_loss + g_loss)
28
+ r_losses.append(r_loss.item())
29
+ g_losses.append(g_loss.item())
30
+
31
+ return loss, r_losses, g_losses
32
+
33
+
34
+ def generator_loss(disc_outputs):
35
+ loss = 0
36
+ gen_losses = []
37
+ for dg in disc_outputs:
38
+ dg = dg.astype('float32')
39
+ l = paddle.mean((1-dg)**2)
40
+ gen_losses.append(l)
41
+ loss += l
42
+
43
+ return loss, gen_losses
44
+
45
+
46
+ def kl_loss(z_p, logs_q, m_p, logs_p, z_mask):
47
+ """
48
+ z_p, logs_q: [b, h, t_t]
49
+ m_p, logs_p: [b, h, t_t]
50
+ """
51
+ z_p = z_p.astype('float32')
52
+ logs_q = logs_q.astype('float32')
53
+ m_p = m_p.astype('float32')
54
+ logs_p = logs_p.astype('float32')
55
+ z_mask = z_mask.astype('float32')
56
+ #print(logs_p)
57
+ kl = logs_p - logs_q - 0.5
58
+ kl += 0.5 * ((z_p - m_p)**2) * paddle.exp(-2. * logs_p)
59
+ kl = paddle.sum(kl * z_mask)
60
+ l = kl / paddle.sum(z_mask)
61
+ return l
modules/mel_processing.py ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+ import os
3
+ import random
4
+ import paddle
5
+ from paddle import nn
6
+ import paddle.nn.functional as F
7
+ import numpy as np
8
+ import librosa
9
+ import librosa.util as librosa_util
10
+ from librosa.util import normalize, pad_center, tiny
11
+ from scipy.signal import get_window
12
+ from scipy.io.wavfile import read
13
+ from librosa.filters import mel as librosa_mel_fn
14
+
15
+ MAX_WAV_VALUE = 32768.0
16
+
17
+
18
+ def dynamic_range_compression_torch(x, C=1, clip_val=1e-5):
19
+ """
20
+ PARAMS
21
+ ------
22
+ C: compression factor
23
+ """
24
+ return paddle.log(paddle.clip(x, min=clip_val) * C)
25
+
26
+
27
+ def dynamic_range_decompression_torch(x, C=1):
28
+ """
29
+ PARAMS
30
+ ------
31
+ C: compression factor used to compress
32
+ """
33
+ return paddle.exp(x) / C
34
+
35
+
36
+ def spectral_normalize_torch(magnitudes):
37
+ output = dynamic_range_compression_torch(magnitudes)
38
+ return output
39
+
40
+
41
+ def spectral_de_normalize_torch(magnitudes):
42
+ output = dynamic_range_decompression_torch(magnitudes)
43
+ return output
44
+
45
+
46
+ mel_basis = {}
47
+ hann_window = {}
48
+
49
+
50
+ def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False):
51
+ if paddle.min(y) < -1.:
52
+ print('min value is ', paddle.min(y))
53
+ if paddle.max(y) > 1.:
54
+ print('max value is ', paddle.max(y))
55
+
56
+ global hann_window
57
+ dtype_device = str(y.dtype) + '_' + str(str(y.place)[6:-1])
58
+ wnsize_dtype_device = str(win_size) + '_' + dtype_device
59
+ if wnsize_dtype_device not in hann_window:
60
+ hann_window[wnsize_dtype_device] = paddle.audio.functional.get_window('hann',win_size).astype(y.dtype)
61
+
62
+ y = paddle.nn.functional.pad(y.unsqueeze(1), (int((n_fft-hop_size)/2), int((n_fft-hop_size)/2)), mode='reflect', data_format='NCL')
63
+ y = y.squeeze(1)
64
+
65
+ spec = paddle.signal.stft(y, n_fft, hop_length=hop_size, win_length=win_size, window=hann_window[wnsize_dtype_device],
66
+ center=center, pad_mode='reflect', normalized=False, onesided=True)
67
+ spec = paddle.as_real(spec)
68
+ spec = paddle.sqrt(spec.pow(2).sum(-1) + 1e-6)
69
+ return spec
70
+
71
+
72
+ def spec_to_mel_torch(spec, n_fft, num_mels, sampling_rate, fmin, fmax):
73
+ global mel_basis
74
+ dtype_device = str(spec.dtype) + '_' + str(spec.place)[6:-1]
75
+ fmax_dtype_device = str(fmax) + '_' + dtype_device
76
+ if fmax_dtype_device not in mel_basis:
77
+ mel = librosa_mel_fn(sr=sampling_rate, n_fft=n_fft, n_mels=num_mels, fmin=fmin, fmax=fmax)
78
+ mel_basis[fmax_dtype_device] = paddle.to_tensor(mel).astype(spec.dtype)
79
+ spec = paddle.matmul(mel_basis[fmax_dtype_device], spec)
80
+ spec = spectral_normalize_torch(spec)
81
+ return spec
82
+
83
+
84
+ def mel_spectrogram_torch(y, n_fft, num_mels, sampling_rate, hop_size, win_size, fmin, fmax, center=False):
85
+ if paddle.min(y) < -1.:
86
+ print('min value is ', paddle.min(y))
87
+ if paddle.max(y) > 1.:
88
+ print('max value is ', paddle.max(y))
89
+
90
+ global mel_basis, hann_window
91
+ dtype_device = str(y.dtype) + '_' + str(y.place)[6:-1]
92
+ fmax_dtype_device = str(fmax) + '_' + dtype_device
93
+ wnsize_dtype_device = str(win_size) + '_' + dtype_device
94
+ if fmax_dtype_device not in mel_basis:
95
+ mel = librosa_mel_fn(sr=sampling_rate, n_fft=n_fft, n_mels=num_mels, fmin=fmin, fmax=fmax)
96
+ mel_basis[fmax_dtype_device] = paddle.to_tensor(mel).astype(y.dtype)
97
+ if wnsize_dtype_device not in hann_window:
98
+ hann_window[wnsize_dtype_device] = paddle.audio.functional.get_window('hann',win_size).astype(y.dtype)
99
+
100
+ y = paddle.nn.functional.pad(y.unsqueeze(1), (int((n_fft-hop_size)/2), int((n_fft-hop_size)/2)), mode='reflect',data_format = 'NCL')
101
+ y = y.squeeze(1)
102
+
103
+ spec = paddle.signal.stft(y, n_fft, hop_length=hop_size, win_length=win_size, window=hann_window[wnsize_dtype_device],
104
+ center=center, pad_mode='reflect', normalized=False, onesided=True)
105
+ spec = paddle.as_real(spec)
106
+ spec = paddle.sqrt(spec.pow(2).sum(-1) + 1e-6)
107
+
108
+ spec = paddle.matmul(mel_basis[fmax_dtype_device], spec)
109
+ spec = spectral_normalize_torch(spec)
110
+
111
+ return spec
modules/modules.py ADDED
@@ -0,0 +1,351 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import copy
2
+ import math
3
+ import numpy as np
4
+ import scipy
5
+ import paddle
6
+ from paddle import nn
7
+ from paddle.nn import functional as F
8
+
9
+ from paddle.nn import Conv1D, Conv1DTranspose, AvgPool1D, Conv2D
10
+ from paddle.nn.utils import weight_norm, remove_weight_norm
11
+
12
+ import modules.commons as commons
13
+ from modules.commons import init_weights, get_padding
14
+
15
+
16
+ LRELU_SLOPE = 0.1
17
+
18
+
19
+ class LayerNorm(nn.Layer):
20
+ def __init__(self, channels, eps=1e-5):
21
+ super().__init__()
22
+ self.channels = channels
23
+ self.eps = eps
24
+
25
+ self.gamma = paddle.create_parameter([channels],'float32','modules_Layer_Norm_gamma',\
26
+ paddle.ParamAttr(initializer = paddle.nn.initializer.Constant(value=1.0))) # ones,shape = [channels]
27
+ self.beta = paddle.create_parameter([channels],'float32','modules_Layer_Norm_beta',\
28
+ paddle.ParamAttr(initializer = paddle.nn.initializer.Constant(value=0.0))) # zeros,shape = [channels]
29
+
30
+ def forward(self, x):
31
+ x = x.transpose([0,2,1])#x.transpose(1, -1)
32
+ x = F.layer_norm(x, (self.channels,), self.gamma, self.beta, self.eps)
33
+ return x.transpose([0,2,1])#x.transpose(1, -1)
34
+
35
+
36
+ class ConvReluNorm(nn.Layer):
37
+ def __init__(self, in_channels, hidden_channels, out_channels, kernel_size, n_layers, p_dropout):
38
+ super().__init__()
39
+ self.in_channels = in_channels
40
+ self.hidden_channels = hidden_channels
41
+ self.out_channels = out_channels
42
+ self.kernel_size = kernel_size
43
+ self.n_layers = n_layers
44
+ self.p_dropout = p_dropout
45
+ assert n_layers > 1, "Number of layers should be larger than 0."
46
+
47
+ self.conv_layers = nn.LayerList()
48
+ self.norm_layers = nn.LayerList()
49
+ self.conv_layers.append(nn.Conv1D(in_channels, hidden_channels, kernel_size, padding=kernel_size//2))
50
+ self.norm_layers.append(LayerNorm(hidden_channels))
51
+ self.relu_drop = nn.Sequential(
52
+ nn.ReLU(),
53
+ nn.Dropout(p_dropout))
54
+ for _ in range(n_layers-1):
55
+ self.conv_layers.append(nn.Conv1D(hidden_channels, hidden_channels, kernel_size, padding=kernel_size//2))
56
+ self.norm_layers.append(LayerNorm(hidden_channels))
57
+ att = paddle.ParamAttr('modules_ConvReluNorm_att',initializer = paddle.nn.initializer.Constant(value=0.0)) # น้มใ
58
+ self.proj = nn.Conv1D(hidden_channels, out_channels, 1, weight_attr=att, bias_attr=att)
59
+ #self.proj.weight.data.zero_()
60
+ #self.proj.bias.data.zero_()
61
+
62
+ def forward(self, x, x_mask):
63
+ x_org = x
64
+ for i in range(self.n_layers):
65
+ x = self.conv_layers[i](x * x_mask)
66
+ x = self.norm_layers[i](x)
67
+ x = self.relu_drop(x)
68
+ x = x_org + self.proj(x)
69
+ return x * x_mask
70
+
71
+
72
+ class DDSConv(nn.Layer):
73
+ """
74
+ Dialted and Depth-Separable Convolution
75
+ """
76
+ def __init__(self, channels, kernel_size, n_layers, p_dropout=0.):
77
+ super().__init__()
78
+ self.channels = channels
79
+ self.kernel_size = kernel_size
80
+ self.n_layers = n_layers
81
+ self.p_dropout = p_dropout
82
+
83
+ self.drop = nn.Dropout(p_dropout)
84
+ self.convs_sep = nn.LayerList()
85
+ self.convs_1x1 = nn.LayerList()
86
+ self.norms_1 = nn.LayerList()
87
+ self.norms_2 = nn.LayerList()
88
+ for i in range(n_layers):
89
+ dilation = kernel_size ** i
90
+ padding = (kernel_size * dilation - dilation) // 2
91
+ self.convs_sep.append(nn.Conv1D(channels, channels, kernel_size,
92
+ groups=channels, dilation=dilation, padding=padding
93
+ ))
94
+ self.convs_1x1.append(nn.Conv1D(channels, channels, 1))
95
+ self.norms_1.append(LayerNorm(channels))
96
+ self.norms_2.append(LayerNorm(channels))
97
+
98
+ def forward(self, x, x_mask, g=None):
99
+ if g is not None:
100
+ x = x + g
101
+ for i in range(self.n_layers):
102
+ y = self.convs_sep[i](x * x_mask)
103
+ y = self.norms_1[i](y)
104
+ y = F.gelu(y)
105
+ y = self.convs_1x1[i](y)
106
+ y = self.norms_2[i](y)
107
+ y = F.gelu(y)
108
+ y = self.drop(y)
109
+ x = x + y
110
+ return x * x_mask
111
+
112
+
113
+ class WN(paddle.nn.Layer):
114
+ def __init__(self, hidden_channels, kernel_size, dilation_rate, n_layers, gin_channels=0, p_dropout=0):
115
+ super(WN, self).__init__()
116
+ assert(kernel_size % 2 == 1)
117
+ self.hidden_channels =hidden_channels
118
+ self.kernel_size = kernel_size,
119
+ self.dilation_rate = dilation_rate
120
+ self.n_layers = n_layers
121
+ self.gin_channels = gin_channels
122
+ self.p_dropout = p_dropout
123
+
124
+ self.in_layers = paddle.nn.LayerList()
125
+ self.res_skip_layers = paddle.nn.LayerList()
126
+ self.drop = nn.Dropout(p_dropout)
127
+
128
+ if gin_channels != 0:
129
+ cond_layer = paddle.nn.Conv1D(gin_channels, 2*hidden_channels*n_layers, 1)
130
+ self.cond_layer = paddle.nn.utils.weight_norm(cond_layer, name='weight')
131
+
132
+ for i in range(n_layers):
133
+ dilation = dilation_rate ** i
134
+ padding = int((kernel_size * dilation - dilation) / 2)
135
+ in_layer = paddle.nn.Conv1D(hidden_channels, 2*hidden_channels, kernel_size,
136
+ dilation=dilation, padding=padding)
137
+ in_layer = paddle.nn.utils.weight_norm(in_layer, name='weight')
138
+ self.in_layers.append(in_layer)
139
+
140
+ # last one is not necessary
141
+ if i < n_layers - 1:
142
+ res_skip_channels = 2 * hidden_channels
143
+ else:
144
+ res_skip_channels = hidden_channels
145
+
146
+ res_skip_layer = paddle.nn.Conv1D(hidden_channels, res_skip_channels, 1)
147
+ res_skip_layer = paddle.nn.utils.weight_norm(res_skip_layer, name='weight')
148
+ self.res_skip_layers.append(res_skip_layer)
149
+
150
+ def forward(self, x, x_mask, g=None, **kwargs):
151
+ output = paddle.zeros_like(x,name = 'module_WN_forward_output')
152
+
153
+ if g is not None:
154
+ g = self.cond_layer(g)
155
+
156
+ for i in range(self.n_layers):
157
+ x_in = self.in_layers[i](x)
158
+ if g is not None:
159
+ cond_offset = i * 2 * self.hidden_channels
160
+ g_l = g[:,cond_offset:cond_offset+2*self.hidden_channels,:]
161
+ else:
162
+ g_l = paddle.zeros_like(x_in,name = 'module_WN_forward_gl')
163
+
164
+ input_a=x_in; input_b=g_l
165
+ n_channels_int = self.hidden_channels
166
+ in_act = input_a + input_b
167
+ t_act = paddle.tanh(in_act[:, :n_channels_int, :])
168
+ s_act = paddle.nn.functional.sigmoid(in_act[:, n_channels_int:, :])
169
+ acts = t_act * s_act
170
+
171
+ acts = self.drop(acts)
172
+
173
+ res_skip_acts = self.res_skip_layers[i](acts)
174
+ if i < self.n_layers - 1:
175
+ res_acts = res_skip_acts[:,:self.hidden_channels,:]
176
+ x = (x + res_acts) * x_mask
177
+ output = output + res_skip_acts[:,self.hidden_channels:,:]
178
+ else:
179
+ output = output + res_skip_acts
180
+ return output * x_mask
181
+
182
+ def remove_weight_norm(self):
183
+ if self.gin_channels != 0:
184
+ paddle.nn.utils.remove_weight_norm(self.cond_layer)
185
+ for l in self.in_layers:
186
+ paddle.nn.utils.remove_weight_norm(l)
187
+ for l in self.res_skip_layers:
188
+ paddle.nn.utils.remove_weight_norm(l)
189
+
190
+
191
+ class ResBlock1(paddle.nn.Layer):
192
+ def __init__(self, channels, kernel_size=3, dilation=(1, 3, 5)):
193
+ super(ResBlock1, self).__init__()
194
+ self.convs1 = nn.LayerList([
195
+ weight_norm(Conv1D(channels, channels, kernel_size, 1, dilation=dilation[0],
196
+ padding=get_padding(kernel_size, dilation[0]))),
197
+ weight_norm(Conv1D(channels, channels, kernel_size, 1, dilation=dilation[1],
198
+ padding=get_padding(kernel_size, dilation[1]))),
199
+ weight_norm(Conv1D(channels, channels, kernel_size, 1, dilation=dilation[2],
200
+ padding=get_padding(kernel_size, dilation[2])))
201
+ ])
202
+ self.convs1.apply(init_weights)
203
+
204
+ self.convs2 = nn.LayerList([
205
+ weight_norm(Conv1D(channels, channels, kernel_size, 1, dilation=1,
206
+ padding=get_padding(kernel_size, 1))),
207
+ weight_norm(Conv1D(channels, channels, kernel_size, 1, dilation=1,
208
+ padding=get_padding(kernel_size, 1))),
209
+ weight_norm(Conv1D(channels, channels, kernel_size, 1, dilation=1,
210
+ padding=get_padding(kernel_size, 1)))
211
+ ])
212
+ self.convs2.apply(init_weights)
213
+
214
+ def forward(self, x, x_mask=None):
215
+ for c1, c2 in zip(self.convs1, self.convs2):
216
+ xt = F.leaky_relu(x, LRELU_SLOPE)
217
+ if x_mask is not None:
218
+ xt = xt * x_mask
219
+ xt = c1(xt)
220
+ xt = F.leaky_relu(xt, LRELU_SLOPE)
221
+ if x_mask is not None:
222
+ xt = xt * x_mask
223
+ xt = c2(xt)
224
+ x = xt + x
225
+ if x_mask is not None:
226
+ x = x * x_mask
227
+ return x
228
+
229
+ def remove_weight_norm(self):
230
+ for l in self.convs1:
231
+ remove_weight_norm(l)
232
+ for l in self.convs2:
233
+ remove_weight_norm(l)
234
+
235
+
236
+ class ResBlock2(paddle.nn.Layer):
237
+ def __init__(self, channels, kernel_size=3, dilation=(1, 3)):
238
+ super(ResBlock2, self).__init__()
239
+ self.convs = nn.LayerList([
240
+ weight_norm(Conv1D(channels, channels, kernel_size, 1, dilation=dilation[0],
241
+ padding=get_padding(kernel_size, dilation[0]))),
242
+ weight_norm(Conv1D(channels, channels, kernel_size, 1, dilation=dilation[1],
243
+ padding=get_padding(kernel_size, dilation[1])))
244
+ ])
245
+ self.convs.apply(init_weights)
246
+
247
+ def forward(self, x, x_mask=None):
248
+ for c in self.convs:
249
+ xt = F.leaky_relu(x, LRELU_SLOPE)
250
+ if x_mask is not None:
251
+ xt = xt * x_mask
252
+ xt = c(xt)
253
+ x = xt + x
254
+ if x_mask is not None:
255
+ x = x * x_mask
256
+ return x
257
+
258
+ def remove_weight_norm(self):
259
+ for l in self.convs:
260
+ remove_weight_norm(l)
261
+
262
+
263
+ class Log(nn.Layer):
264
+
265
+ def forward(self, x, x_mask, reverse=False, **kwargs):
266
+ if not reverse:
267
+ y = paddle.log(paddle.clip(x, 1e-5)) * x_mask
268
+ logdet = paddle.sum(-y, [1, 2])
269
+ return y, logdet
270
+ else:
271
+ x = paddle.exp(x) * x_mask
272
+ return x
273
+
274
+
275
+ class Flip(nn.Layer):
276
+ def forward(self, x, *args, reverse=False, **kwargs):
277
+ x = paddle.flip(x, [1])
278
+ if not reverse:
279
+ logdet = paddle.zeros([x.shape[0]]).astype(x.dtype)
280
+ return x, logdet
281
+ else:
282
+ return x
283
+
284
+
285
+ class ElementwiseAffine(nn.Layer):
286
+ def __init__(self, channels):
287
+ super().__init__()
288
+ self.channels = channels
289
+ self.m = paddle.create_parameter([channels,1],'float32',None,\
290
+ paddle.ParamAttr(initializer = paddle.nn.initializer.Constant(value=0.0)))
291
+ self.logs = paddle.create_parameter([channels,1],'float32',None,\
292
+ paddle.ParamAttr(initializer = paddle.nn.initializer.Constant(value=0.0)))
293
+
294
+ def forward(self, x, x_mask, reverse=False, **kwargs):
295
+ if not reverse:
296
+ y = self.m + paddle.exp(self.logs) * x
297
+ y = y * x_mask
298
+ logdet = paddle.sum(self.logs * x_mask, [1,2])
299
+ return y, logdet
300
+ else:
301
+ x = (x - self.m) * paddle.exp(-self.logs) * x_mask
302
+ return x
303
+
304
+
305
+ class ResidualCouplingLayer(nn.Layer):
306
+ def __init__(self,
307
+ channels,
308
+ hidden_channels,
309
+ kernel_size,
310
+ dilation_rate,
311
+ n_layers,
312
+ p_dropout=0,
313
+ gin_channels=0,
314
+ mean_only=False):
315
+ assert channels % 2 == 0, "channels should be divisible by 2"
316
+ super().__init__()
317
+ self.channels = channels
318
+ self.hidden_channels = hidden_channels
319
+ self.kernel_size = kernel_size
320
+ self.dilation_rate = dilation_rate
321
+ self.n_layers = n_layers
322
+ self.half_channels = channels // 2
323
+ self.mean_only = mean_only
324
+
325
+ self.pre = nn.Conv1D(self.half_channels, hidden_channels, 1)
326
+ self.enc = WN(hidden_channels, kernel_size, dilation_rate, n_layers, p_dropout=p_dropout, gin_channels=gin_channels)
327
+ att = paddle.ParamAttr(initializer = paddle.nn.initializer.Constant(value=0.0)) # น้มใ
328
+ self.post = nn.Conv1D(hidden_channels, self.half_channels * (2 - mean_only), 1,weight_attr=att, bias_attr=att)
329
+ #self.post.weight.data.zero_()
330
+ #self.post.bias.data.zero_()
331
+
332
+ def forward(self, x, x_mask, g=None, reverse=False):
333
+ x0, x1 = paddle.split(x, [self.half_channels]*2, 1)
334
+ h = self.pre(x0) * x_mask
335
+ h = self.enc(h, x_mask, g=g)
336
+ stats = self.post(h) * x_mask
337
+ if not self.mean_only:
338
+ m, logs = paddle.split(stats, [self.half_channels]*2, 1)
339
+ else:
340
+ m = stats
341
+ logs = paddle.zeros_like(m)
342
+
343
+ if not reverse:
344
+ x1 = m + x1 * paddle.exp(logs) * x_mask
345
+ x = paddle.concat([x0, x1], 1)
346
+ logdet = paddle.sum(logs, [1,2])
347
+ return x, logdet
348
+ else:
349
+ x1 = (x1 - m) * paddle.exp(-logs) * x_mask
350
+ x = paddle.concat([x0, x1], 1)
351
+ return x
output_2stems/blue-instrumental.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b9cdb5adc7ccd29f82f8f0d13adbdc83d4f8d9e56ea6f56d206f44e06e6ed690
3
+ size 2704274
output_2stems/blue-vocals.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:59edf5461750769e48eb8d72ab41bfbe92a2483d6fcf725a87fa52659d8400ac
3
+ size 2704274
output_2stems/temp-instrumental.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3583c87e8e45021d925579ef0f229ec88c6c73846509c6d08c03db0a18faba5e
3
+ size 2704274
output_2stems/temp-vocals.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:80b9fe08d766a205dc0e60f2fe80b951ec95c35a2c32fbc2bb72e98a7b3ccfff
3
+ size 2704274
paddle_infer_shape.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 这个脚本文件用于更改静态图的静态Shape为动态Shape,从飞桨的GitHub上面复制的
2
+ import argparse
3
+
4
+
5
+ def process_old_ops_desc(program):
6
+ for i in range(len(program.blocks[0].ops)):
7
+ if program.blocks[0].ops[i].type == "matmul":
8
+ if not program.blocks[0].ops[i].has_attr("head_number"):
9
+ program.blocks[0].ops[i]._set_attr("head_number", 1)
10
+
11
+
12
+ def infer_shape(program, input_shape_dict):
13
+ import paddle
14
+ paddle.enable_static()
15
+ import paddle.fluid as fluid
16
+
17
+ OP_WITHOUT_KERNEL_SET = {
18
+ 'feed', 'fetch', 'recurrent', 'go', 'rnn_memory_helper_grad',
19
+ 'conditional_block', 'while', 'send', 'recv', 'listen_and_serv',
20
+ 'fl_listen_and_serv', 'ncclInit', 'select', 'checkpoint_notify',
21
+ 'gen_bkcl_id', 'c_gen_bkcl_id', 'gen_nccl_id', 'c_gen_nccl_id',
22
+ 'c_comm_init', 'c_sync_calc_stream', 'c_sync_comm_stream',
23
+ 'queue_generator', 'dequeue', 'enqueue', 'heter_listen_and_serv',
24
+ 'c_wait_comm', 'c_wait_compute', 'c_gen_hccl_id', 'c_comm_init_hccl',
25
+ 'copy_cross_scope'
26
+ }
27
+ model_version = program.desc._version()
28
+ paddle_version = paddle.__version__
29
+ major_ver = model_version // 1000000
30
+ minor_ver = (model_version - major_ver * 1000000) // 1000
31
+ patch_ver = model_version - major_ver * 1000000 - minor_ver * 1000
32
+ model_version = "{}.{}.{}".format(major_ver, minor_ver, patch_ver)
33
+ if model_version != paddle_version:
34
+ print(
35
+ "[WARNING] The model is saved by paddlepaddle v{}, but now your paddlepaddle is version of {}, this difference may cause error, it is recommend you reinstall a same version of paddlepaddle for this model".
36
+ format(model_version, paddle_version))
37
+ for k, v in input_shape_dict.items():
38
+ program.blocks[0].var(k).desc.set_shape(v)
39
+ for i in range(len(program.blocks)):
40
+ for j in range(len(program.blocks[0].ops)):
41
+ if program.blocks[i].ops[j].type in OP_WITHOUT_KERNEL_SET:
42
+ continue
43
+ program.blocks[i].ops[j].desc.infer_shape(program.blocks[i].desc)
44
+
45
+
46
+ def parse_arguments():
47
+ parser = argparse.ArgumentParser()
48
+ parser.add_argument(
49
+ '--model_dir',
50
+ required=True,
51
+ help='Path of directory saved the input model.')
52
+ parser.add_argument(
53
+ '--model_filename', required=True, help='The input model file name.')
54
+ parser.add_argument(
55
+ '--params_filename', required=True, help='The parameters file name.')
56
+ parser.add_argument(
57
+ '--save_dir',
58
+ required=True,
59
+ help='Path of directory to save the new exported model.')
60
+ parser.add_argument(
61
+ '--input_shape_dict', required=True, help="The new shape information.")
62
+ return parser.parse_args()
63
+
64
+
65
+ if __name__ == '__main__':
66
+ args = parse_arguments()
67
+ import paddle
68
+ paddle.enable_static()
69
+ import paddle.fluid as fluid
70
+ input_shape_dict_str = args.input_shape_dict
71
+ input_shape_dict = eval(input_shape_dict_str)
72
+ print("Start to load paddle model...")
73
+ exe = fluid.Executor(fluid.CPUPlace())
74
+ [prog, ipts, outs] = fluid.io.load_inference_model(
75
+ args.model_dir,
76
+ exe,
77
+ model_filename=args.model_filename,
78
+ params_filename=args.params_filename)
79
+ process_old_ops_desc(prog)
80
+ infer_shape(prog, input_shape_dict)
81
+ fluid.io.save_inference_model(
82
+ args.save_dir,
83
+ ipts,
84
+ outs,
85
+ exe,
86
+ prog,
87
+ model_filename=args.model_filename,
88
+ params_filename=args.params_filename)
preprocess_flist_config.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import argparse
3
+ import re
4
+
5
+ from tqdm import tqdm
6
+ from random import shuffle
7
+ import json
8
+ import wave
9
+
10
+ config_template = json.load(open("configs/config.json"))
11
+
12
+ pattern = re.compile(r'^[\.a-zA-Z0-9_\/]+$')
13
+
14
+ def get_wav_duration(file_path):
15
+ with wave.open(file_path, 'rb') as wav_file:
16
+ # 获取音频帧数
17
+ n_frames = wav_file.getnframes()
18
+ # 获取采样率
19
+ framerate = wav_file.getframerate()
20
+ # 计算时长(秒)
21
+ duration = n_frames / float(framerate)
22
+ return duration
23
+
24
+ if __name__ == "__main__":
25
+ parser = argparse.ArgumentParser()
26
+ parser.add_argument("--train_list", type=str, default="./filelists/train.txt", help="path to train list")
27
+ parser.add_argument("--val_list", type=str, default="./filelists/val.txt", help="path to val list")
28
+ parser.add_argument("--test_list", type=str, default="./filelists/test.txt", help="path to test list")
29
+ parser.add_argument("--source_dir", type=str, default="./dataset/44k", help="path to source dir")
30
+ args = parser.parse_args()
31
+
32
+ train = []
33
+ val = []
34
+ test = []
35
+ idx = 0
36
+ spk_dict = {}
37
+ spk_id = 0
38
+ for speaker in tqdm(os.listdir(args.source_dir)):
39
+ spk_dict[speaker] = spk_id
40
+ spk_id += 1
41
+ wavs = ["/".join([args.source_dir, speaker, i]) for i in os.listdir(os.path.join(args.source_dir, speaker))]
42
+ new_wavs = []
43
+ for file in wavs:
44
+ if not file.endswith("wav"):
45
+ continue
46
+ if not pattern.match(file):
47
+ print(f"警告:文件名{file}中包含非字母数字下划线,可能会导致错误。(也可能不会)")
48
+ print('梅花自己测试发现是会出现问题的。')
49
+ if get_wav_duration(file) < 0.3:
50
+ print("跳过太短的音频:", file)
51
+ continue
52
+ new_wavs.append(file)
53
+ wavs = new_wavs
54
+ shuffle(wavs)
55
+ train += wavs[2:-2]
56
+ val += wavs[:2]
57
+ test += wavs[-2:]
58
+
59
+ shuffle(train)
60
+ shuffle(val)
61
+ shuffle(test)
62
+
63
+ print("写入:", args.train_list)
64
+ with open(args.train_list, "w") as f:
65
+ for fname in tqdm(train):
66
+ wavpath = fname
67
+ f.write(wavpath + "\n")
68
+
69
+ print("写入:", args.val_list)
70
+ with open(args.val_list, "w") as f:
71
+ for fname in tqdm(val):
72
+ wavpath = fname
73
+ f.write(wavpath + "\n")
74
+
75
+ print("写入:", args.test_list)
76
+ with open(args.test_list, "w") as f:
77
+ for fname in tqdm(test):
78
+ wavpath = fname
79
+ f.write(wavpath + "\n")
80
+
81
+ config_template["spk"] = spk_dict
82
+ print("写入:configs/config.json")
83
+ with open("configs/config.json", "w") as f:
84
+ json.dump(config_template, f, indent=2)
preprocess_hubert_f0.py ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+ import multiprocessing
3
+ import os
4
+ import argparse
5
+ from random import shuffle
6
+
7
+ import paddle
8
+ from glob import glob
9
+ from tqdm import tqdm
10
+
11
+ import utils
12
+ import logging
13
+ logging.getLogger('numba').setLevel(logging.WARNING)
14
+ import librosa
15
+ import numpy as np
16
+
17
+ hps = utils.get_hparams_from_file("configs/config.json")
18
+ sampling_rate = hps.data.sampling_rate
19
+ hop_length = hps.data.hop_length
20
+
21
+
22
+ def process_one(filename, hmodel):
23
+ # print(filename)
24
+ wav, sr = librosa.load(filename, sr=sampling_rate)
25
+ soft_path = filename + ".soft.pdtensor"
26
+ if not os.path.exists(soft_path):
27
+ devive = "cuda" if paddle.device.is_compiled_with_cuda() else "cpu"
28
+ wav16k = librosa.resample(wav, orig_sr=sampling_rate, target_sr=16000)
29
+ wav16k = paddle.to_tensor(wav16k).cpu() if devive=='cpu' else paddle.to_tensor(wav16k).cuda()
30
+ c:paddle.Tensor = utils.get_hubert_content(hmodel, wav_16k_tensor=wav16k)
31
+ paddle.save(c.cpu(), soft_path)
32
+ f0_path = filename + ".f0.npy"
33
+ if not os.path.exists(f0_path):
34
+ f0 = utils.compute_f0_dio(wav, sampling_rate=sampling_rate, hop_length=hop_length)
35
+ np.save(f0_path, f0)
36
+
37
+
38
+ def process_batch(filenames):
39
+ print("正在加载内容的HuBERT……")
40
+ device = "cuda" if paddle.device.is_compiled_with_cuda() else "cpu"
41
+ hmodel = utils.get_hubert_model()
42
+ print("HuBERT已被装载。")
43
+ for filename in tqdm(filenames):
44
+ process_one(filename, hmodel)
45
+
46
+
47
+ if __name__ == "__main__":
48
+ parser = argparse.ArgumentParser()
49
+ parser.add_argument("--in_dir", type=str, default="dataset/44k", help="path to input dir")
50
+
51
+ args = parser.parse_args()
52
+ filenames = glob(f'{args.in_dir}/*/*.wav', recursive=True) # [:10]
53
+ shuffle(filenames)
54
+ multiprocessing.set_start_method('spawn',force=True)
55
+
56
+ num_processes = 1
57
+ chunk_size = int(math.ceil(len(filenames) / num_processes))
58
+ chunks = [filenames[i:i + chunk_size] for i in range(0, len(filenames), chunk_size)]
59
+ print([len(c) for c in chunks])
60
+ processes = [multiprocessing.Process(target=process_batch, args=(chunk,)) for chunk in chunks]
61
+ for p in processes:
62
+ p.start()
raw/1.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5014db90a4bd53a18054ae2a2f9b1e733c8c474a6872beace1c3bd716b2cb61f
3
+ size 2484268
requirements.txt ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ numba==0.56.4
2
+ llvmlite==0.39.1
3
+ matplotlib
4
+ msgpack
5
+ librosa==0.10.0.post2
6
+ onnxruntime-gpu
7
+ pyworld==0.2.11.post0
8
+ praat-parselmouth
9
+ numpy==1.23.4
10
+ paddleaudio==1.0.2
11
+ gradio==3.19.1
12
+ pydub
13
+ ffmpeg-python
14
+ paddlepaddle==2.5.1
15
+ visualdl
16
+ tqdm