Skip to content

Commit

Permalink
chore(notebook): add nb-clean (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
34j authored Mar 18, 2023
1 parent 427b4c1 commit ac5b9de
Show file tree
Hide file tree
Showing 2 changed files with 277 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,7 @@ repos:
# hooks:
# - id: bandit
# args: [-x, tests]
- repo: https://github.com/srstevenson/nb-clean
rev: "2.4.0"
hooks:
- id: nb-clean
274 changes: 273 additions & 1 deletion notebooks/so-vits-svc-fork-4.0.ipynb
Original file line number Diff line number Diff line change
@@ -1 +1,273 @@
{"cells":[{"cell_type":"markdown","metadata":{"id":"FDGoAN-ll_Il"},"source":["## Before training\n","\n","This program saves the last 3 generations of models to Google Drive. Since 1 generation of models is >1GB, you should have at least 3GB of free space in Google Drive. If you do not have such free space, it is recommended to create another Google Account.\n","\n","Training requires >10GB VRAM. (T4 should be enough) Inference does not require such a lot of VRAM."]},{"cell_type":"markdown","metadata":{"id":"2HOVoJZ7xA7v"},"source":["## Installation"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":919,"status":"ok","timestamp":1679020450327,"user":{"displayName":"ああ","userId":"12005009733164811990"},"user_tz":-540},"id":"EItSTxc6GxLv","outputId":"58aa2dc5-21a2-4618-beae-eab3a0ce7d5a"},"outputs":[],"source":["#@title Check GPU\n","!nvidia-smi"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":126843,"status":"ok","timestamp":1679020577168,"user":{"displayName":"ああ","userId":"12005009733164811990"},"user_tz":-540},"id":"ah5zv5MOCvIX","outputId":"e10caaae-4399-4774-ff43-06d29459a101"},"outputs":[],"source":["#@title Install dependencies\n","!python -m pip install -U pip wheel\n","%pip install -U ipython \n","\n","#@markdown Branch (for development)\n","BRANCH = \"none\" #@param {\"type\": \"string\"}\n","if BRANCH == \"none\":\n"," %pip install -U so-vits-svc-fork\n","else:\n"," %pip install -U git+https://github.com/34j/so-vits-svc-fork.git@{BRANCH}"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":405045,"status":"ok","timestamp":1679020982207,"user":{"displayName":"ああ","userId":"12005009733164811990"},"user_tz":-540},"id":"lf1eVKmuZRDW","outputId":"c8d9f10c-54e4-4024-91f9-0ce7d5910d93"},"outputs":[],"source":["#@title Mount Google Drive\n","from google.colab import drive\n","drive.mount('/content/drive')"]},{"cell_type":"markdown","metadata":{"id":"J5ttGhG3xEs3"},"source":["## Training"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":7,"status":"ok","timestamp":1679020982207,"user":{"displayName":"ああ","userId":"12005009733164811990"},"user_tz":-540},"id":"nnmmJvbDd5cn","outputId":"ca65956d-f7b1-431b-c615-a9f6eda7de7d"},"outputs":[],"source":["#@title Make dataset directory\n","%cd ./content"]},{"cell_type":"code","execution_count":null,"metadata":{"executionInfo":{"elapsed":257,"status":"ok","timestamp":1679022032794,"user":{"displayName":"ああ","userId":"12005009733164811990"},"user_tz":-540},"id":"9fM3Qj98DdR3"},"outputs":[],"source":["!mkdir -p \"dataset_raw/44k\""]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":10,"status":"ok","timestamp":1679020982692,"user":{"displayName":"ああ","userId":"12005009733164811990"},"user_tz":-540},"id":"s_YSBfkgbpsg","outputId":"7047b5e0-3c45-4304-ef80-fd51b11c1c05"},"outputs":[],"source":["#!rm -r \"dataset_raw/44k\"\n","#!rm -r \"dataset/44k\""]},{"cell_type":"code","execution_count":null,"metadata":{"executionInfo":{"elapsed":4761,"status":"ok","timestamp":1679022039601,"user":{"displayName":"ああ","userId":"12005009733164811990"},"user_tz":-540},"id":"Nfe6avQYZRDX"},"outputs":[],"source":["#@title Copy your dataset\n","DATASET_NAME = \"kiritan\" #@param {type: \"string\"}\n","!cp -R /content/drive/MyDrive/so-vits-svc-fork/dataset/{DATASET_NAME}/ -t \"dataset_raw/44k/\""]},{"cell_type":"code","execution_count":null,"metadata":{"executionInfo":{"elapsed":305,"status":"ok","timestamp":1679022049038,"user":{"displayName":"ああ","userId":"12005009733164811990"},"user_tz":-540},"id":"BIwjRthoDD7d"},"outputs":[],"source":["#@title Download dataset (Tsukuyomi-chan JVS)\n","#@markdown Make sure you agree to the license when using this dataset.\n","# !wget https://tyc.rei-yumesaki.net/files/sozai-tyc-corpus1.zip\n","# !unzip sozai-tyc-corpus1.zip\n","# !mv \"/content/つくよみちゃんコーパス Vol.1 声優統計コーパス(JVSコーパス準拠)/おまけ:WAV(+12dB増幅&高音域削減)/WAV(+12dB増幅&高音域削減)\" \"dataset_raw/44k/tsukuyomi\""]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":51465,"status":"ok","timestamp":1679022101694,"user":{"displayName":"ああ","userId":"12005009733164811990"},"user_tz":-540},"id":"VdNMJ8M4FYr7","outputId":"880c6760-9881-40e5-fa04-78d2e7434540"},"outputs":[],"source":["#@title Automatic preprocessing\n","!svc pre-resample"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":1989,"status":"ok","timestamp":1679022163420,"user":{"displayName":"ああ","userId":"12005009733164811990"},"user_tz":-540},"id":"teJtVQ9XdQpO","outputId":"83a83997-7001-4dc1-fece-c1f1bb921c7e"},"outputs":[],"source":["!svc pre-config"]},{"cell_type":"code","execution_count":null,"metadata":{"executionInfo":{"elapsed":309,"status":"ok","timestamp":1679022165164,"user":{"displayName":"ああ","userId":"12005009733164811990"},"user_tz":-540},"id":"_jSyc0JE9o9S"},"outputs":[],"source":["#@title Copy configs file\n","!cp configs/44k/config.json drive/MyDrive/so-vits-svc-fork"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":80360,"status":"ok","timestamp":1679022247666,"user":{"displayName":"ああ","userId":"12005009733164811990"},"user_tz":-540},"id":"k7tSGI1Qeeeu","outputId":"93d04add-cff9-4a13-ff9d-444c76a33da8"},"outputs":[],"source":["!svc pre-hubert"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":32852,"status":"ok","timestamp":1679027583345,"user":{"displayName":"ああ","userId":"12005009733164811990"},"user_tz":-540},"id":"zV5KVp76FfHU","outputId":"aec67a90-be9c-4bbb-d612-39fb4c786d9d"},"outputs":[],"source":["#@title Train\n","!svc train --model-path drive/MyDrive/so-vits-svc-fork/logs/44k"]},{"cell_type":"markdown","metadata":{"id":"hNppB3pdxHPI"},"source":["## Inference"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":1044,"status":"ok","timestamp":1679027672910,"user":{"displayName":"ああ","userId":"12005009733164811990"},"user_tz":-540},"id":"NJi_GF4UGWNU","outputId":"debfd307-2a09-488a-9ff2-10b70ce4883c"},"outputs":[],"source":["#@title Get the author's voice as a source\n","import random\n","NAME = str(random.randint(1, 100))\n","!wget -N \"https://github.com/34j/34j/raw/main/jvs-parallel100/{NAME}.wav\"\n","from IPython.display import Audio, display\n","display(Audio(f\"{NAME}.wav\"))"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":16588,"status":"ok","timestamp":1679027945708,"user":{"displayName":"ああ","userId":"12005009733164811990"},"user_tz":-540},"id":"_hacpmo7oKeQ","outputId":"b888e2b1-eb94-43b4-89a9-b38b6bc5f828"},"outputs":[],"source":["#@title Use trained model\n","!svc infer {NAME}.wav -m drive/MyDrive/so-vits-svc-fork/logs/44k/ -c drive/MyDrive/so-vits-svc-fork/logs/44k/config.json\n","display(Audio(f\"{NAME}.out.wav\", autoplay=True))"]},{"attachments":{},"cell_type":"markdown","metadata":{},"source":["### Pretrained models"]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":["#@title https://huggingface.co/TachibanaKimika/so-vits-svc-4.0-models/tree/main\n","!wget -N \"https://huggingface.co/TachibanaKimika/so-vits-svc-4.0-models/resolve/main/riri/G_riri_220.pth\"\n","!wget -N \"https://huggingface.co/TachibanaKimika/so-vits-svc-4.0-models/resolve/main/riri/config.json\""]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":["!svc infer {NAME}.wav -c config.json -m G_riri_220.pth\n","display(Audio(f\"{NAME}.out.wav\", autoplay=True))"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"9CKxQXdyn5zg"},"outputs":[],"source":["#@title https://huggingface.co/therealvul/so-vits-svc-4.0/tree/main\n","!wget -N \"https://huggingface.co/therealvul/so-vits-svc-4.0/resolve/main/Pinkie%20(speaking%20sep)/G_166400.pth\"\n","!wget -N \"https://huggingface.co/therealvul/so-vits-svc-4.0/resolve/main/Pinkie%20(speaking%20sep)/config.json\""]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":1727,"status":"ok","timestamp":1679021000057,"user":{"displayName":"ああ","userId":"12005009733164811990"},"user_tz":-540},"id":"Rajxfht4-pjB","outputId":"51efd477-699b-43c0-ec7f-d9bdc5efb534"},"outputs":[],"source":["\n","!svc infer {NAME}.wav --speaker \"Pinkie {neutral}\" -c config.json -m G_166400.pth\n","display(Audio(f\"{NAME}.out.wav\", autoplay=True))"]}],"metadata":{"accelerator":"GPU","colab":{"provenance":[{"file_id":"https://github.com/34j/so-vits-svc-fork/blob/feat%2Fmain-feat/so-vits-svc-fork-4.0.ipynb","timestamp":1678970434570}]},"gpuClass":"standard","kernelspec":{"display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.10"}},"nbformat":4,"nbformat_minor":0}
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Before training\n",
"\n",
"This program saves the last 3 generations of models to Google Drive. Since 1 generation of models is >1GB, you should have at least 3GB of free space in Google Drive. If you do not have such free space, it is recommended to create another Google Account.\n",
"\n",
"Training requires >10GB VRAM. (T4 should be enough) Inference does not require such a lot of VRAM."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Installation"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#@title Check GPU\n",
"!nvidia-smi"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#@title Install dependencies\n",
"!python -m pip install -U pip wheel\n",
"%pip install -U ipython \n",
"\n",
"#@markdown Branch (for development)\n",
"BRANCH = \"none\" #@param {\"type\": \"string\"}\n",
"if BRANCH == \"none\":\n",
" %pip install -U so-vits-svc-fork\n",
"else:\n",
" %pip install -U git+https://github.com/34j/so-vits-svc-fork.git@{BRANCH}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#@title Mount Google Drive\n",
"from google.colab import drive\n",
"drive.mount('/content/drive')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Training"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#@title Make dataset directory\n",
"%cd ./content"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!mkdir -p \"dataset_raw/44k\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#!rm -r \"dataset_raw/44k\"\n",
"#!rm -r \"dataset/44k\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#@title Copy your dataset\n",
"DATASET_NAME = \"kiritan\" #@param {type: \"string\"}\n",
"!cp -R /content/drive/MyDrive/so-vits-svc-fork/dataset/{DATASET_NAME}/ -t \"dataset_raw/44k/\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#@title Download dataset (Tsukuyomi-chan JVS)\n",
"#@markdown Make sure you agree to the license when using this dataset.\n",
"# !wget https://tyc.rei-yumesaki.net/files/sozai-tyc-corpus1.zip\n",
"# !unzip sozai-tyc-corpus1.zip\n",
"# !mv \"/content/つくよみちゃんコーパス Vol.1 声優統計コーパス(JVSコーパス準拠)/おまけ:WAV(+12dB増幅&高音域削減)/WAV(+12dB増幅&高音域削減)\" \"dataset_raw/44k/tsukuyomi\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#@title Automatic preprocessing\n",
"!svc pre-resample"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!svc pre-config"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#@title Copy configs file\n",
"!cp configs/44k/config.json drive/MyDrive/so-vits-svc-fork"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!svc pre-hubert"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#@title Train\n",
"!svc train --model-path drive/MyDrive/so-vits-svc-fork/logs/44k"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Inference"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#@title Get the author's voice as a source\n",
"import random\n",
"NAME = str(random.randint(1, 100))\n",
"!wget -N \"https://github.com/34j/34j/raw/main/jvs-parallel100/{NAME}.wav\"\n",
"from IPython.display import Audio, display\n",
"display(Audio(f\"{NAME}.wav\"))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#@title Use trained model\n",
"!svc infer {NAME}.wav -m drive/MyDrive/so-vits-svc-fork/logs/44k/ -c drive/MyDrive/so-vits-svc-fork/logs/44k/config.json\n",
"display(Audio(f\"{NAME}.out.wav\", autoplay=True))"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### Pretrained models"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#@title https://huggingface.co/TachibanaKimika/so-vits-svc-4.0-models/tree/main\n",
"!wget -N \"https://huggingface.co/TachibanaKimika/so-vits-svc-4.0-models/resolve/main/riri/G_riri_220.pth\"\n",
"!wget -N \"https://huggingface.co/TachibanaKimika/so-vits-svc-4.0-models/resolve/main/riri/config.json\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!svc infer {NAME}.wav -c config.json -m G_riri_220.pth\n",
"display(Audio(f\"{NAME}.out.wav\", autoplay=True))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#@title https://huggingface.co/therealvul/so-vits-svc-4.0/tree/main\n",
"!wget -N \"https://huggingface.co/therealvul/so-vits-svc-4.0/resolve/main/Pinkie%20(speaking%20sep)/G_166400.pth\"\n",
"!wget -N \"https://huggingface.co/therealvul/so-vits-svc-4.0/resolve/main/Pinkie%20(speaking%20sep)/config.json\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n",
"!svc infer {NAME}.wav --speaker \"Pinkie {neutral}\" -c config.json -m G_166400.pth\n",
"display(Audio(f\"{NAME}.out.wav\", autoplay=True))"
]
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"provenance": [
{
"file_id": "https://github.com/34j/so-vits-svc-fork/blob/feat%2Fmain-feat/so-vits-svc-fork-4.0.ipynb",
"timestamp": 1678970434570
}
]
},
"gpuClass": "standard",
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 0
}

0 comments on commit ac5b9de

Please sign in to comment.