PhoenixStormJr commited on
Commit
036e8ac
·
verified ·
1 Parent(s): fc2e64e

Upload Retrieval_based_Voice_Conversion_WebUI_v2.ipynb with huggingface_hub

Browse files
Retrieval_based_Voice_Conversion_WebUI_v2.ipynb ADDED
@@ -0,0 +1,401 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "attachments": {},
5
+ "cell_type": "markdown",
6
+ "metadata": {
7
+ "id": "ZFFCx5J80SGa"
8
+ },
9
+ "source": [
10
+ "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/Retrieval_based_Voice_Conversion_WebUI_v2.ipynb)"
11
+ ]
12
+ },
13
+ {
14
+ "cell_type": "code",
15
+ "execution_count": null,
16
+ "metadata": {
17
+ "id": "GmFP6bN9dvOq"
18
+ },
19
+ "outputs": [],
20
+ "source": [
21
+ "#@title 查看显卡\n",
22
+ "!nvidia-smi"
23
+ ]
24
+ },
25
+ {
26
+ "cell_type": "code",
27
+ "execution_count": null,
28
+ "metadata": {
29
+ "id": "wjddIFr1oS3W"
30
+ },
31
+ "outputs": [],
32
+ "source": [
33
+ "#@title 安装依赖\n",
34
+ "!apt-get -y install build-essential python3-dev ffmpeg\n",
35
+ "!pip3 install --upgrade setuptools wheel\n",
36
+ "!pip3 install --upgrade pip\n",
37
+ "!pip3 install faiss-cpu==1.7.2 fairseq gradio==3.14.0 ffmpeg ffmpeg-python praat-parselmouth pyworld numpy==1.23.5 numba==0.56.4 librosa==0.9.2"
38
+ ]
39
+ },
40
+ {
41
+ "cell_type": "code",
42
+ "execution_count": null,
43
+ "metadata": {
44
+ "id": "ge_97mfpgqTm"
45
+ },
46
+ "outputs": [],
47
+ "source": [
48
+ "#@title 克隆仓库\n",
49
+ "\n",
50
+ "!mkdir Retrieval-based-Voice-Conversion-WebUI\n",
51
+ "%cd /content/Retrieval-based-Voice-Conversion-WebUI\n",
52
+ "!git init\n",
53
+ "!git remote add origin https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git\n",
54
+ "!git fetch origin cfd984812804ddc9247d65b14c82cd32e56c1133 --depth=1 \n",
55
+ "!git reset --hard FETCH_HEAD"
56
+ ]
57
+ },
58
+ {
59
+ "cell_type": "code",
60
+ "execution_count": null,
61
+ "metadata": {
62
+ "id": "BLDEZADkvlw1"
63
+ },
64
+ "outputs": [],
65
+ "source": [
66
+ "#@title 更新仓库(一般无需执行)\n",
67
+ "!git pull"
68
+ ]
69
+ },
70
+ {
71
+ "cell_type": "code",
72
+ "execution_count": null,
73
+ "metadata": {
74
+ "id": "pqE0PrnuRqI2"
75
+ },
76
+ "outputs": [],
77
+ "source": [
78
+ "#@title 安装aria2\n",
79
+ "!apt -y install -qq aria2"
80
+ ]
81
+ },
82
+ {
83
+ "cell_type": "code",
84
+ "execution_count": null,
85
+ "metadata": {
86
+ "id": "UG3XpUwEomUz"
87
+ },
88
+ "outputs": [],
89
+ "source": [
90
+ "#@title 下载底模\n",
91
+ "\n",
92
+ "# v1\n",
93
+ "!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",
94
+ "!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",
95
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/D48k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o D48k.pth\n",
96
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/G32k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o G32k.pth\n",
97
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/G40k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o G40k.pth\n",
98
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/G48k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o G48k.pth\n",
99
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0D32k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o f0D32k.pth\n",
100
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0D40k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o f0D40k.pth\n",
101
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0D48k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o f0D48k.pth\n",
102
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0G32k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o f0G32k.pth\n",
103
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0G40k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o f0G40k.pth\n",
104
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0G48k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o f0G48k.pth\n",
105
+ "\n",
106
+ "#v2\n",
107
+ "# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/D32k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o D32k.pth\n",
108
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/D40k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o D40k.pth\n",
109
+ "# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/D48k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o D48k.pth\n",
110
+ "# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/G32k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o G32k.pth\n",
111
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/G40k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o G40k.pth\n",
112
+ "# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/G48k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o G48k.pth\n",
113
+ "# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/f0D32k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o f0D32k.pth\n",
114
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/f0D40k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o f0D40k.pth\n",
115
+ "# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/f0D48k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o f0D48k.pth\n",
116
+ "# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/f0G32k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o f0G32k.pth\n",
117
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/f0G40k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o f0G40k.pth\n",
118
+ "# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/f0G48k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o f0G48k.pth"
119
+ ]
120
+ },
121
+ {
122
+ "cell_type": "code",
123
+ "execution_count": null,
124
+ "metadata": {
125
+ "id": "HugjmZqZRuiF"
126
+ },
127
+ "outputs": [],
128
+ "source": [
129
+ "#@title 下载人声分离模型\n",
130
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/uvr5_weights/HP2-人声vocals+非人声instrumentals.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/uvr5_weights -o HP2-人声vocals+非人声instrumentals.pth\n",
131
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/uvr5_weights/HP5-主旋律人声vocals+其他instrumentals.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/uvr5_weights -o HP5-主旋律人声vocals+其他instrumentals.pth"
132
+ ]
133
+ },
134
+ {
135
+ "cell_type": "code",
136
+ "execution_count": null,
137
+ "metadata": {
138
+ "id": "2RCaT9FTR0ej"
139
+ },
140
+ "outputs": [],
141
+ "source": [
142
+ "#@title 下载hubert_base\n",
143
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/hubert_base.pt -d /content/Retrieval-based-Voice-Conversion-WebUI -o hubert_base.pt"
144
+ ]
145
+ },
146
+ {
147
+ "cell_type": "code",
148
+ "execution_count": null,
149
+ "metadata": {
150
+ "id": "jwu07JgqoFON"
151
+ },
152
+ "outputs": [],
153
+ "source": [
154
+ "#@title 挂载谷歌云盘\n",
155
+ "\n",
156
+ "from google.colab import drive\n",
157
+ "drive.mount('/content/drive')"
158
+ ]
159
+ },
160
+ {
161
+ "cell_type": "code",
162
+ "execution_count": null,
163
+ "metadata": {
164
+ "id": "Mwk7Q0Loqzjx"
165
+ },
166
+ "outputs": [],
167
+ "source": [
168
+ "#@title 从谷歌云盘加载打包好的数据集到/content/dataset\n",
169
+ "\n",
170
+ "#@markdown 数据集位置\n",
171
+ "DATASET = \"/content/drive/MyDrive/dataset/lulu20230327_32k.zip\" #@param {type:\"string\"}\n",
172
+ "\n",
173
+ "!mkdir -p /content/dataset\n",
174
+ "!unzip -d /content/dataset -B {DATASET}"
175
+ ]
176
+ },
177
+ {
178
+ "cell_type": "code",
179
+ "execution_count": null,
180
+ "metadata": {
181
+ "id": "PDlFxWHWEynD"
182
+ },
183
+ "outputs": [],
184
+ "source": [
185
+ "#@title 重命名数据集中的重名文件\n",
186
+ "!ls -a /content/dataset/\n",
187
+ "!rename 's/(\\w+)\\.(\\w+)~(\\d*)/$1_$3.$2/' /content/dataset/*.*~*"
188
+ ]
189
+ },
190
+ {
191
+ "cell_type": "code",
192
+ "execution_count": null,
193
+ "metadata": {
194
+ "id": "7vh6vphDwO0b"
195
+ },
196
+ "outputs": [],
197
+ "source": [
198
+ "#@title 启动web\n",
199
+ "%cd /content/Retrieval-based-Voice-Conversion-WebUI\n",
200
+ "# %load_ext tensorboard\n",
201
+ "# %tensorboard --logdir /content/Retrieval-based-Voice-Conversion-WebUI/logs\n",
202
+ "!python3 infer-web.py --colab --pycmd python3"
203
+ ]
204
+ },
205
+ {
206
+ "cell_type": "code",
207
+ "execution_count": null,
208
+ "metadata": {
209
+ "id": "FgJuNeAwx5Y_"
210
+ },
211
+ "outputs": [],
212
+ "source": [
213
+ "#@title 手动将训练后的模型文件备份到谷歌云盘\n",
214
+ "#@markdown 需要自己查看logs文件夹下模型的文件名,手动修改下方命令末尾的文件名\n",
215
+ "\n",
216
+ "#@markdown 模型名\n",
217
+ "MODELNAME = \"lulu\" #@param {type:\"string\"}\n",
218
+ "#@markdown 模型epoch\n",
219
+ "MODELEPOCH = 9600 #@param {type:\"integer\"}\n",
220
+ "\n",
221
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth /content/drive/MyDrive/{MODELNAME}_D_{MODELEPOCH}.pth\n",
222
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth /content/drive/MyDrive/{MODELNAME}_G_{MODELEPOCH}.pth\n",
223
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/added_*.index /content/drive/MyDrive/\n",
224
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/total_*.npy /content/drive/MyDrive/\n",
225
+ "\n",
226
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/weights/{MODELNAME}.pth /content/drive/MyDrive/{MODELNAME}{MODELEPOCH}.pth"
227
+ ]
228
+ },
229
+ {
230
+ "cell_type": "code",
231
+ "execution_count": null,
232
+ "metadata": {
233
+ "id": "OVQoLQJXS7WX"
234
+ },
235
+ "outputs": [],
236
+ "source": [
237
+ "#@title 从谷歌云盘恢复pth\n",
238
+ "#@markdown 需要自己查看logs文件夹下模型的文件名,手动修改下方命令末尾的文件名\n",
239
+ "\n",
240
+ "#@markdown 模型名\n",
241
+ "MODELNAME = \"lulu\" #@param {type:\"string\"}\n",
242
+ "#@markdown 模型epoch\n",
243
+ "MODELEPOCH = 7500 #@param {type:\"integer\"}\n",
244
+ "\n",
245
+ "!mkdir -p /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}\n",
246
+ "\n",
247
+ "!cp /content/drive/MyDrive/{MODELNAME}_D_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth\n",
248
+ "!cp /content/drive/MyDrive/{MODELNAME}_G_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth\n",
249
+ "!cp /content/drive/MyDrive/*.index /content/\n",
250
+ "!cp /content/drive/MyDrive/*.npy /content/\n",
251
+ "!cp /content/drive/MyDrive/{MODELNAME}{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/weights/{MODELNAME}.pth"
252
+ ]
253
+ },
254
+ {
255
+ "cell_type": "code",
256
+ "execution_count": null,
257
+ "metadata": {
258
+ "id": "ZKAyuKb9J6dz"
259
+ },
260
+ "outputs": [],
261
+ "source": [
262
+ "#@title 手动预处理(不推荐)\n",
263
+ "#@markdown 模型名\n",
264
+ "MODELNAME = \"lulu\" #@param {type:\"string\"}\n",
265
+ "#@markdown 采样率\n",
266
+ "BITRATE = 48000 #@param {type:\"integer\"}\n",
267
+ "#@markdown 使用的进程数\n",
268
+ "THREADCOUNT = 8 #@param {type:\"integer\"}\n",
269
+ "\n",
270
+ "!python3 trainset_preprocess_pipeline_print.py /content/dataset {BITRATE} {THREADCOUNT} logs/{MODELNAME} True\n"
271
+ ]
272
+ },
273
+ {
274
+ "cell_type": "code",
275
+ "execution_count": null,
276
+ "metadata": {
277
+ "id": "CrxJqzAUKmPJ"
278
+ },
279
+ "outputs": [],
280
+ "source": [
281
+ "#@title 手动提取特征(不推荐)\n",
282
+ "#@markdown 模型名\n",
283
+ "MODELNAME = \"lulu\" #@param {type:\"string\"}\n",
284
+ "#@markdown 使用的进程数\n",
285
+ "THREADCOUNT = 8 #@param {type:\"integer\"}\n",
286
+ "#@markdown 音高提取算法\n",
287
+ "ALGO = \"harvest\" #@param {type:\"string\"}\n",
288
+ "\n",
289
+ "!python3 extract_f0_print.py logs/{MODELNAME} {THREADCOUNT} {ALGO}\n",
290
+ "\n",
291
+ "!python3 extract_feature_print.py cpu 1 0 0 logs/{MODELNAME}\n"
292
+ ]
293
+ },
294
+ {
295
+ "cell_type": "code",
296
+ "execution_count": null,
297
+ "metadata": {
298
+ "id": "IMLPLKOaKj58"
299
+ },
300
+ "outputs": [],
301
+ "source": [
302
+ "#@title 手动训练(不推荐)\n",
303
+ "#@markdown 模型名\n",
304
+ "MODELNAME = \"lulu\" #@param {type:\"string\"}\n",
305
+ "#@markdown 使用的GPU\n",
306
+ "USEGPU = \"0\" #@param {type:\"string\"}\n",
307
+ "#@markdown 批大小\n",
308
+ "BATCHSIZE = 32 #@param {type:\"integer\"}\n",
309
+ "#@markdown 停止的epoch\n",
310
+ "MODELEPOCH = 3200 #@param {type:\"integer\"}\n",
311
+ "#@markdown 保存epoch间隔\n",
312
+ "EPOCHSAVE = 100 #@param {type:\"integer\"}\n",
313
+ "#@markdown 采样率\n",
314
+ "MODELSAMPLE = \"48k\" #@param {type:\"string\"}\n",
315
+ "#@markdown 是否缓存训练集\n",
316
+ "CACHEDATA = 1 #@param {type:\"integer\"}\n",
317
+ "#@markdown 是否仅保存最新的ckpt文件\n",
318
+ "ONLYLATEST = 0 #@param {type:\"integer\"}\n",
319
+ "\n",
320
+ "!python3 train_nsf_sim_cache_sid_load_pretrain.py -e lulu -sr {MODELSAMPLE} -f0 1 -bs {BATCHSIZE} -g {USEGPU} -te {MODELEPOCH} -se {EPOCHSAVE} -pg pretrained/f0G{MODELSAMPLE}.pth -pd pretrained/f0D{MODELSAMPLE}.pth -l {ONLYLATEST} -c {CACHEDATA}\n"
321
+ ]
322
+ },
323
+ {
324
+ "cell_type": "code",
325
+ "execution_count": null,
326
+ "metadata": {
327
+ "id": "haYA81hySuDl"
328
+ },
329
+ "outputs": [],
330
+ "source": [
331
+ "#@title 删除其它pth,只留选中的(慎点,仔细看代码)\n",
332
+ "#@markdown 模型名\n",
333
+ "MODELNAME = \"lulu\" #@param {type:\"string\"}\n",
334
+ "#@markdown 选中模型epoch\n",
335
+ "MODELEPOCH = 9600 #@param {type:\"integer\"}\n",
336
+ "\n",
337
+ "!echo \"备份选中的模型。。。\"\n",
338
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth /content/{MODELNAME}_D_{MODELEPOCH}.pth\n",
339
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth /content/{MODELNAME}_G_{MODELEPOCH}.pth\n",
340
+ "\n",
341
+ "!echo \"正在删除。。。\"\n",
342
+ "!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}\n",
343
+ "!rm /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/*.pth\n",
344
+ "\n",
345
+ "!echo \"恢复选中的模型。。。\"\n",
346
+ "!mv /content/{MODELNAME}_D_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth \n",
347
+ "!mv /content/{MODELNAME}_G_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth\n",
348
+ "\n",
349
+ "!echo \"删除完成\"\n",
350
+ "!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}"
351
+ ]
352
+ },
353
+ {
354
+ "cell_type": "code",
355
+ "execution_count": null,
356
+ "metadata": {
357
+ "id": "QhSiPTVPoIRh"
358
+ },
359
+ "outputs": [],
360
+ "source": [
361
+ "#@title 清除项目下所有文件,只留选中的模型(慎点,仔细看代码)\n",
362
+ "#@markdown 模型名\n",
363
+ "MODELNAME = \"lulu\" #@param {type:\"string\"}\n",
364
+ "#@markdown 选中模型epoch\n",
365
+ "MODELEPOCH = 9600 #@param {type:\"integer\"}\n",
366
+ "\n",
367
+ "!echo \"备份选中的模型。。。\"\n",
368
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth /content/{MODELNAME}_D_{MODELEPOCH}.pth\n",
369
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth /content/{MODELNAME}_G_{MODELEPOCH}.pth\n",
370
+ "\n",
371
+ "!echo \"正在删除。。。\"\n",
372
+ "!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}\n",
373
+ "!rm -rf /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/*\n",
374
+ "\n",
375
+ "!echo \"恢复选中的模型。。。\"\n",
376
+ "!mv /content/{MODELNAME}_D_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth \n",
377
+ "!mv /content/{MODELNAME}_G_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth\n",
378
+ "\n",
379
+ "!echo \"删除完成\"\n",
380
+ "!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}"
381
+ ]
382
+ }
383
+ ],
384
+ "metadata": {
385
+ "accelerator": "GPU",
386
+ "colab": {
387
+ "private_outputs": true,
388
+ "provenance": []
389
+ },
390
+ "gpuClass": "standard",
391
+ "kernelspec": {
392
+ "display_name": "Python 3",
393
+ "name": "python3"
394
+ },
395
+ "language_info": {
396
+ "name": "python"
397
+ }
398
+ },
399
+ "nbformat": 4,
400
+ "nbformat_minor": 0
401
+ }