{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "view-in-github", "colab_type": "text" }, "source": [ "\"Open" ] }, { "cell_type": "markdown", "source": [ "# RVC MAKER 🎡" ], "metadata": { "id": "vOlZ8mQ0XMpC" } }, { "cell_type": "markdown", "source": [ "**This project was created by [TheNeoDev](https://github.com/TheNeodev)** base on [PhamHuynhAnh16/Vietnamese-RVC](https://github.com/PhamHuynhAnh16/Vietnamese-RVC)\n", "\n", "---" ], "metadata": { "id": "nwKyFp0aaJsS" } }, { "cell_type": "markdown", "metadata": { "id": "LVAACnvlmE4I" }, "source": [ "\n", "\n", "**Please do not use the project for any purposes that violate ethics, laws, or cause harm to individuals, organizations...**\n", "\n", "---\n", " **In case the user does not comply with the terms or violates them, I will not be responsible for any claims, damages, or legal liabilities, whether in contract, due to negligence, or other reasons, arising from, out of, or related to the software, the use of the software, or other transactions related to the software.**" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "cellView": "form", "id": "BJeRif5jjL5s" }, "outputs": [], "source": [ "#@title **🌟Settings**\n", "\n", "import os\n", "from ipywidgets import Button\n", "from IPython.display import clear_output\n", "print(\"πŸ‘©πŸ»β€πŸ’» INSTALLING...\")\n", "\n", "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'\n", "\n", "!git clone https://github.com/unchCrew/RVC-MAKER.git /content/RVC-MAKER > /dev/null 2>&1\n", "!pip install -r /content/RVC-MAKER/requirements.txt --no-cache-dir -q > /dev/null 2>&1\n", "!pip install pyngrok --no-cache-dir -q > /dev/null 2>&1\n", "\n", "#@markdown **πŸ’» Installation will take about 2 minutes to complete!**\n", "clear_output()\n", "Button(description=\"\\u2714 done!\", button_style=\"success\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "cIsBEvHaQWMJ", "cellView": "form" }, "outputs": [], "source": [ "#@title **Run webui**\n", "import os\n", "import shutil\n", "\n", "%cd /content/RVC-MAKER\n", "#@markdown **To experience all the features, use the interface :)**\n", "\n", "#@markdown **If you know you can use the tensorboard to check for overtraining πŸ‘**\n", "tensorboard = False #@param {type:\"boolean\"}\n", "\n", "\n", "\n", "\n", "\n", "# @markdown ### Choose a sharing method:\n", "\n", "import codecs\n", "import threading\n", "import urllib.request\n", "import time\n", "import ipywidgets as widgets\n", "from IPython.display import display\n", "import os\n", "from pyngrok import ngrok\n", "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'\n", "\n", "method = \"gradio\" # @param [\"gradio\", \"localtunnel\", \"ngrok\"]\n", "\n", "\n", "#@markdown If you selected the 'ngrok' method, obtain your auth token here: https://dashboard.ngrok.com/get-started/your-authtoken\n", "ngrok_token = \"\" # @param {type:\"string\"}\n", "\n", "def start_gradio():\n", " !python main/app/app.py --share\n", "\n", "def start_localtunnel():\n", " !npm install -g localtunnel &>/dev/null\n", " with open('url.txt', 'w') as file:\n", " file.write('')\n", " get_ipython().system_raw('lt --port 7860 >> url.txt 2>&1 &')\n", " time.sleep(2)\n", " endpoint_ip = urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\")\n", "\n", " with open('url.txt', 'r') as file:\n", " tunnel_url = file.read()\n", " tunnel_url = tunnel_url.replace(\"your url is: \", \"\")\n", "\n", " print(f\"Share Link: \\033[0m\\033[93m{tunnel_url}\\033[0m\", end=\"\\033[0m\\n\")\n", "\n", " password_endpoint_widget = widgets.Text(\n", " value=endpoint_ip,\n", " description='Password IP:',\n", " disabled=True\n", " )\n", " display(password_endpoint_widget)\n", " !python main/app/app.py\n", "\n", "\n", "def start_ngrok():\n", " try:\n", " ngrok.set_auth_token(ngrok_token)\n", " ngrok.kill()\n", " tunnel = ngrok.connect(7860)\n", " print(f\"Ngrok URL: \\033[0m\\033[93m{tunnel.public_url}\\033[0m\", end=\"\\033[0m\\n\")\n", " !python app.py --listen\n", " except Exception as e:\n", " print(f\"Error starting ngrok: {e}\")\n", "\n", "def start_app():\n", " if method == 'gradio':\n", " start_gradio()\n", " elif method == 'localtunnel':\n", " start_localtunnel()\n", " elif method == 'ngrok':\n", " start_ngrok()\n", "\n", "if tensorboard:\n", " %load_ext tensorboard\n", " %tensorboard --logdir ./assets/logs --port=6870\n", "\n", "\n", "thread_app = threading.Thread(target=start_app)\n", "thread_app.start()\n", "\n", "\n", "while True:\n", " time.sleep(5)" ] }, { "cell_type": "markdown", "source": [ "# Extra" ], "metadata": { "id": "OVg-SqBKXIFL" } }, { "cell_type": "code", "source": [ "\n", "#@title upload model to HF model\n", "repo_hf = \"NeoPy/TTS-G\" # @param {type:\"string\"}\n", "pth = \"/content/RVC-MAKER/assets/weights/TTS_100e_500s.pth\" # @param {type:\"string\"}\n", "index = \"/content/RVC-MAKER/assets/logs/TTS/added_IVF59_Flat_nprobe_1_TTS_v2.index\" # @param {type:\"string\"}\n", "\n", "#@markdown get token on https://huggingface.co/settings/tokens\n", "\n", "token = \"hf_\" # @param {type:\"string\"}\n", "\n", "\n", "import huggingface_hub\n", "import zipfile\n", "import os\n", "def upload_model(repo, pth, index, token):\n", " \"\"\"\n", " Upload a model to the Hugging Face Hub\n", "\n", " Args:\n", " repo: str, the name of the repository (including user/org, e.g., \"username/repo_name\")\n", " pth: str, path to the model file\n", " index: str, the index of the model in the repository\n", " token: str, the API token\n", "\n", " Returns:\n", " str, message indicating the success of the operation\n", " \"\"\"\n", " readme = f\"\"\"\n", " # {repo}\n", " This is a model uploaded by RVC Maker, using [NeoDev](https://github.com/TheNeodev)'s script.\n", " \"\"\"\n", " repo_name = repo.split('/')[1]\n", " with zipfile.ZipFile(f'{repo_name}.zip', 'w') as zipf:\n", " zipf.write(pth, os.path.basename(pth))\n", " zipf.write(index, os.path.basename(index))\n", " zipf.writestr('README.md', readme)\n", "\n", " # Corrected: Pass the repo_id directly as the first argument\n", " huggingface_hub.HfApi().create_repo(repo_id=repo, token=token, exist_ok=True)\n", " # Change 'path' to 'path_or_fileobj' as per the error and common usage in newer versions\n", " huggingface_hub.HfApi().upload_file(token=token, path_or_fileobj=f'{repo.split(\"/\")[1]}.zip', repo_id=repo, path_in_repo=f'{repo.split(\"/\")[1]}.zip')\n", " os.remove(f'{repo.split(\"/\")[1]}.zip')\n", " return \"Model uploaded successfully\"\n", "\n", "\n", "upload_model(repo_hf, pth, index, token)" ], "metadata": { "cellView": "form", "id": "Y1Jke8epTHFj" }, "execution_count": null, "outputs": [] } ], "metadata": { "accelerator": "GPU", "colab": { "collapsed_sections": [ "tkqks7bO2Cye", "XP4ifZaG_yd5", "ekfkFFNqppfM", "ers351v_CMGN" ], "gpuType": "T4", "provenance": [], "include_colab_link": true }, "kernelspec": { "display_name": "Python 3", "name": "python3" }, "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 0 }