diff --git a/Hina_Mod_Kaggle_Real_Time_Voice_Changer.ipynb b/Hina_Mod_Kaggle_Real_Time_Voice_Changer.ipynb index b688476c..fabfc729 100644 --- a/Hina_Mod_Kaggle_Real_Time_Voice_Changer.ipynb +++ b/Hina_Mod_Kaggle_Real_Time_Voice_Changer.ipynb @@ -1 +1 @@ -{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"},"kaggle":{"accelerator":"gpu","dataSources":[],"dockerImageVersionId":30559,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"nbformat_minor":4,"nbformat":4,"cells":[{"source":"\"Kaggle\"","metadata":{},"cell_type":"markdown"},{"cell_type":"markdown","source":"### [w-okada's Voice Changer](https://github.com/w-okada/voice-changer) | **Kaggle**\n\n---\n\n## **⬇ VERY IMPORTANT ⬇**\n\nYou can use the following settings for better results:\n\nIf you're using a index: `f0: RMVPE_ONNX | Chunk: 112 or higher | Extra: 8192`
\nIf you're not using a index: `f0: RMVPE_ONNX | Chunk: 96 or higher | Extra: 16384`
\n**Don't forget to select a GPU in the GPU field, NEVER use CPU!\n> Seems that PTH models performance better than ONNX for now, you can still try ONNX models and see if it satisfies you\n\n\n*You can always [click here](https://github.com/YunaOneeChan/Voice-Changer-Settings) to check if these settings are up-to-date*\n\n---\n**Credits**
\nRealtime Voice Changer by [w-okada](https://github.com/w-okada)
\nNotebook files updated by [rafacasari](https://github.com/Rafacasari)
\nRecommended settings by [Raven](https://github.com/RavenCutie21)
\nModded again by [Hina](https://github.com/hinabl)\n\n**Need help?** [AI Hub Discord](https://discord.gg/aihub) » ***#help-realtime-vc***\n\n---","metadata":{"id":"Lbbmx_Vjl0zo"}},{"cell_type":"markdown","source":"# Kaggle Tutorial\nRunning this notebook can be a bit complicated.\\\nAfter created your Kaggle account, you'll need to **verify your phone number** to be able to use Internet Connection and GPUs.\\\nFollow the instructions on the image below.\n\n## *You can use GPU P100 instead of GPU T4, some people are telling that P100 is better.*\n![instructions.png](https://i.imgur.com/0NutkD8.png)","metadata":{}},{"cell_type":"markdown","source":"# Clone repository and install dependencies\nThis first step will download the latest version of Voice Changer and install the dependencies. **It will take some time to complete.**","metadata":{}},{"cell_type":"code","source":"# This will make that we're on the right folder before installing\n%cd /kaggle/working/\n\n!pip install colorama --quiet\nfrom colorama import Fore, Style\nimport os\n\n!mkdir Hmod\n%cd Hmod\n!git clone https://github.com/w-okada/voice-changer.git --depth=1 --quiet .\nprint(f\"{Fore.GREEN}> Successfully cloned the repository!{Style.RESET_ALL}\")\n%cd server\n!sed -i \"s/-.-.-.-/Kaggle.Mod/\" '../client/demo/dist/assets/gui_settings/version.txt'\n!mv MMVCServerSIO.py Hmod.py\n!sed -i \"s/MMVCServerSIO/Hmod/\" Hmod.py\n\nprint(f\"{Fore.CYAN}> Installing libportaudio2...{Style.RESET_ALL}\")\n!apt-get -y install libportaudio2 -qq\n\nprint(f\"{Fore.CYAN}> Installing pre-dependencies...{Style.RESET_ALL}\")\n# Install dependencies that are missing from requirements.txt and pyngrok\n!pip install faiss-gpu fairseq pyngrok --quiet \n!pip install pyworld --no-build-isolation\nprint(f\"{Fore.CYAN}> Installing dependencies from requirements.txt...{Style.RESET_ALL}\")\n!pip install -r requirements.txt --quiet\n\n# Download the default settings ^-^\nif not os.path.exists(\"/kaggle/working/Hmod/server/stored_setting.json\"):\n !wget -q https://gist.githubusercontent.com/Rafacasari/d820d945497a01112e1a9ba331cbad4f/raw/8e0a426c22688b05dd9c541648bceab27e422dd6/kaggle_setting.json -O /kaggle/working/24apuiBokE3TjZwc6tuqqv39SwP_2LRouVj3M9oZZCbzgntuG /server/stored_setting.json\nprint(f\"{Fore.GREEN}> Successfully installed all packages!{Style.RESET_ALL}\")\n\nprint(f\"{Fore.GREEN}> You can safely ignore the dependency conflict errors, it's a error from Kaggle and don't interfer on Voice Changer!{Style.RESET_ALL}\")","metadata":{"id":"86wTFmqsNMnD","cellView":"form","_kg_hide-output":false,"execution":{"iopub.status.busy":"2023-11-13T14:29:34.68815Z","iopub.execute_input":"2023-11-13T14:29:34.688434Z","iopub.status.idle":"2023-11-13T14:35:25.010808Z","shell.execute_reply.started":"2023-11-13T14:29:34.688408Z","shell.execute_reply":"2023-11-13T14:35:25.009639Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Start Server **using ngrok**\nThis cell will start the server, the first time that you run it will download the models, so it can take a while (~1-2 minutes)\n\n---\nYou'll need a ngrok account, but **it's free** and easy to create!\n---\n**1** - Create a **free** account at [ngrok](https://dashboard.ngrok.com/signup)\\\n**2** - If you didn't logged in with Google or Github, you will need to **verify your e-mail**!\\\n**3** - Click [this link](https://dashboard.ngrok.com/get-started/your-authtoken) to get your auth token, and replace **YOUR_TOKEN_HERE** with your token.\\\n**4** - *(optional)* Change to a region near to you","metadata":{}},{"cell_type":"code","source":"Token = 'Token_Here'\nRegion = \"ap\" # Read the instructions below\n\n# You can change the region for a better latency, use only the abbreviation\n# Choose between this options: \n# us -> United States (Ohio)\n# ap -> Asia/Pacific (Singapore)\n# au -> Australia (Sydney)\n# eu -> Europe (Frankfurt)\n# in -> India (Mumbai)\n# jp -> Japan (Tokyo)\n# sa -> South America (Sao Paulo)\n\n# ---------------------------------\n# DO NOT TOUCH ANYTHING DOWN BELOW!\n\n%cd /kaggle/working/Hmod/server\n \nfrom pyngrok import conf, ngrok\nMyConfig = conf.PyngrokConfig()\nMyConfig.auth_token = Token\nMyConfig.region = Region\nconf.get_default().authtoken = Token\nconf.get_default().region = Region\nconf.set_default(MyConfig);\n\nimport subprocess, threading, time, socket, urllib.request\nPORT = 8000\n\nfrom pyngrok import ngrok\nngrokConnection = ngrok.connect(PORT)\npublic_url = ngrokConnection.public_url\n\ndef wait_for_server():\n while True:\n time.sleep(0.5)\n sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n result = sock.connect_ex(('127.0.0.1', PORT))\n if result == 0:\n break\n sock.close()\n print(\"--------- SERVER READY! ---------\")\n print(\"Your server is available at:\")\n print(public_url)\n print(\"---------------------------------\")\n\nthreading.Thread(target=wait_for_server, daemon=True).start()\n\n!python3 Hmod.py \\\n -p {PORT} \\\n --https False \\\n --content_vec_500 pretrain/checkpoint_best_legacy_500.pt \\\n --content_vec_500_onnx pretrain/content_vec_500.onnx \\\n --content_vec_500_onnx_on true \\\n --hubert_base pretrain/hubert_base.pt \\\n --hubert_base_jp pretrain/rinna_hubert_base_jp.pt \\\n --hubert_soft pretrain/hubert/hubert-soft-0d54a1f4.pt \\\n --nsf_hifigan pretrain/nsf_hifigan/model \\\n --crepe_onnx_full pretrain/crepe_onnx_full.onnx \\\n --crepe_onnx_tiny pretrain/crepe_onnx_tiny.onnx \\\n --rmvpe pretrain/rmvpe.pt \\\n --model_dir model_dir \\\n --samples samples.json\n\nngrok.disconnect(ngrokConnection.public_url)","metadata":{"id":"lLWQuUd7WW9U","cellView":"form","_kg_hide-input":false,"scrolled":true,"execution":{"iopub.status.busy":"2023-11-13T14:36:20.529333Z","iopub.execute_input":"2023-11-13T14:36:20.530081Z"},"trusted":true},"execution_count":null,"outputs":[]}]} \ No newline at end of file +{"cells":[{"cell_type":"markdown","metadata":{},"source":["\"Kaggle\""]},{"cell_type":"markdown","metadata":{"id":"Lbbmx_Vjl0zo"},"source":["### [w-okada's Voice Changer](https://github.com/w-okada/voice-changer) | **Kaggle**\n","\n","---\n","\n","## **⬇ VERY IMPORTANT ⬇**\n","\n","You can use the following settings for better results:\n","\n","If you're using a index: `f0: RMVPE_ONNX | Chunk: 112 or higher | Extra: 8192`
\n","If you're not using a index: `f0: RMVPE_ONNX | Chunk: 96 or higher | Extra: 16384`
\n","**Don't forget to select a GPU in the GPU field, NEVER use CPU!\n","> Seems that PTH models performance better than ONNX for now, you can still try ONNX models and see if it satisfies you\n","\n","\n","*You can always [click here](https://github.com/YunaOneeChan/Voice-Changer-Settings) to check if these settings are up-to-date*\n","\n","---\n","**Credits**
\n","Realtime Voice Changer by [w-okada](https://github.com/w-okada)
\n","Notebook files updated by [rafacasari](https://github.com/Rafacasari)
\n","Recommended settings by [Raven](https://github.com/RavenCutie21)
\n","Modded again by [Hina](https://github.com/hinabl)\n","\n","**Need help?** [AI Hub Discord](https://discord.gg/aihub) » ***#help-realtime-vc***\n","\n","---"]},{"cell_type":"markdown","metadata":{},"source":["# Kaggle Tutorial\n","Running this notebook can be a bit complicated.\\\n","After created your Kaggle account, you'll need to **verify your phone number** to be able to use Internet Connection and GPUs.\\\n","Follow the instructions on the image below.\n","\n","## *You can use GPU P100 instead of GPU T4, some people are telling that P100 is better.*\n","![instructions.png](https://i.imgur.com/0NutkD8.png)"]},{"cell_type":"markdown","metadata":{},"source":["# Clone repository and install dependencies\n","This first step will download the latest version of Voice Changer and install the dependencies. **It will take some time to complete.**"]},{"cell_type":"code","execution_count":null,"metadata":{"_kg_hide-output":false,"cellView":"form","execution":{"iopub.execute_input":"2023-11-13T14:29:34.688434Z","iopub.status.busy":"2023-11-13T14:29:34.68815Z","iopub.status.idle":"2023-11-13T14:35:25.010808Z","shell.execute_reply":"2023-11-13T14:35:25.009639Z","shell.execute_reply.started":"2023-11-13T14:29:34.688408Z"},"id":"86wTFmqsNMnD","trusted":true},"outputs":[],"source":["# This will make that we're on the right folder before installing\n","%cd /kaggle/working/\n","\n","!pip install colorama --quiet\n","from colorama import Fore, Style\n","import os\n","\n","!mkdir Hmod\n","%cd Hmod\n","!git clone https://github.com/w-okada/voice-changer.git --depth=1 --quiet .\n","print(f\"{Fore.GREEN}> Successfully cloned the repository!{Style.RESET_ALL}\")\n","%cd server\n","!sed -i \"s/-.-.-.-/Kaggle.Mod/\" '../client/demo/dist/assets/gui_settings/version.txt'\n","!mv MMVCServerSIO.py Hmod.py\n","!sed -i \"s/MMVCServerSIO/Hmod/\" Hmod.py\n","\n","print(f\"{Fore.CYAN}> Installing libportaudio2...{Style.RESET_ALL}\")\n","!apt-get -y install libportaudio2 -qq\n","\n","print(f\"{Fore.CYAN}> Installing pre-dependencies...{Style.RESET_ALL}\")\n","# Install dependencies that are missing from requirements.txt and pyngrok\n","!pip install faiss-gpu fairseq pyngrok --quiet\n","!pip install pyworld --no-build-isolation\n","print(f\"{Fore.CYAN}> Installing dependencies from requirements.txt...{Style.RESET_ALL}\")\n","!pip install -r requirements.txt --quiet\n","\n","# Download the default settings ^-^\n","if not os.path.exists(\"/kaggle/working/Hmod/server/stored_setting.json\"):\n"," !wget -q https://gist.githubusercontent.com/Rafacasari/d820d945497a01112e1a9ba331cbad4f/raw/8e0a426c22688b05dd9c541648bceab27e422dd6/kaggle_setting.json -O /kaggle/working/24apuiBokE3TjZwc6tuqqv39SwP_2LRouVj3M9oZZCbzgntuG /server/stored_setting.json\n","print(f\"{Fore.GREEN}> Successfully installed all packages!{Style.RESET_ALL}\")\n","\n","print(f\"{Fore.GREEN}> You can safely ignore the dependency conflict errors, it's a error from Kaggle and don't interfer on Voice Changer!{Style.RESET_ALL}\")"]},{"cell_type":"markdown","metadata":{},"source":["# Start Server **using ngrok**\n","This cell will start the server, the first time that you run it will download the models, so it can take a while (~1-2 minutes)\n","\n","---\n","You'll need a ngrok account, but **it's free** and easy to create!\n","---\n","**1** - Create a **free** account at [ngrok](https://dashboard.ngrok.com/signup)\\\n","**2** - If you didn't logged in with Google or Github, you will need to **verify your e-mail**!\\\n","**3** - Click [this link](https://dashboard.ngrok.com/get-started/your-authtoken) to get your auth token, and replace **YOUR_TOKEN_HERE** with your token.\\\n","**4** - *(optional)* Change to a region near to you"]},{"cell_type":"code","execution_count":null,"metadata":{"_kg_hide-input":false,"cellView":"form","execution":{"iopub.execute_input":"2023-11-13T14:36:20.530081Z","iopub.status.busy":"2023-11-13T14:36:20.529333Z"},"id":"lLWQuUd7WW9U","scrolled":true,"trusted":true},"outputs":[],"source":["Token = 'Token_Here'\n","Region = \"ap\" # Read the instructions below\n","\n","# You can change the region for a better latency, use only the abbreviation\n","# Choose between this options:\n","# us -> United States (Ohio)\n","# ap -> Asia/Pacific (Singapore)\n","# au -> Australia (Sydney)\n","# eu -> Europe (Frankfurt)\n","# in -> India (Mumbai)\n","# jp -> Japan (Tokyo)\n","# sa -> South America (Sao Paulo)\n","\n","# ---------------------------------\n","# DO NOT TOUCH ANYTHING DOWN BELOW!\n","\n","%cd /kaggle/working/Hmod/server\n","\n","from pyngrok import conf, ngrok\n","MyConfig = conf.PyngrokConfig()\n","MyConfig.auth_token = Token\n","MyConfig.region = Region\n","conf.get_default().authtoken = Token\n","conf.get_default().region = Region\n","conf.set_default(MyConfig);\n","\n","import subprocess, threading, time, socket, urllib.request\n","PORT = 8000\n","\n","from pyngrok import ngrok\n","ngrokConnection = ngrok.connect(PORT)\n","public_url = ngrokConnection.public_url\n","\n","def wait_for_server():\n"," while True:\n"," time.sleep(0.5)\n"," sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n"," result = sock.connect_ex(('127.0.0.1', PORT))\n"," if result == 0:\n"," break\n"," sock.close()\n"," print(\"--------- SERVER READY! ---------\")\n"," print(\"Your server is available at:\")\n"," print(public_url)\n"," print(\"---------------------------------\")\n","\n","threading.Thread(target=wait_for_server, daemon=True).start()\n","\n","!python3 Hmod.py \\\n"," -p {PORT} \\\n"," --https False \\\n"," --content_vec_500 pretrain/checkpoint_best_legacy_500.pt \\\n"," --content_vec_500_onnx pretrain/content_vec_500.onnx \\\n"," --content_vec_500_onnx_on true \\\n"," --hubert_base pretrain/hubert_base.pt \\\n"," --hubert_base_jp pretrain/rinna_hubert_base_jp.pt \\\n"," --hubert_soft pretrain/hubert/hubert-soft-0d54a1f4.pt \\\n"," --nsf_hifigan pretrain/nsf_hifigan/model \\\n"," --crepe_onnx_full pretrain/crepe_onnx_full.onnx \\\n"," --crepe_onnx_tiny pretrain/crepe_onnx_tiny.onnx \\\n"," --rmvpe pretrain/rmvpe.pt \\\n"," --model_dir model_dir \\\n"," --samples samples.json \\\n"," --allowed-origins \"*\"\n","\n","ngrok.disconnect(ngrokConnection.public_url)"]}],"metadata":{"kaggle":{"accelerator":"gpu","dataSources":[],"dockerImageVersionId":30559,"isGpuEnabled":true,"isInternetEnabled":true,"language":"python","sourceType":"notebook"},"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.6.4"}},"nbformat":4,"nbformat_minor":4} diff --git a/Hina_Modified_Realtime_Voice_Changer_on_Colab.ipynb b/Hina_Modified_Realtime_Voice_Changer_on_Colab.ipynb index b9d0a82a..c4c23293 100644 --- a/Hina_Modified_Realtime_Voice_Changer_on_Colab.ipynb +++ b/Hina_Modified_Realtime_Voice_Changer_on_Colab.ipynb @@ -3,8 +3,8 @@ { "cell_type": "markdown", "metadata": { - "id": "view-in-github", - "colab_type": "text" + "colab_type": "text", + "id": "view-in-github" }, "source": [ "\"Open" @@ -59,8 +59,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "86wTFmqsNMnD", - "cellView": "form" + "cellView": "form", + "id": "86wTFmqsNMnD" }, "outputs": [], "source": [ @@ -164,6 +164,12 @@ }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "cellView": "form", + "id": "_ZtbKUVUgN3G" + }, + "outputs": [], "source": [ "#@title **[Optional]** Upload a voice model (Run this before running the Voice Changer)\n", "import os\n", @@ -214,20 +220,14 @@ "\n", "clear_output()\n", "print(\"\\033[93mModel with the name of \"+model_name+\" has been Imported to slot \"+model_slot)" - ], - "metadata": { - "id": "_ZtbKUVUgN3G", - "cellView": "form" - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "code", "execution_count": null, "metadata": { - "id": "lLWQuUd7WW9U", - "cellView": "form" + "cellView": "form", + "id": "lLWQuUd7WW9U" }, "outputs": [], "source": [ @@ -314,28 +314,30 @@ " --crepe_onnx_tiny pretrain/crepe_onnx_tiny.onnx \\\n", " --rmvpe pretrain/rmvpe.pt \\\n", " --model_dir model_dir \\\n", - " --samples samples.json\n", + " --samples samples.json \\\n", + " --allowed-origins \"*\"\n", "\n", "ngrok.disconnect(ngrokConnection.public_url)" ] }, { "cell_type": "markdown", + "metadata": { + "id": "2Uu1sTSwTc7q" + }, "source": [ "![](https://i.pinimg.com/474x/de/72/9e/de729ecfa41b69901c42c82fff752414.jpg)\n", "![](https://i.pinimg.com/474x/de/72/9e/de729ecfa41b69901c42c82fff752414.jpg)" - ], - "metadata": { - "id": "2Uu1sTSwTc7q" - } + ] } ], "metadata": { + "accelerator": "GPU", "colab": { - "provenance": [], - "private_outputs": true, "gpuType": "T4", - "include_colab_link": true + "include_colab_link": true, + "private_outputs": true, + "provenance": [] }, "kernelspec": { "display_name": "Python 3", @@ -343,9 +345,8 @@ }, "language_info": { "name": "python" - }, - "accelerator": "GPU" + } }, "nbformat": 4, "nbformat_minor": 0 -} \ No newline at end of file +} diff --git a/Kaggle_RealtimeVoiceChanger.ipynb b/Kaggle_RealtimeVoiceChanger.ipynb index e8abed4c..a3b270f7 100644 --- a/Kaggle_RealtimeVoiceChanger.ipynb +++ b/Kaggle_RealtimeVoiceChanger.ipynb @@ -1,99 +1,243 @@ { - "metadata":{ - "kernelspec":{ - "language":"python", - "display_name":"Python 3", - "name":"python3" - }, - "language_info":{ - "name":"python", - "version":"3.10.12", - "mimetype":"text/x-python", - "codemirror_mode":{ - "name":"ipython", - "version":3 + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "view-in-github" }, - "pygments_lexer":"ipython3", - "nbconvert_exporter":"python", - "file_extension":".py" + "source": [ + "\"Open" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Lbbmx_Vjl0zo" + }, + "source": [ + "### [w-okada's Voice Changer](https://github.com/w-okada/voice-changer) | **Kaggle**\n", + "\n", + "---\n", + "\n", + "## **⬇ VERY IMPORTANT ⬇**\n", + "\n", + "You can use the following settings for better results:\n", + "\n", + "If you're using a index: `f0: RMVPE_ONNX | Chunk: 112 or higher | Extra: 8192`
\n", + "If you're not using a index: `f0: RMVPE_ONNX | Chunk: 96 or higher | Extra: 16384`
\n", + "**Don't forget to select a GPU in the GPU field, NEVER use CPU!\n", + "> Seems that PTH models performance better than ONNX for now, you can still try ONNX models and see if it satisfies you\n", + "\n", + "\n", + "*You can always [click here](https://github.com/YunaOneeChan/Voice-Changer-Settings) to check if these settings are up-to-date*\n", + "\n", + "---\n", + "**Credits**
\n", + "Realtime Voice Changer by [w-okada](https://github.com/w-okada)
\n", + "Notebook files updated by [rafacasari](https://github.com/Rafacasari)
\n", + "Recommended settings by [YunaOneeChan](https://github.com/YunaOneeChan)\n", + "\n", + "**Need help?** [AI Hub Discord](https://discord.gg/aihub) » ***#help-realtime-vc***\n", + "\n", + "---" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Kaggle Tutorial\n", + "Running this notebook can be a bit complicated.\\\n", + "After created your Kaggle account, you'll need to **verify your phone number** to be able to use Internet Connection and GPUs.\\\n", + "Follow the instructions on the image below.\n", + "\n", + "## *You can use GPU P100 instead of GPU T4, some people are telling that P100 is better.*\n", + "![instructions.png](https://i.imgur.com/0NutkD8.png)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Clone repository and install dependencies\n", + "This first step will download the latest version of Voice Changer and install the dependencies. **It will take some time to complete.**" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "_kg_hide-output": false, + "cellView": "form", + "execution": { + "iopub.execute_input": "2023-09-14T04:01:17.308682Z", + "iopub.status.busy": "2023-09-14T04:01:17.308284Z", + "iopub.status.idle": "2023-09-14T04:08:08.475375Z", + "shell.execute_reply": "2023-09-14T04:08:08.473827Z", + "shell.execute_reply.started": "2023-09-14T04:01:17.308652Z" + }, + "id": "86wTFmqsNMnD", + "trusted": true + }, + "outputs": [], + "source": [ + "# This will make that we're on the right folder before installing\n", + "%cd /kaggle/working/\n", + "\n", + "!pip install colorama --quiet\n", + "from colorama import Fore, Style\n", + "import os\n", + "\n", + "print(f\"{Fore.CYAN}> Cloning the repository...{Style.RESET_ALL}\")\n", + "!git clone https://github.com/w-okada/voice-changer.git --quiet\n", + "print(f\"{Fore.GREEN}> Successfully cloned the repository!{Style.RESET_ALL}\")\n", + "%cd voice-changer/server/\n", + "\n", + "print(f\"{Fore.CYAN}> Installing libportaudio2...{Style.RESET_ALL}\")\n", + "!apt-get -y install libportaudio2 -qq\n", + "\n", + "print(f\"{Fore.CYAN}> Installing pre-dependencies...{Style.RESET_ALL}\")\n", + "# Install dependencies that are missing from requirements.txt and pyngrok\n", + "!pip install faiss-gpu fairseq pyngrok --quiet\n", + "!pip install pyworld --no-build-isolation --quiet\n", + "print(f\"{Fore.CYAN}> Installing dependencies from requirements.txt...{Style.RESET_ALL}\")\n", + "!pip install -r requirements.txt --quiet\n", + "\n", + "# Download the default settings ^-^\n", + "if not os.path.exists(\"/kaggle/working/voice-changer/server/stored_setting.json\"):\n", + " !wget -q https://gist.githubusercontent.com/Rafacasari/d820d945497a01112e1a9ba331cbad4f/raw/8e0a426c22688b05dd9c541648bceab27e422dd6/kaggle_setting.json -O /kaggle/working/voice-changer/server/stored_setting.json\n", + "print(f\"{Fore.GREEN}> Successfully installed all packages!{Style.RESET_ALL}\")\n", + "\n", + "print(f\"{Fore.GREEN}> You can safely ignore the dependency conflict errors, it's a error from Kaggle and don't interfer on Voice Changer!{Style.RESET_ALL}\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Start Server **using ngrok**\n", + "This cell will start the server, the first time that you run it will download the models, so it can take a while (~1-2 minutes)\n", + "\n", + "---\n", + "You'll need a ngrok account, but **it's free** and easy to create!\n", + "---\n", + "**1** - Create a **free** account at [ngrok](https://dashboard.ngrok.com/signup)\\\n", + "**2** - If you didn't logged in with Google or Github, you will need to **verify your e-mail**!\\\n", + "**3** - Click [this link](https://dashboard.ngrok.com/get-started/your-authtoken) to get your auth token, and replace **YOUR_TOKEN_HERE** with your token.\\\n", + "**4** - *(optional)* Change to a region near to you" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "_kg_hide-input": false, + "cellView": "form", + "id": "lLWQuUd7WW9U", + "scrolled": true, + "trusted": true + }, + "outputs": [], + "source": [ + "# ---------------------------------\n", + "# SETTINGS\n", + "# ---------------------------------\n", + "\n", + "Token = '2Tn2hbfLtw2ii6DHEJy7SsM1BjI_21G14MXSwz7qZSDL2Dv3B'\n", + "ClearConsole = True # Clear console after initialization. Set to False if you are having some error, then you will be able to report it.\n", + "Region = \"sa\" # Read the instructions below\n", + "\n", + "# You can change the region for a better latency, use only the abbreviation\n", + "# Choose between this options:\n", + "# us -> United States (Ohio)\n", + "# ap -> Asia/Pacific (Singapore)\n", + "# au -> Australia (Sydney)\n", + "# eu -> Europe (Frankfurt)\n", + "# in -> India (Mumbai)\n", + "# jp -> Japan (Tokyo)\n", + "# sa -> South America (Sao Paulo)\n", + "\n", + "# ---------------------------------\n", + "# DO NOT TOUCH ANYTHING DOWN BELOW!\n", + "# ---------------------------------\n", + "\n", + "%cd /kaggle/working/voice-changer/server\n", + "\n", + "from pyngrok import conf, ngrok\n", + "MyConfig = conf.PyngrokConfig()\n", + "MyConfig.auth_token = Token\n", + "MyConfig.region = Region\n", + "#conf.get_default().authtoken = Token\n", + "#conf.get_default().region = Region\n", + "conf.set_default(MyConfig);\n", + "\n", + "import subprocess, threading, time, socket, urllib.request\n", + "PORT = 8000\n", + "\n", + "from pyngrok import ngrok\n", + "ngrokConnection = ngrok.connect(PORT)\n", + "public_url = ngrokConnection.public_url\n", + "\n", + "from IPython.display import clear_output\n", + "\n", + "def wait_for_server():\n", + " while True:\n", + " time.sleep(0.5)\n", + " sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n", + " result = sock.connect_ex(('127.0.0.1', PORT))\n", + " if result == 0:\n", + " break\n", + " sock.close()\n", + " if ClearConsole:\n", + " clear_output()\n", + " print(\"--------- SERVER READY! ---------\")\n", + " print(\"Your server is available at:\")\n", + " print(public_url)\n", + " print(\"---------------------------------\")\n", + "\n", + "threading.Thread(target=wait_for_server, daemon=True).start()\n", + "\n", + "!python3 MMVCServerSIO.py \\\n", + " -p {PORT} \\\n", + " --https False \\\n", + " --content_vec_500 pretrain/checkpoint_best_legacy_500.pt \\\n", + " --content_vec_500_onnx pretrain/content_vec_500.onnx \\\n", + " --content_vec_500_onnx_on true \\\n", + " --hubert_base pretrain/hubert_base.pt \\\n", + " --hubert_base_jp pretrain/rinna_hubert_base_jp.pt \\\n", + " --hubert_soft pretrain/hubert/hubert-soft-0d54a1f4.pt \\\n", + " --nsf_hifigan pretrain/nsf_hifigan/model \\\n", + " --crepe_onnx_full pretrain/crepe_onnx_full.onnx \\\n", + " --crepe_onnx_tiny pretrain/crepe_onnx_tiny.onnx \\\n", + " --rmvpe pretrain/rmvpe.pt \\\n", + " --model_dir model_dir \\\n", + " --samples samples.json \\\n", + " --allowed-origins \"*\"\n", + "\n", + "ngrok.disconnect(ngrokConnection.public_url)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.12" } }, - "nbformat_minor":4, - "nbformat":4, - "cells":[ - { - "cell_type": "markdown", - "metadata": { - "id": "view-in-github", - "colab_type": "text" - }, - "source": [ - "\"Open" - ] - }, - { - "cell_type":"markdown", - "source":"### [w-okada's Voice Changer](https://github.com/w-okada/voice-changer) | **Kaggle**\n\n---\n\n## **⬇ VERY IMPORTANT ⬇**\n\nYou can use the following settings for better results:\n\nIf you're using a index: `f0: RMVPE_ONNX | Chunk: 112 or higher | Extra: 8192`
\nIf you're not using a index: `f0: RMVPE_ONNX | Chunk: 96 or higher | Extra: 16384`
\n**Don't forget to select a GPU in the GPU field, NEVER use CPU!\n> Seems that PTH models performance better than ONNX for now, you can still try ONNX models and see if it satisfies you\n\n\n*You can always [click here](https://github.com/YunaOneeChan/Voice-Changer-Settings) to check if these settings are up-to-date*\n\n---\n**Credits**
\nRealtime Voice Changer by [w-okada](https://github.com/w-okada)
\nNotebook files updated by [rafacasari](https://github.com/Rafacasari)
\nRecommended settings by [YunaOneeChan](https://github.com/YunaOneeChan)\n\n**Need help?** [AI Hub Discord](https://discord.gg/aihub) » ***#help-realtime-vc***\n\n---", - "metadata":{ - "id":"Lbbmx_Vjl0zo" - } - }, - { - "cell_type":"markdown", - "source":"# Kaggle Tutorial\nRunning this notebook can be a bit complicated.\\\nAfter created your Kaggle account, you'll need to **verify your phone number** to be able to use Internet Connection and GPUs.\\\nFollow the instructions on the image below.\n\n## *You can use GPU P100 instead of GPU T4, some people are telling that P100 is better.*\n![instructions.png](https://i.imgur.com/0NutkD8.png)", - "metadata":{ - - } - }, - { - "cell_type":"markdown", - "source":"# Clone repository and install dependencies\nThis first step will download the latest version of Voice Changer and install the dependencies. **It will take some time to complete.**", - "metadata":{ - - } - }, - { - "cell_type":"code", - "source":"# This will make that we're on the right folder before installing\n%cd /kaggle/working/\n\n!pip install colorama --quiet\nfrom colorama import Fore, Style\nimport os\n\nprint(f\"{Fore.CYAN}> Cloning the repository...{Style.RESET_ALL}\")\n!git clone https://github.com/w-okada/voice-changer.git --quiet\nprint(f\"{Fore.GREEN}> Successfully cloned the repository!{Style.RESET_ALL}\")\n%cd voice-changer/server/\n\nprint(f\"{Fore.CYAN}> Installing libportaudio2...{Style.RESET_ALL}\")\n!apt-get -y install libportaudio2 -qq\n\nprint(f\"{Fore.CYAN}> Installing pre-dependencies...{Style.RESET_ALL}\")\n# Install dependencies that are missing from requirements.txt and pyngrok\n!pip install faiss-gpu fairseq pyngrok --quiet \n!pip install pyworld --no-build-isolation --quiet\nprint(f\"{Fore.CYAN}> Installing dependencies from requirements.txt...{Style.RESET_ALL}\")\n!pip install -r requirements.txt --quiet\n\n# Download the default settings ^-^\nif not os.path.exists(\"/kaggle/working/voice-changer/server/stored_setting.json\"):\n !wget -q https://gist.githubusercontent.com/Rafacasari/d820d945497a01112e1a9ba331cbad4f/raw/8e0a426c22688b05dd9c541648bceab27e422dd6/kaggle_setting.json -O /kaggle/working/voice-changer/server/stored_setting.json\nprint(f\"{Fore.GREEN}> Successfully installed all packages!{Style.RESET_ALL}\")\n\nprint(f\"{Fore.GREEN}> You can safely ignore the dependency conflict errors, it's a error from Kaggle and don't interfer on Voice Changer!{Style.RESET_ALL}\")", - "metadata":{ - "id":"86wTFmqsNMnD", - "cellView":"form", - "_kg_hide-output":false, - "execution":{ - "iopub.status.busy":"2023-09-14T04:01:17.308284Z", - "iopub.execute_input":"2023-09-14T04:01:17.308682Z", - "iopub.status.idle":"2023-09-14T04:08:08.475375Z", - "shell.execute_reply.started":"2023-09-14T04:01:17.308652Z", - "shell.execute_reply":"2023-09-14T04:08:08.473827Z" - }, - "trusted":true - }, - "execution_count":0, - "outputs":[ - - ] - }, - { - "cell_type":"markdown", - "source":"# Start Server **using ngrok**\nThis cell will start the server, the first time that you run it will download the models, so it can take a while (~1-2 minutes)\n\n---\nYou'll need a ngrok account, but **it's free** and easy to create!\n---\n**1** - Create a **free** account at [ngrok](https://dashboard.ngrok.com/signup)\\\n**2** - If you didn't logged in with Google or Github, you will need to **verify your e-mail**!\\\n**3** - Click [this link](https://dashboard.ngrok.com/get-started/your-authtoken) to get your auth token, and replace **YOUR_TOKEN_HERE** with your token.\\\n**4** - *(optional)* Change to a region near to you", - "metadata":{ - - } - }, - { - "cell_type":"code", - "source":"# ---------------------------------\n# SETTINGS\n# ---------------------------------\n\nToken = '2Tn2hbfLtw2ii6DHEJy7SsM1BjI_21G14MXSwz7qZSDL2Dv3B'\nClearConsole = True # Clear console after initialization. Set to False if you are having some error, then you will be able to report it.\nRegion = \"sa\" # Read the instructions below\n\n# You can change the region for a better latency, use only the abbreviation\n# Choose between this options: \n# us -> United States (Ohio)\n# ap -> Asia/Pacific (Singapore)\n# au -> Australia (Sydney)\n# eu -> Europe (Frankfurt)\n# in -> India (Mumbai)\n# jp -> Japan (Tokyo)\n# sa -> South America (Sao Paulo)\n\n# ---------------------------------\n# DO NOT TOUCH ANYTHING DOWN BELOW!\n# ---------------------------------\n\n%cd /kaggle/working/voice-changer/server\n \nfrom pyngrok import conf, ngrok\nMyConfig = conf.PyngrokConfig()\nMyConfig.auth_token = Token\nMyConfig.region = Region\n#conf.get_default().authtoken = Token\n#conf.get_default().region = Region\nconf.set_default(MyConfig);\n\nimport subprocess, threading, time, socket, urllib.request\nPORT = 8000\n\nfrom pyngrok import ngrok\nngrokConnection = ngrok.connect(PORT)\npublic_url = ngrokConnection.public_url\n\nfrom IPython.display import clear_output\n\ndef wait_for_server():\n while True:\n time.sleep(0.5)\n sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n result = sock.connect_ex(('127.0.0.1', PORT))\n if result == 0:\n break\n sock.close()\n if ClearConsole:\n clear_output()\n print(\"--------- SERVER READY! ---------\")\n print(\"Your server is available at:\")\n print(public_url)\n print(\"---------------------------------\")\n\nthreading.Thread(target=wait_for_server, daemon=True).start()\n\n!python3 MMVCServerSIO.py \\\n -p {PORT} \\\n --https False \\\n --content_vec_500 pretrain/checkpoint_best_legacy_500.pt \\\n --content_vec_500_onnx pretrain/content_vec_500.onnx \\\n --content_vec_500_onnx_on true \\\n --hubert_base pretrain/hubert_base.pt \\\n --hubert_base_jp pretrain/rinna_hubert_base_jp.pt \\\n --hubert_soft pretrain/hubert/hubert-soft-0d54a1f4.pt \\\n --nsf_hifigan pretrain/nsf_hifigan/model \\\n --crepe_onnx_full pretrain/crepe_onnx_full.onnx \\\n --crepe_onnx_tiny pretrain/crepe_onnx_tiny.onnx \\\n --rmvpe pretrain/rmvpe.pt \\\n --model_dir model_dir \\\n --samples samples.json\n\nngrok.disconnect(ngrokConnection.public_url)", - "metadata":{ - "id":"lLWQuUd7WW9U", - "cellView":"form", - "_kg_hide-input":false, - "scrolled":true, - "trusted":true - }, - "execution_count":null, - "outputs":[ - - ] - } - ] + "nbformat": 4, + "nbformat_minor": 4 } diff --git a/Realtime_Voice_Changer_on_Colab.ipynb b/Realtime_Voice_Changer_on_Colab.ipynb index 144b9e98..61eb6b90 100644 --- a/Realtime_Voice_Changer_on_Colab.ipynb +++ b/Realtime_Voice_Changer_on_Colab.ipynb @@ -1,10 +1,10 @@ { "cells": [ - { + { "cell_type": "markdown", "metadata": { - "id": "view-in-github", - "colab_type": "text" + "colab_type": "text", + "id": "view-in-github" }, "source": [ "\"Open" @@ -12,6 +12,9 @@ }, { "cell_type": "markdown", + "metadata": { + "id": "Lbbmx_Vjl0zo" + }, "source": [ "### [w-okada's Voice Changer](https://github.com/w-okada/voice-changer) | **Colab**\n", "\n", @@ -44,13 +47,25 @@ "**Need help?** [AI Hub Discord](https://discord.gg/aihub) » ***#help-realtime-vc***\n", "\n", "---" - ], - "metadata": { - "id": "Lbbmx_Vjl0zo" - } + ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "_kg_hide-output": false, + "cellView": "form", + "execution": { + "iopub.execute_input": "2023-09-14T04:01:17.308682Z", + "iopub.status.busy": "2023-09-14T04:01:17.308284Z", + "iopub.status.idle": "2023-09-14T04:08:08.475375Z", + "shell.execute_reply": "2023-09-14T04:08:08.473827Z", + "shell.execute_reply.started": "2023-09-14T04:01:17.308652Z" + }, + "id": "86wTFmqsNMnD", + "trusted": true + }, + "outputs": [], "source": [ "# @title Clone repository and install dependencies\n", "# @markdown This first step will download the latest version of Voice Changer and install the dependencies. **It can take some time to complete.**\n", @@ -76,25 +91,19 @@ "!pip install -r requirements.txt --quiet\n", "\n", "print(f\"{Fore.GREEN}> Successfully installed all packages!{Style.RESET_ALL}\")" - ], - "metadata": { - "id": "86wTFmqsNMnD", - "cellView": "form", - "_kg_hide-output": false, - "execution": { - "iopub.status.busy": "2023-09-14T04:01:17.308284Z", - "iopub.execute_input": "2023-09-14T04:01:17.308682Z", - "iopub.status.idle": "2023-09-14T04:08:08.475375Z", - "shell.execute_reply.started": "2023-09-14T04:01:17.308652Z", - "shell.execute_reply": "2023-09-14T04:08:08.473827Z" - }, - "trusted": true - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "_kg_hide-input": false, + "cellView": "form", + "id": "lLWQuUd7WW9U", + "scrolled": true, + "trusted": true + }, + "outputs": [], "source": [ "# @title Start Server **using ngrok**\n", "# @markdown This cell will start the server, the first time that you run it will download the models, so it can take a while (~1-2 minutes)\n", @@ -167,30 +176,23 @@ " --crepe_onnx_tiny pretrain/crepe_onnx_tiny.onnx \\\n", " --rmvpe pretrain/rmvpe.pt \\\n", " --model_dir model_dir \\\n", - " --samples samples.json\n", + " --samples samples.json \\\n", + " --allowed-origins \"*\"\n", "\n", "ngrok.disconnect(ngrokConnection.public_url)" - ], - "metadata": { - "id": "lLWQuUd7WW9U", - "cellView": "form", - "_kg_hide-input": false, - "scrolled": true, - "trusted": true - }, - "execution_count": null, - "outputs": [] + ] } ], "metadata": { + "accelerator": "GPU", "colab": { - "provenance": [], - "private_outputs": true, - "include_colab_link": true, - "gpuType": "T4", "collapsed_sections": [ "iuf9pBHYpTn-" - ] + ], + "gpuType": "T4", + "include_colab_link": true, + "private_outputs": true, + "provenance": [] }, "kernelspec": { "display_name": "Python 3", @@ -198,8 +200,7 @@ }, "language_info": { "name": "python" - }, - "accelerator": "GPU" + } }, "nbformat": 4, "nbformat_minor": 0