Skip to content

Commit 78562af

Browse files
committed
为笔记本添加更多功能
1 parent 4b039b0 commit 78562af

File tree

1 file changed

+105
-12
lines changed

1 file changed

+105
-12
lines changed

Retrieval_based_Voice_Conversion_WebUI.ipynb

Lines changed: 105 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@
2020
"!nvidia-smi"
2121
]
2222
},
23-
{
24-
"cell_type": "markdown",
25-
"metadata": {},
26-
"source": []
27-
},
2823
{
2924
"cell_type": "code",
3025
"execution_count": null,
@@ -75,6 +70,7 @@
7570
},
7671
"outputs": [],
7772
"source": [
73+
"#@title 下载底模\n",
7874
"!apt -y install -qq aria2\n",
7975
"!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/D32k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o D32k.pth\n",
8076
"!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/D40k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o D40k.pth\n",
@@ -106,7 +102,7 @@
106102
"#@title 从谷歌云盘加载打包好的数据集到/content/dataset\n",
107103
"\n",
108104
"#@markdown 数据集位置\n",
109-
"DATASET = \"/content/drive/MyDrive/dataset/lulu20230327.zip\" #@param {type:\"string\"}\n",
105+
"DATASET = \"/content/drive/MyDrive/dataset/lulu20230327_32k.zip\" #@param {type:\"string\"}\n",
110106
"\n",
111107
"from google.colab import drive\n",
112108
"drive.mount('/content/drive')\n",
@@ -141,7 +137,7 @@
141137
"#@markdown 模型名\n",
142138
"MODELNAME = \"lulu\" #@param {type:\"string\"}\n",
143139
"#@markdown 模型epoch\n",
144-
"MODELEPOCH = 3540 #@param {type:\"integer\"}\n",
140+
"MODELEPOCH = 6600 #@param {type:\"integer\"}\n",
145141
"\n",
146142
"!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth /content/drive/MyDrive/{MODELNAME}_D_{MODELEPOCH}.pth\n",
147143
"!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth /content/drive/MyDrive/{MODELNAME}_G_{MODELEPOCH}.pth\n",
@@ -165,10 +161,15 @@
165161
"#@markdown 模型名\n",
166162
"MODELNAME = \"lulu\" #@param {type:\"string\"}\n",
167163
"#@markdown 模型epoch\n",
168-
"MODELEPOCH = 730 #@param {type:\"integer\"}\n",
164+
"MODELEPOCH = 250 #@param {type:\"integer\"}\n",
165+
"\n",
166+
"!mkdir -p /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}\n",
169167
"\n",
170168
"!cp /content/drive/MyDrive/{MODELNAME}_D_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth\n",
171-
"!cp /content/drive/MyDrive/{MODELNAME}_G_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth"
169+
"!cp /content/drive/MyDrive/{MODELNAME}_G_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth\n",
170+
"!cp /content/drive/MyDrive/*.index /content/\n",
171+
"!cp /content/drive/MyDrive/*.npy /content/\n",
172+
"!cp /content/drive/MyDrive/{MODELNAME}{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/weights/{MODELNAME}.pth"
172173
]
173174
},
174175
{
@@ -178,16 +179,108 @@
178179
"id": "ZKAyuKb9J6dz"
179180
},
180181
"outputs": [],
182+
"source": [
183+
"#@title 手动预处理(不推荐)\n",
184+
"#@markdown 模型名\n",
185+
"MODELNAME = \"lulu\" #@param {type:\"string\"}\n",
186+
"\n",
187+
"!python3 trainset_preprocess_pipeline_print.py /content/dataset 32000 8 logs/{MODELNAME} True\n"
188+
]
189+
},
190+
{
191+
"cell_type": "code",
192+
"execution_count": null,
193+
"metadata": {
194+
"id": "CrxJqzAUKmPJ"
195+
},
196+
"outputs": [],
197+
"source": [
198+
"#@title 手动提取特征(不推荐)\n",
199+
"#@markdown 模型名\n",
200+
"MODELNAME = \"lulu\" #@param {type:\"string\"}\n",
201+
"\n",
202+
"!python3 extract_feature_print.py 1 0 0 logs/{MODELNAME}\n"
203+
]
204+
},
205+
{
206+
"cell_type": "code",
207+
"execution_count": null,
208+
"metadata": {
209+
"id": "IMLPLKOaKj58"
210+
},
211+
"outputs": [],
181212
"source": [
182213
"#@title 手动训练(不推荐)\n",
183214
"#@markdown 模型名\n",
184215
"MODELNAME = \"lulu\" #@param {type:\"string\"}\n",
216+
"#@markdown 停止的epoch\n",
217+
"MODELEPOCH = 700 #@param {type:\"integer\"}\n",
218+
"#@markdown 保存epoch间隔\n",
219+
"EPOCHSAVE = 20 #@param {type:\"integer\"}\n",
220+
"#@markdown 采样率\n",
221+
"MODELSAMPLE = \"48k\" #@param {type:\"string\"}\n",
222+
"\n",
223+
"!python3 train_nsf_sim_cache_sid_load_pretrain.py -e lulu -sr {MODELSAMPLE} -f0 1 -bs 32 -g 0 -te {MODELEPOCH} -se {EPOCHSAVE} -pg pretrained/f0G{MODELSAMPLE}.pth -pd pretrained/f0D{MODELSAMPLE}.pth -l 0 -c 1\n"
224+
]
225+
},
226+
{
227+
"cell_type": "code",
228+
"execution_count": null,
229+
"metadata": {
230+
"id": "haYA81hySuDl"
231+
},
232+
"outputs": [],
233+
"source": [
234+
"#@title 删除其它pth,只留选中的(慎点,仔细看代码)\n",
235+
"#@markdown 模型名\n",
236+
"MODELNAME = \"lulu\" #@param {type:\"string\"}\n",
237+
"#@markdown 选中模型epoch\n",
238+
"MODELEPOCH = 6600 #@param {type:\"integer\"}\n",
239+
"\n",
240+
"!echo \"备份选中的模型。。。\"\n",
241+
"!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth /content/{MODELNAME}_D_{MODELEPOCH}.pth\n",
242+
"!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth /content/{MODELNAME}_G_{MODELEPOCH}.pth\n",
243+
"\n",
244+
"!echo \"正在删除。。。\"\n",
245+
"!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}\n",
246+
"!rm /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/*.pth\n",
247+
"\n",
248+
"!echo \"恢复选中的模型。。。\"\n",
249+
"!mv /content/{MODELNAME}_D_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth \n",
250+
"!mv /content/{MODELNAME}_G_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth\n",
251+
"\n",
252+
"!echo \"删除完成\"\n",
253+
"!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}"
254+
]
255+
},
256+
{
257+
"cell_type": "code",
258+
"execution_count": null,
259+
"metadata": {
260+
"id": "QhSiPTVPoIRh"
261+
},
262+
"outputs": [],
263+
"source": [
264+
"#@title 清除项目下所有文件,只留选中的模型(慎点,仔细看代码)\n",
265+
"#@markdown 模型名\n",
266+
"MODELNAME = \"lulu\" #@param {type:\"string\"}\n",
267+
"#@markdown 选中模型epoch\n",
268+
"MODELEPOCH = 1500 #@param {type:\"integer\"}\n",
269+
"\n",
270+
"!echo \"备份选中的模型。。。\"\n",
271+
"!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth /content/{MODELNAME}_D_{MODELEPOCH}.pth\n",
272+
"!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth /content/{MODELNAME}_G_{MODELEPOCH}.pth\n",
185273
"\n",
186-
"!python3 trainset_preprocess_pipeline_print.py /content/dataset 32000 8 logs/{MODELNAME} True\n",
274+
"!echo \"正在删除。。。\"\n",
275+
"!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}\n",
276+
"!rm -rf /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/*\n",
187277
"\n",
188-
"!python3 extract_feature_print.py 1 0 0 logs/{MODELNAME}\n",
278+
"!echo \"恢复选中的模型。。。\"\n",
279+
"!mv /content/{MODELNAME}_D_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth \n",
280+
"!mv /content/{MODELNAME}_G_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth\n",
189281
"\n",
190-
"!python3 train_nsf_sim_cache_sid_load_pretrain.py -e lulu -sr 32k -f0 0 -g 0 -bs 4 -te 10 -se 5 -pg pretrained/G32k.pth -pd pretrained/D32k.pth -l 0 -c 0\n"
282+
"!echo \"删除完成\"\n",
283+
"!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}"
191284
]
192285
}
193286
],

0 commit comments

Comments
 (0)