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