ThePioneer commited on
Commit
cdb937d
1 Parent(s): daa08e5

Upload sovits4_0_for_training_and_inference.ipynb

Browse files
sovits4_0_for_training_and_inference.ipynb ADDED
@@ -0,0 +1,568 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "nbformat": 4,
3
+ "nbformat_minor": 0,
4
+ "metadata": {
5
+ "colab": {
6
+ "provenance": []
7
+ },
8
+ "kernelspec": {
9
+ "name": "python3",
10
+ "display_name": "Python 3"
11
+ },
12
+ "language_info": {
13
+ "name": "python"
14
+ },
15
+ "accelerator": "GPU",
16
+ "gpuClass": "premium"
17
+ },
18
+ "cells": [
19
+ {
20
+ "cell_type": "code",
21
+ "source": [
22
+ "# Check the graphics card\n",
23
+ "!nvidia-smi"
24
+ ],
25
+ "metadata": {
26
+ "colab": {
27
+ "base_uri": "https://localhost:8080/"
28
+ },
29
+ "id": "0gQcIZ8RsOkn",
30
+ "outputId": "0fffd1e4-c10c-459d-e150-85985eb9a9f5"
31
+ },
32
+ "execution_count": null,
33
+ "outputs": [
34
+ {
35
+ "output_type": "stream",
36
+ "name": "stdout",
37
+ "text": [
38
+ "Fri Mar 10 11:50:53 2023 \n",
39
+ "+-----------------------------------------------------------------------------+\n",
40
+ "| NVIDIA-SMI 525.85.12 Driver Version: 525.85.12 CUDA Version: 12.0 |\n",
41
+ "|-------------------------------+----------------------+----------------------+\n",
42
+ "| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\n",
43
+ "| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n",
44
+ "| | | MIG M. |\n",
45
+ "|===============================+======================+======================|\n",
46
+ "| 0 NVIDIA A100-SXM... Off | 00000000:00:04.0 Off | 0 |\n",
47
+ "| N/A 30C P0 50W / 400W | 0MiB / 40960MiB | 0% Default |\n",
48
+ "| | | Disabled |\n",
49
+ "+-------------------------------+----------------------+----------------------+\n",
50
+ " \n",
51
+ "+-----------------------------------------------------------------------------+\n",
52
+ "| Processes: |\n",
53
+ "| GPU GI CI PID Type Process name GPU Memory |\n",
54
+ "| ID ID Usage |\n",
55
+ "|=============================================================================|\n",
56
+ "| No running processes found |\n",
57
+ "+-----------------------------------------------------------------------------+\n"
58
+ ]
59
+ }
60
+ ]
61
+ },
62
+ {
63
+ "cell_type": "code",
64
+ "execution_count": null,
65
+ "metadata": {
66
+ "id": "LS0OPRkL4Pme",
67
+ "colab": {
68
+ "base_uri": "https://localhost:8080/"
69
+ },
70
+ "outputId": "80aff322-6a7d-451c-81ea-921411184bcd"
71
+ },
72
+ "outputs": [
73
+ {
74
+ "output_type": "stream",
75
+ "name": "stdout",
76
+ "text": [
77
+ "Cloning into 'so-vits-svc'...\n",
78
+ "remote: Enumerating objects: 305, done.\u001b[K\n",
79
+ "remote: Counting objects: 100% (87/87), done.\u001b[K\n",
80
+ "remote: Compressing objects: 100% (68/68), done.\u001b[K\n",
81
+ "remote: Total 305 (delta 29), reused 23 (delta 4), pack-reused 218\u001b[K\n",
82
+ "Receiving objects: 100% (305/305), 8.03 MiB | 17.92 MiB/s, done.\n",
83
+ "Resolving deltas: 100% (116/116), done.\n"
84
+ ]
85
+ }
86
+ ],
87
+ "source": [
88
+ "#@title clone github repository\n",
89
+ "!git clone https://github.com/ThePioneerJP/so-vits-svc -b 4.0\n",
90
+ "#!git clone https://github.com/svc-develop-team/so-vits-svc -b 4.0\n"
91
+ ]
92
+ },
93
+ {
94
+ "cell_type": "code",
95
+ "source": [
96
+ "#@title install dependencies\n",
97
+ "%cd /content/so-vits-svc\n",
98
+ "!pip install pyproject-toml\n",
99
+ "!pip install pyworld praat-parselmouth #fairseq, won't work"
100
+ ],
101
+ "metadata": {
102
+ "id": "zXBLkXxL4T1O",
103
+ "colab": {
104
+ "base_uri": "https://localhost:8080/"
105
+ },
106
+ "outputId": "b22c8fc7-e9fb-440c-e2de-b201483e20f7"
107
+ },
108
+ "execution_count": null,
109
+ "outputs": [
110
+ {
111
+ "output_type": "stream",
112
+ "name": "stdout",
113
+ "text": [
114
+ "/content/so-vits-svc\n",
115
+ "Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
116
+ "Collecting pyproject-toml\n",
117
+ " Downloading pyproject_toml-0.0.10-py3-none-any.whl (6.9 kB)\n",
118
+ "Requirement already satisfied: jsonschema in /usr/local/lib/python3.9/dist-packages (from pyproject-toml) (4.3.3)\n",
119
+ "Requirement already satisfied: toml in /usr/local/lib/python3.9/dist-packages (from pyproject-toml) (0.10.2)\n",
120
+ "Requirement already satisfied: wheel in /usr/local/lib/python3.9/dist-packages (from pyproject-toml) (0.38.4)\n",
121
+ "Requirement already satisfied: setuptools>=42 in /usr/local/lib/python3.9/dist-packages (from pyproject-toml) (57.4.0)\n",
122
+ "Requirement already satisfied: attrs>=17.4.0 in /usr/local/lib/python3.9/dist-packages (from jsonschema->pyproject-toml) (22.2.0)\n",
123
+ "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /usr/local/lib/python3.9/dist-packages (from jsonschema->pyproject-toml) (0.19.3)\n",
124
+ "Installing collected packages: pyproject-toml\n",
125
+ "Successfully installed pyproject-toml-0.0.10\n",
126
+ "Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
127
+ "Collecting pyworld\n",
128
+ " Downloading pyworld-0.3.2.tar.gz (214 kB)\n",
129
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m214.4/214.4 KB\u001b[0m \u001b[31m18.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
130
+ "\u001b[?25h Installing build dependencies ... \u001b[?25l\u001b[?25hdone\n",
131
+ " Getting requirements to build wheel ... \u001b[?25l\u001b[?25hdone\n",
132
+ " Preparing metadata (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n",
133
+ "Collecting praat-parselmouth\n",
134
+ " Downloading praat_parselmouth-0.4.3-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (10.7 MB)\n",
135
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m10.7/10.7 MB\u001b[0m \u001b[31m100.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
136
+ "\u001b[?25hCollecting fairseq\n",
137
+ " Downloading fairseq-0.12.2.tar.gz (9.6 MB)\n",
138
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m9.6/9.6 MB\u001b[0m \u001b[31m102.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
139
+ "\u001b[?25h Installing build dependencies ... \u001b[?25l\u001b[?25hdone\n",
140
+ " Getting requirements to build wheel ... \u001b[?25l\u001b[?25hdone\n",
141
+ " Installing backend dependencies ... \u001b[?25l\u001b[?25hdone\n",
142
+ " Preparing metadata (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n",
143
+ "Requirement already satisfied: cython in /usr/local/lib/python3.9/dist-packages (from pyworld) (0.29.33)\n",
144
+ "Requirement already satisfied: numpy in /usr/local/lib/python3.9/dist-packages (from pyworld) (1.22.4)\n",
145
+ "Collecting omegaconf<2.1\n",
146
+ " Downloading omegaconf-2.0.6-py3-none-any.whl (36 kB)\n",
147
+ "Requirement already satisfied: torch in /usr/local/lib/python3.9/dist-packages (from fairseq) (1.13.1+cu116)\n",
148
+ "Collecting sacrebleu>=1.4.12\n",
149
+ " Downloading sacrebleu-2.3.1-py3-none-any.whl (118 kB)\n",
150
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m118.9/118.9 KB\u001b[0m \u001b[31m11.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
151
+ "\u001b[?25hCollecting bitarray\n",
152
+ " Downloading bitarray-2.7.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (269 kB)\n",
153
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m269.6/269.6 KB\u001b[0m \u001b[31m29.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
154
+ "\u001b[?25hCollecting hydra-core<1.1,>=1.0.7\n",
155
+ " Downloading hydra_core-1.0.7-py3-none-any.whl (123 kB)\n",
156
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m123.8/123.8 KB\u001b[0m \u001b[31m276.7 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
157
+ "\u001b[?25hRequirement already satisfied: cffi in /usr/local/lib/python3.9/dist-packages (from fairseq) (1.15.1)\n",
158
+ "Requirement already satisfied: torchaudio>=0.8.0 in /usr/local/lib/python3.9/dist-packages (from fairseq) (0.13.1+cu116)\n",
159
+ "Requirement already satisfied: tqdm in /usr/local/lib/python3.9/dist-packages (from fairseq) (4.65.0)\n",
160
+ "Requirement already satisfied: regex in /usr/local/lib/python3.9/dist-packages (from fairseq) (2022.6.2)\n",
161
+ "Collecting antlr4-python3-runtime==4.8\n",
162
+ " Downloading antlr4-python3-runtime-4.8.tar.gz (112 kB)\n",
163
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m112.4/112.4 KB\u001b[0m \u001b[31m16.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
164
+ "\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
165
+ "Requirement already satisfied: PyYAML>=5.1.* in /usr/local/lib/python3.9/dist-packages (from omegaconf<2.1->fairseq) (6.0)\n",
166
+ "Requirement already satisfied: typing-extensions in /usr/local/lib/python3.9/dist-packages (from omegaconf<2.1->fairseq) (4.5.0)\n",
167
+ "Requirement already satisfied: tabulate>=0.8.9 in /usr/local/lib/python3.9/dist-packages (from sacrebleu>=1.4.12->fairseq) (0.8.10)\n",
168
+ "Collecting colorama\n",
169
+ " Downloading colorama-0.4.6-py2.py3-none-any.whl (25 kB)\n",
170
+ "Requirement already satisfied: lxml in /usr/local/lib/python3.9/dist-packages (from sacrebleu>=1.4.12->fairseq) (4.9.2)\n",
171
+ "Collecting portalocker\n",
172
+ " Downloading portalocker-2.7.0-py2.py3-none-any.whl (15 kB)\n",
173
+ "Requirement already satisfied: pycparser in /usr/local/lib/python3.9/dist-packages (from cffi->fairseq) (2.21)\n",
174
+ "Building wheels for collected packages: pyworld, fairseq, antlr4-python3-runtime\n",
175
+ " Building wheel for pyworld (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n",
176
+ " Created wheel for pyworld: filename=pyworld-0.3.2-cp39-cp39-linux_x86_64.whl size=895531 sha256=88432eb6ce34c3782b8093414e554b9a155cafadcabdca6271d81ec0da473d86\n",
177
+ " Stored in directory: /root/.cache/pip/wheels/c5/91/01/58aa68f1f055ce534049e668292b710500100da0262079b8f5\n",
178
+ " \u001b[1;31merror\u001b[0m: \u001b[1msubprocess-exited-with-error\u001b[0m\n",
179
+ " \n",
180
+ " \u001b[31m×\u001b[0m \u001b[32mBuilding wheel for fairseq \u001b[0m\u001b[1;32m(\u001b[0m\u001b[32mpyproject.toml\u001b[0m\u001b[1;32m)\u001b[0m did not run successfully.\n",
181
+ " \u001b[31m│\u001b[0m exit code: \u001b[1;36m1\u001b[0m\n",
182
+ " \u001b[31m╰─>\u001b[0m See above for output.\n",
183
+ " \n",
184
+ " \u001b[1;35mnote\u001b[0m: This error originates from a subprocess, and is likely not a problem with pip.\n",
185
+ " Building wheel for fairseq (pyproject.toml) ... \u001b[?25l\u001b[?25herror\n",
186
+ "\u001b[31m ERROR: Failed building wheel for fairseq\u001b[0m\u001b[31m\n",
187
+ "\u001b[0m Building wheel for antlr4-python3-runtime (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
188
+ " Created wheel for antlr4-python3-runtime: filename=antlr4_python3_runtime-4.8-py3-none-any.whl size=141231 sha256=0c2694b2ac2df01ee6716e6c260dcfa6aabd464cde544b3a70cfefba6d4cbce7\n",
189
+ " Stored in directory: /root/.cache/pip/wheels/42/3c/ae/14db087e6018de74810afe32eb6ac890ef9c68ba19b00db97a\n",
190
+ "Successfully built pyworld antlr4-python3-runtime\n",
191
+ "Failed to build fairseq\n",
192
+ "\u001b[31mERROR: Could not build wheels for fairseq, which is required to install pyproject.toml-based projects\u001b[0m\u001b[31m\n",
193
+ "\u001b[0m"
194
+ ]
195
+ }
196
+ ]
197
+ },
198
+ {
199
+ "cell_type": "code",
200
+ "source": [
201
+ "#@title Install fairseq manually, as pip won't work. Make sure to move fairseq/fairseq directly below sovits folder before starting the training/inference.\n",
202
+ "#!rm -r /content/so-vits-svc/fairseq\n",
203
+ "!git clone https://github.com/pytorch/fairseq\n",
204
+ "%cd fairseq\n",
205
+ "!pip install --editable ./"
206
+ ],
207
+ "metadata": {
208
+ "colab": {
209
+ "base_uri": "https://localhost:8080/"
210
+ },
211
+ "id": "DUwWPMDhaUhc",
212
+ "outputId": "bf9fd529-27bb-41f0-c902-98d9f2ce3c75"
213
+ },
214
+ "execution_count": null,
215
+ "outputs": [
216
+ {
217
+ "output_type": "stream",
218
+ "name": "stdout",
219
+ "text": [
220
+ "Cloning into 'fairseq'...\n",
221
+ "remote: Enumerating objects: 34534, done.\u001b[K\n",
222
+ "remote: Total 34534 (delta 0), reused 0 (delta 0), pack-reused 34534\u001b[K\n",
223
+ "Receiving objects: 100% (34534/34534), 24.06 MiB | 17.61 MiB/s, done.\n",
224
+ "Resolving deltas: 100% (25109/25109), done.\n",
225
+ "/content/so-vits-svc/fairseq\n",
226
+ "Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
227
+ "Obtaining file:///content/so-vits-svc/fairseq\n",
228
+ " Installing build dependencies ... \u001b[?25l\u001b[?25hdone\n",
229
+ " Checking if build backend supports build_editable ... \u001b[?25l\u001b[?25hdone\n",
230
+ " Getting requirements to build wheel ... \u001b[?25l\u001b[?25hdone\n",
231
+ " Preparing metadata (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n",
232
+ "Requirement already satisfied: packaging in /usr/local/lib/python3.9/dist-packages (from fairseq==0.12.2) (23.0)\n",
233
+ "Requirement already satisfied: torchaudio>=0.8.0 in /usr/local/lib/python3.9/dist-packages (from fairseq==0.12.2) (0.13.1+cu116)\n",
234
+ "Collecting hydra-core<1.1,>=1.0.7\n",
235
+ " Using cached hydra_core-1.0.7-py3-none-any.whl (123 kB)\n",
236
+ "Requirement already satisfied: numpy>=1.21.3 in /usr/local/lib/python3.9/dist-packages (from fairseq==0.12.2) (1.22.4)\n",
237
+ "Requirement already satisfied: tqdm in /usr/local/lib/python3.9/dist-packages (from fairseq==0.12.2) (4.65.0)\n",
238
+ "Collecting omegaconf<2.1\n",
239
+ " Using cached omegaconf-2.0.6-py3-none-any.whl (36 kB)\n",
240
+ "Requirement already satisfied: cffi in /usr/local/lib/python3.9/dist-packages (from fairseq==0.12.2) (1.15.1)\n",
241
+ "Collecting sacrebleu>=1.4.12\n",
242
+ " Using cached sacrebleu-2.3.1-py3-none-any.whl (118 kB)\n",
243
+ "Requirement already satisfied: regex in /usr/local/lib/python3.9/dist-packages (from fairseq==0.12.2) (2022.6.2)\n",
244
+ "Collecting bitarray\n",
245
+ " Using cached bitarray-2.7.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (269 kB)\n",
246
+ "Requirement already satisfied: torch>=1.13 in /usr/local/lib/python3.9/dist-packages (from fairseq==0.12.2) (1.13.1+cu116)\n",
247
+ "Requirement already satisfied: cython in /usr/local/lib/python3.9/dist-packages (from fairseq==0.12.2) (0.29.33)\n",
248
+ "Requirement already satisfied: scikit-learn in /usr/local/lib/python3.9/dist-packages (from fairseq==0.12.2) (1.2.1)\n",
249
+ "Collecting antlr4-python3-runtime==4.8\n",
250
+ " Using cached antlr4_python3_runtime-4.8-py3-none-any.whl\n",
251
+ "Requirement already satisfied: typing-extensions in /usr/local/lib/python3.9/dist-packages (from omegaconf<2.1->fairseq==0.12.2) (4.5.0)\n",
252
+ "Requirement already satisfied: PyYAML>=5.1.* in /usr/local/lib/python3.9/dist-packages (from omegaconf<2.1->fairseq==0.12.2) (6.0)\n",
253
+ "Requirement already satisfied: tabulate>=0.8.9 in /usr/local/lib/python3.9/dist-packages (from sacrebleu>=1.4.12->fairseq==0.12.2) (0.8.10)\n",
254
+ "Collecting portalocker\n",
255
+ " Using cached portalocker-2.7.0-py2.py3-none-any.whl (15 kB)\n",
256
+ "Requirement already satisfied: lxml in /usr/local/lib/python3.9/dist-packages (from sacrebleu>=1.4.12->fairseq==0.12.2) (4.9.2)\n",
257
+ "Collecting colorama\n",
258
+ " Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)\n",
259
+ "Requirement already satisfied: pycparser in /usr/local/lib/python3.9/dist-packages (from cffi->fairseq==0.12.2) (2.21)\n",
260
+ "Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.9/dist-packages (from scikit-learn->fairseq==0.12.2) (3.1.0)\n",
261
+ "Requirement already satisfied: scipy>=1.3.2 in /usr/local/lib/python3.9/dist-packages (from scikit-learn->fairseq==0.12.2) (1.10.1)\n",
262
+ "Requirement already satisfied: joblib>=1.1.1 in /usr/local/lib/python3.9/dist-packages (from scikit-learn->fairseq==0.12.2) (1.2.0)\n",
263
+ "Installing collected packages: bitarray, antlr4-python3-runtime, portalocker, omegaconf, colorama, sacrebleu, hydra-core, fairseq\n",
264
+ " Running setup.py develop for fairseq\n",
265
+ "Successfully installed antlr4-python3-runtime-4.8 bitarray-2.7.3 colorama-0.4.6 fairseq hydra-core-1.0.7 omegaconf-2.0.6 portalocker-2.7.0 sacrebleu-2.3.1\n"
266
+ ]
267
+ }
268
+ ]
269
+ },
270
+ {
271
+ "cell_type": "code",
272
+ "source": [
273
+ "#@title Download necessary model files\n",
274
+ "# Source warehouse address: [contentvec](https://github.com/auspicious3000/contentvec)\n",
275
+ "# Model original download link: [checkpoint_best_legacy_500.pt](https://ibm.box.com/s/z1wgl1stco8ffooyatzdwsqn2psd9lrr)\n",
276
+ "# Since the source network disk cannot provide http direct links, according to the mit protocol, the model is redistributed to provide download direct links\n",
277
+ "%cd /content/so-vits-svc\n",
278
+ "!wget -P hubert/ https://huggingface.co/ThePioneer/NaturalGirlyVoice/resolve/main/checkpoint_best_legacy_500.pt -O hubert/checkpoint_best_legacy_500.pt"
279
+ ],
280
+ "metadata": {
281
+ "id": "pCqf3W0d6ify"
282
+ },
283
+ "execution_count": null,
284
+ "outputs": []
285
+ },
286
+ {
287
+ "cell_type": "markdown",
288
+ "source": [
289
+ "# Dataset preprocessing"
290
+ ],
291
+ "metadata": {
292
+ "id": "k1qadJBFehMo"
293
+ }
294
+ },
295
+ {
296
+ "cell_type": "code",
297
+ "source": [
298
+ "#@title Mount Google Drive\n",
299
+ "from google.colab import drive\n",
300
+ "drive.mount('/content/drive')"
301
+ ],
302
+ "metadata": {
303
+ "colab": {
304
+ "base_uri": "https://localhost:8080/"
305
+ },
306
+ "id": "wmUkpUmfn_Hs",
307
+ "outputId": "229600bd-4416-4136-ad80-ffc24511c09a"
308
+ },
309
+ "execution_count": null,
310
+ "outputs": [
311
+ {
312
+ "output_type": "stream",
313
+ "name": "stdout",
314
+ "text": [
315
+ "Mounted at /content/drive\n"
316
+ ]
317
+ }
318
+ ]
319
+ },
320
+ {
321
+ "cell_type": "code",
322
+ "source": [
323
+ "#@title backup everything (to protect from deletion)\n",
324
+ "!cp -r \"/content/so-vits-svc\" \"/content/drive/MyDrive/so-vits-svc-backup\""
325
+ ],
326
+ "metadata": {
327
+ "id": "b3-n-dR5Tzpt"
328
+ },
329
+ "execution_count": null,
330
+ "outputs": []
331
+ },
332
+ {
333
+ "cell_type": "markdown",
334
+ "source": [
335
+ "This processing script can preprocess multiple speakers at one time, and generate multi-speaker filelists and corresponding configuration files\n",
336
+ "\n",
337
+ "Just put your dataset into the dataset_raw directory according to the following file structure\n",
338
+ "\n",
339
+ "\n",
340
+ "```\n",
341
+ "dataset_raw\n",
342
+ "├───speaker0\n",
343
+ "│ ├───xxx1-xxx1.wav\n",
344
+ "│ ├───...\n",
345
+ "│ └───Lxx-0xx8.wav\n",
346
+ "└───speaker1\n",
347
+ " ├───xx2-0xxx2.wav\n",
348
+ " ├───...\n",
349
+ " └───xxx7-xxx007.wav\n",
350
+ "```"
351
+ ],
352
+ "metadata": {
353
+ "id": "kBlju6Q3lSM6"
354
+ }
355
+ },
356
+ {
357
+ "cell_type": "code",
358
+ "source": [
359
+ "#@title Load the packaged dataset from Google Cloud Disk for preprocessing\n",
360
+ "#@markdown **The data set of sovits3.0 no longer needs a specific file structure. Put all the wav files of the data set in the same folder, compress them into zip and upload them to Google Cloud Disk. This processing script can preprocess multiple Dataset, when processing multiple datasets, please decompress each dataset in turn**\n",
361
+ "\n",
362
+ "#@markdown Dataset name (**character’s English/Pinyin name**, which is the same as when creating the data folder; without zip.)\n",
363
+ "DATASETNAME = \"Ver0\" #@param {type:\"string\"}\n",
364
+ "#@markdown Compressed package path (Google disk path, don’t change this if you pass it to dataset, create a new one if there is no dataset folder)\n",
365
+ "#ZIP_PATH = \"/content/drive/MyDrive/dataset/\" #@param {type:\"string\"}\n",
366
+ "#ZIP_NAME = ZIP_PATH + DATASETNAME\n",
367
+ "\n",
368
+ "!cp -r /content/drive/MyDrive/diff-svc_dataset_wav_denoised /content/so-vits-svc/dataset_raw"
369
+ ],
370
+ "metadata": {
371
+ "id": "U05CXlAipvJR"
372
+ },
373
+ "execution_count": null,
374
+ "outputs": []
375
+ },
376
+ {
377
+ "cell_type": "code",
378
+ "source": [
379
+ "#@title Resample to 44100hz\n",
380
+ "%cd /content/so-vits-svc\n",
381
+ "!python resample.py"
382
+ ],
383
+ "metadata": {
384
+ "id": "_ThKTzYs5CfL"
385
+ },
386
+ "execution_count": null,
387
+ "outputs": []
388
+ },
389
+ {
390
+ "cell_type": "code",
391
+ "source": [
392
+ "#@title Divide the training set Generate configuration files\n",
393
+ "!python preprocess_flist_config.py"
394
+ ],
395
+ "metadata": {
396
+ "id": "svITReeL5N8K"
397
+ },
398
+ "execution_count": null,
399
+ "outputs": []
400
+ },
401
+ {
402
+ "cell_type": "code",
403
+ "source": [
404
+ "#@title generate hubert and f0\n",
405
+ "%cd /content/so-vits-svc\n",
406
+ "!pip install pyworld\n",
407
+ "!python preprocess_hubert_f0.py"
408
+ ],
409
+ "metadata": {
410
+ "id": "xHUXMi836DMe"
411
+ },
412
+ "execution_count": null,
413
+ "outputs": []
414
+ },
415
+ {
416
+ "cell_type": "code",
417
+ "source": [
418
+ "#@title At this point, the preprocessing of the data set is completed, and the data set and related files are saved to the dataset folder of Google Cloud Disk, which is convenient for the next training\n",
419
+ "#Compress the dataset folder\n",
420
+ "!zip -r dataset.zip /content/so-vits-svc/dataset\n",
421
+ "#@markdown Customize the name of the dataset folder under the dataset folder of Google Cloud Disk to avoid confusion\n",
422
+ "dataset_name_drive = \"Ver0_sovits4\" #@param {type:\"string\"}\n",
423
+ "DATASET_PATH_DRIVE = \"/content/drive/MyDrive/dataset/\" + dataset_name_drive\n",
424
+ "!mkdir -p {DATASET_PATH_DRIVE}\n",
425
+ "\n",
426
+ "!cp /content/so-vits-svc/dataset.zip \"{DATASET_PATH_DRIVE}\"\n",
427
+ "!cp configs/config.json \"{DATASET_PATH_DRIVE}\"\n",
428
+ "!cp filelists/train.txt \"{DATASET_PATH_DRIVE}\"\n",
429
+ "!cp filelists/val.txt \"{DATASET_PATH_DRIVE}\""
430
+ ],
431
+ "metadata": {
432
+ "id": "Wo4OTmTAUXgj"
433
+ },
434
+ "execution_count": null,
435
+ "outputs": []
436
+ },
437
+ {
438
+ "cell_type": "code",
439
+ "source": [
440
+ "#@title If the data set has been preprocessed, you can skip the preprocessing part and decompress the processed data and configuration files directly from the cloud disk\n",
441
+ "#@markdown Load the preprocessed data set from Google Cloud Disk, the folder name is the same as you entered when you backed up\n",
442
+ "back_up_name = \"Ver0_sovits4\" #@param {type:\"string\"}\n",
443
+ "BACK_UP_DATASET_PATH = \"/content/drive/MyDrive/dataset/\" + back_up_name\n",
444
+ "!unzip {BACK_UP_DATASET_PATH}/dataset.zip -d /\n",
445
+ "!cp {BACK_UP_DATASET_PATH}/config.json /content/so-vits-svc/configs/config.json \n",
446
+ "!cp {BACK_UP_DATASET_PATH}/val.txt filelists/val.txt\n",
447
+ "!cp {BACK_UP_DATASET_PATH}/train.txt filelists/train.txt\n",
448
+ "\n",
449
+ "\n",
450
+ "# Copy the record points saved on the cloud disk\n",
451
+ "# !cp /content/drive/MyDrive/G_800.pth logs/48k/\n",
452
+ "# !cp /content/drive/MyDrive/D_800.pth logs/48k/"
453
+ ],
454
+ "metadata": {
455
+ "id": "P2G6v_6zblWK"
456
+ },
457
+ "execution_count": null,
458
+ "outputs": []
459
+ },
460
+ {
461
+ "cell_type": "markdown",
462
+ "source": [
463
+ "# Training"
464
+ ],
465
+ "metadata": {
466
+ "id": "ENoH-pShel7w"
467
+ }
468
+ },
469
+ {
470
+ "cell_type": "code",
471
+ "source": [
472
+ "#@title Choose whether to save the trained model to Google Cloud Disk and whether to use the pre-model. It also works to continue training from the last saved point.\n",
473
+ "\n",
474
+ "#@markdown **Save the trained model file to Google Cloud Disk. After checking, you also need to check and execute when resuming training**\n",
475
+ "Save_to_drive = True #@param {type:\"boolean\"}\n",
476
+ "if Save_to_drive:\n",
477
+ " !rm -rf /content/so-vits-svc/logs/44k\n",
478
+ " !mkdir -p /content/drive/MyDrive/44k\n",
479
+ " !ln -s /content/drive/MyDrive/44k /content/so-vits-svc/logs/44k\n",
480
+ "\n",
481
+ "#@markdown **Download the pre-model for the first training and continue training after using the record points saved by yourself, no need to download again**\n",
482
+ "\n",
483
+ "#@markdown **Use the pre-model, check the box below to automatically download and enable**\n",
484
+ "pre_pth = False #@param {type:\"boolean\"}\n",
485
+ "if pre_pth:\n",
486
+ " !wget -P logs/44k/ https://huggingface.co/ThePioneer/NaturalGirlyVoice/resolve/main/G_0.pth\n",
487
+ " !wget -P logs/44k/ https://huggingface.co/ThePioneer/NaturalGirlyVoice/resolve/main/D_0.pth\n"
488
+ ],
489
+ "metadata": {
490
+ "id": "l8J2ubh9KV5J"
491
+ },
492
+ "execution_count": null,
493
+ "outputs": []
494
+ },
495
+ {
496
+ "cell_type": "code",
497
+ "source": [
498
+ "#@title Start training\n",
499
+ "\n",
500
+ "#@markdown **start training**\n",
501
+ "\n",
502
+ "#@markdown **Enable tensorboard to visualize data**\n",
503
+ "tensorboard_on = False #@param {type:\"boolean\"}\n",
504
+ "if tensorboard_on:\n",
505
+ " %load_ext tensorboard\n",
506
+ " %tensorboard --logdir logs/44k\n",
507
+ "\n",
508
+ "!python train.py -c configs/config.json -m 44k\n"
509
+ ],
510
+ "metadata": {
511
+ "id": "-hEFFTCfZf57"
512
+ },
513
+ "execution_count": null,
514
+ "outputs": []
515
+ },
516
+ {
517
+ "cell_type": "code",
518
+ "source": [
519
+ "#@title Manually back up the trained model files to Google Cloud Disk\n",
520
+ "#@markdown You need to check the file name of the model under the /content/so-vits-svc/logs/44k/ folder by yourself, and manually modify the file name at the end of the command below\n",
521
+ "!mv /content/so-vits-svc/logs/44k/G_1000.pth /content/drive/MyDrive\n",
522
+ "!mv /content/so-vits-svc/logs/44k/D_1000.pth /content/drive/MyDrive"
523
+ ],
524
+ "metadata": {
525
+ "id": "KiNCWprSPlKH"
526
+ },
527
+ "execution_count": null,
528
+ "outputs": []
529
+ },
530
+ {
531
+ "cell_type": "markdown",
532
+ "source": [
533
+ "# Inference"
534
+ ],
535
+ "metadata": {
536
+ "id": "oCnbX-OT897k"
537
+ }
538
+ },
539
+ {
540
+ "cell_type": "code",
541
+ "source": [
542
+ "#@title install necessary packages for inference\n",
543
+ "%cd /content/so-vits-svc\n",
544
+ "#!pip install parselmouth\n",
545
+ "!pip install praat-parselmouth"
546
+ ],
547
+ "metadata": {
548
+ "id": "jz4x6DwfWf2-"
549
+ },
550
+ "execution_count": null,
551
+ "outputs": []
552
+ },
553
+ {
554
+ "cell_type": "code",
555
+ "source": [
556
+ "#@title Synthetic Audio (Inference)\n",
557
+ "#@markdown needs to upload the audio to the so-vits-svc/raw folder, and then set the model path, configuration file path, and synthesized audio name\n",
558
+ "\n",
559
+ "!python inference_main.py -m \"/content/drive/MyDrive/44k/G_100000.pth\" -c \"configs/config.json\" -n \"君の知らない物語-src.wav\" -s Ver0 -t 0 -wf wav\n"
560
+ ],
561
+ "metadata": {
562
+ "id": "dYnKuKTIj3z1"
563
+ },
564
+ "execution_count": null,
565
+ "outputs": []
566
+ }
567
+ ]
568
+ }