File size: 19,564 Bytes
1397f77 |
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 |
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "ymhGfgFSR17k"
},
"source": [
"## **Applio**\n",
"Ultimate voice cloning tool, meticulously optimized for unrivaled power, modularity, and user-friendly experience.\n",
"\n",
"[Support](https://discord.gg/IAHispano) — [Discord Bot](https://discord.com/oauth2/authorize?client_id=1144714449563955302&permissions=1376674695271&scope=bot%20applications.commands) — [Find Voices](https://applio.org/models) — [GitHub](https://github.com/IAHispano/Applio)\n",
"\n",
"<br>\n",
"\n",
"### **Credits**\n",
"- Encryption method: [Hina](https://github.com/hinabl)\n",
"- Extra section: [Poopmaster](https://github.com/poiqazwsx)\n",
"- Main development: [Applio Team](https://github.com/IAHispano)\n",
"\n",
"<br>\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"id": "vtON700qokuQ"
},
"outputs": [],
"source": [
"# @title **Install Applio**\n",
"\n",
"import codecs\n",
"import time\n",
"import os\n",
"import csv\n",
"import shutil\n",
"import tarfile\n",
"import subprocess\n",
"from pathlib import Path\n",
"from datetime import datetime\n",
"\n",
"rot_47 = lambda encoded_text: \"\".join(\n",
" [\n",
" (\n",
" chr(\n",
" (ord(c) - (ord(\"a\") if c.islower() else ord(\"A\")) - 47) % 26\n",
" + (ord(\"a\") if c.islower() else ord(\"A\"))\n",
" )\n",
" if c.isalpha()\n",
" else c\n",
" )\n",
" for c in encoded_text\n",
" ]\n",
")\n",
"\n",
"org_name = rot_47(\"Vkkgdj\")\n",
"new_name = rot_47(\"kmjbmvh_hg\")\n",
"uioawhd = rot_47(codecs.decode(\"pbbxa://oqbpcj.kwu/QIPqaxivw/Ixxtqw.oqb\", \"rot_13\"))\n",
"uyadwa = codecs.decode(\"ncc.cl\", \"rot_13\")\n",
"!git clone --depth 1 $uioawhd\n",
"!mv $org_name $new_name\n",
"%cd $new_name/\n",
"\n",
"from IPython.display import clear_output, Javascript\n",
"\n",
"clear_output()\n",
"\n",
"E = Exception\n",
"B = print\n",
"\n",
"\n",
"def vidal_setup(ForceIn):\n",
" L = \"Kikpm.ovm.bu\"\n",
" K = \"/content/\"\n",
" C = ForceIn\n",
"\n",
" def F():\n",
" print(\"Installing pip packages...\")\n",
" subprocess.check_call([\"pip\", \"install\", \"-r\", \"requirements.txt\", \"--quiet\"])\n",
"\n",
" A = K + rot_47(L)\n",
" G = K + rot_47(L)\n",
" D = \"/\"\n",
" if not os.path.exists(A):\n",
" M = os.path.dirname(A)\n",
" os.makedirs(M, exist_ok=True)\n",
" print(\"No cached install found..\")\n",
" try:\n",
" N = rot_47(\n",
" codecs.decode(\n",
" \"pbbxa://pcooqvonikm.kw/QIPqaxivw/Ixxtqw/zmawtdm/uiqv/Kwtij/Xvxcz.biz.oh\",\n",
" \"rot_13\",\n",
" )\n",
" )\n",
" subprocess.run([\"wget\", \"-O\", A, N])\n",
" print(\"Download completed successfully!\")\n",
" except E as H:\n",
" print(str(H))\n",
" if os.path.exists(A):\n",
" os.remove(A)\n",
" if Path(A).exists():\n",
" with tarfile.open(G, \"r:gz\") as I:\n",
" for J in I.getmembers():\n",
" O = os.path.join(D, J.name)\n",
" try:\n",
" I.extract(J, D)\n",
" except E as H:\n",
" print(\"Failed to extract a file\")\n",
" C = True\n",
" print(f\"Extraction of {G} to {D} completed.\")\n",
" if os.path.exists(A):\n",
" os.remove(A)\n",
" if C:\n",
" F()\n",
" C = False\n",
" else:\n",
" F()\n",
"\n",
"\n",
"vidal_setup(False)\n",
"clear_output()\n",
"print(\"Finished installing requirements!\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"id": "-7cQtXouqpQi"
},
"outputs": [],
"source": [
"# @title **Start Applio**\n",
"# @markdown ### Just activate this in case the share link of the gradio dont work\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",
"!npm install -g localtunnel\n",
"new_name = rot_47(\"kmjbmvh_hg\")\n",
"%cd \"/content/program_ml\"\n",
"uyadwa = codecs.decode(\"ncc.cl\", \"rot_13\")\n",
"share_tunnel = False # @param {type:\"boolean\"}\n",
"def start_applio():\n",
" if share_tunnel:\n",
" !python $uyadwa --listen\n",
" else:\n",
" !python $uyadwa --listen --share\n",
"\n",
"%load_ext tensorboard\n",
"%reload_ext tensorboard\n",
"%tensorboard --logdir logs --bind_all\n",
"\n",
"if \"autobackups\" not in globals():\n",
" autobackups = False\n",
"\n",
"if autobackups:\n",
" thread = threading.Thread(target=backup_files)\n",
" thread.start()\n",
"\n",
"thread_applio = threading.Thread(target=start_applio)\n",
"thread_applio.start()\n",
"\n",
"if share_tunnel:\n",
" if not os.path.exists(codecs.decode(\"eip/cergenvarqf/cergenvarq_i2/s0T48x.cgu\", \"rot_13\")):\n",
" while not os.path.exists(codecs.decode(\"eip/cergenvarqf/cergenvarq_i2/s0T48x.cgu\", \"rot_13\")):\n",
" time.sleep(2)\n",
" time.sleep(5)\n",
" else:\n",
" time.sleep(10)\n",
" with open('url.txt', 'w') as file:\n",
" file.write('')\n",
"\n",
" get_ipython().system_raw('lt --port 6969 >> url.txt 2>&1 &')\n",
"\n",
" time.sleep(4)\n",
"\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",
"\n",
"\n",
"\n",
"while True:\n",
" time.sleep(5)\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "3b59-2x-qEnX"
},
"source": [
"### **Extra**\n",
"Enjoy extra options that can make it easier for you to use Applio\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"id": "19LNv6iYqF6_"
},
"outputs": [],
"source": [
"# @title Mount Drive\n",
"# @markdown Mount the files from Google Drive to the Colab.\n",
"from google.colab import drive\n",
"\n",
"drive.mount(\"/content/drive\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"id": "I5o6MlpFouiG"
},
"outputs": [],
"source": [
"# @title Auto Backup\n",
"# @markdown When running it, it will be activated or deactivated previously to start up together with Applio.\n",
"LOGS_FOLDER = \"/content/program_ml/logs/\"\n",
"GOOGLE_DRIVE_PATH = \"/content/drive/MyDrive/ApplioBackup\"\n",
"\n",
"if \"autobackups\" not in globals():\n",
" autobackups = False\n",
"\n",
"\n",
"def backup_files():\n",
" print(\"\\nStarting backup loop...\")\n",
" last_backup_timestamps_path = os.path.join(\n",
" LOGS_FOLDER, \"last_backup_timestamps.txt\"\n",
" )\n",
" fully_updated = False\n",
"\n",
" while True:\n",
" try:\n",
" updated = False\n",
" last_backup_timestamps = {}\n",
"\n",
" try:\n",
" with open(last_backup_timestamps_path, \"r\") as f:\n",
" last_backup_timestamps = dict(line.strip().split(\":\") for line in f)\n",
" except FileNotFoundError:\n",
" pass\n",
"\n",
" for root, dirs, files in os.walk(LOGS_FOLDER):\n",
" # Excluding \"zips\" directory\n",
" if \"zips\" in dirs:\n",
" dirs.remove(\"zips\")\n",
" if \"mute\" in dirs:\n",
" dirs.remove(\"mute\")\n",
" for filename in files:\n",
" if filename != \"last_backup_timestamps.txt\":\n",
" filepath = os.path.join(root, filename)\n",
" if os.path.isfile(filepath):\n",
" backup_filepath = os.path.join(\n",
" GOOGLE_DRIVE_PATH,\n",
" os.path.relpath(filepath, LOGS_FOLDER),\n",
" )\n",
" backup_folderpath = os.path.dirname(backup_filepath)\n",
" if not os.path.exists(backup_folderpath):\n",
" os.makedirs(backup_folderpath)\n",
" print(\n",
" f\"Created backup folder: {backup_folderpath}\",\n",
" flush=True,\n",
" )\n",
" last_backup_timestamp = last_backup_timestamps.get(filepath)\n",
" current_timestamp = os.path.getmtime(filepath)\n",
" if (\n",
" last_backup_timestamp is None\n",
" or float(last_backup_timestamp) < current_timestamp\n",
" ):\n",
" shutil.copy2(filepath, backup_filepath)\n",
" last_backup_timestamps[filepath] = str(\n",
" current_timestamp\n",
" )\n",
" if last_backup_timestamp is None:\n",
" print(f\"Backed up file: {filename}\")\n",
" else:\n",
" print(f\"Updating backed up file: {filename}\")\n",
" updated = True\n",
" fully_updated = False\n",
"\n",
" for filepath in list(last_backup_timestamps.keys()):\n",
" if not os.path.exists(filepath):\n",
" backup_filepath = os.path.join(\n",
" GOOGLE_DRIVE_PATH, os.path.relpath(filepath, LOGS_FOLDER)\n",
" )\n",
" if os.path.exists(backup_filepath):\n",
" os.remove(backup_filepath)\n",
" print(f\"Deleted file: {filepath}\")\n",
" del last_backup_timestamps[filepath]\n",
" updated = True\n",
" fully_updated = False\n",
"\n",
" if not updated and not fully_updated:\n",
" print(\"Files are up to date.\")\n",
" fully_updated = True\n",
" sleep_time = 15\n",
" else:\n",
" sleep_time = 0.1\n",
"\n",
" with open(last_backup_timestamps_path, \"w\") as f:\n",
" for filepath, timestamp in last_backup_timestamps.items():\n",
" f.write(f\"{filepath}:{timestamp}\\n\")\n",
"\n",
" time.sleep(sleep_time)\n",
"\n",
" except Exception as e:\n",
" print(f\"An error occurred: {str(e)}\")\n",
"\n",
"\n",
"if autobackups:\n",
" autobackups = False\n",
" print(\"Autobackup Disabled\")\n",
"else:\n",
" autobackups = True\n",
" print(\"Autobackup Enabled\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"id": "ifV_vc4h4Uvx"
},
"outputs": [],
"source": [
"# @title Load a Backup\n",
"from google.colab import drive\n",
"\n",
"# @markdown Put the exact name you put as your Model Name in Applio.\n",
"modelname = \"My-Project\" # @param {type:\"string\"}\n",
"source_path = \"/content/drive/MyDrive/ApplioBackup/\" + modelname\n",
"destination_path = \"/content/program_ml/logs/\" + modelname\n",
"backup_timestamps_file = \"last_backup_timestamps.txt\"\n",
"if not os.path.exists(source_path):\n",
" print(\n",
" \"The model folder does not exist. Please verify the name is correct or check your Google Drive.\"\n",
" )\n",
"else:\n",
" time_ = os.path.join(\"/content/drive/MyDrive/ApplioBackup/\", backup_timestamps_file)\n",
" time__ = os.path.join(\"/content/program_ml/logs/\", backup_timestamps_file)\n",
" if os.path.exists(time_):\n",
" shutil.copy(time_, time__)\n",
" shutil.copytree(source_path, destination_path)\n",
" print(\"Model backup loaded successfully.\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"id": "leWbhk1X4XoY"
},
"outputs": [],
"source": [
"# @title Download all custom pretrains\n",
"import os\n",
"import urllib.request\n",
"\n",
"%mkdir /content/program_ml/rvc/pretraineds/pretraineds_custom\n",
"pretrained_urls = [\n",
" # Ov2 Super\n",
" \"https://huggingface.co/ORVC/Ov2Super/resolve/main/f0Ov2Super32kG.pth\",\n",
" \"https://huggingface.co/ORVC/Ov2Super/resolve/main/f0Ov2Super32kD.pth\",\n",
" \"https://huggingface.co/ORVC/Ov2Super/resolve/main/f0Ov2Super40kG.pth\",\n",
" \"https://huggingface.co/ORVC/Ov2Super/resolve/main/f0Ov2Super40kD.pth\",\n",
"\n",
" # TITAN\n",
" \"https://huggingface.co/blaise-tk/TITAN/resolve/main/models/medium/40k/pretrained/G-f040k-TITAN-Medium.pth\",\n",
" \"https://huggingface.co/blaise-tk/TITAN/resolve/main/models/medium/40k/pretrained/D-f040k-TITAN-Medium.pth\",\n",
" \"https://huggingface.co/blaise-tk/TITAN/resolve/main/models/medium/32k/pretrained/G-f032k-TITAN-Medium.pth\",\n",
" \"https://huggingface.co/blaise-tk/TITAN/resolve/main/models/medium/32k/pretrained/D-f032k-TITAN-Medium.pth\",\n",
"\n",
" # Snowie V3\n",
" \"https://huggingface.co/MUSTAR/SnowieV3.1-32k/resolve/main/D_SnowieV3.1_32k.pth\",\n",
" \"https://huggingface.co/MUSTAR/SnowieV3.1-32k/resolve/main/G_SnowieV3.1_32k.pth\",\n",
" \"https://huggingface.co/MUSTAR/SnowieV3.1-40k/resolve/main/G_SnowieV3.1_40k.pth\",\n",
" \"https://huggingface.co/MUSTAR/SnowieV3.1-40k/resolve/main/D_SnowieV3.1_40k.pth\",\n",
" \"https://huggingface.co/MUSTAR/SnowieV3.1-48k/resolve/main/G_SnowieV3.1_48k.pth\",\n",
" \"https://huggingface.co/MUSTAR/SnowieV3.1-48k/resolve/main/D_SnowieV3.1_48k.pth\",\n",
"\n",
" # RIN E3\n",
" \"https://huggingface.co/MUSTAR/RIN_E3/resolve/main/RIN_E3_G.pth\",\n",
" \"https://huggingface.co/MUSTAR/RIN_E3/resolve/main/RIN_E3_D.pth\",\n",
"\n",
" # KLM\n",
" \"https://huggingface.co/SeoulStreamingStation/KLMv7s/resolve/main/G_KLMv7s_Batch2_32k.pth\",\n",
" \"https://huggingface.co/SeoulStreamingStation/KLMv7s/resolve/main/D_KLMv7s_Batch2_32k.pth\",\n",
" \"https://huggingface.co/SeoulStreamingStation/KLMv7s/resolve/main/G_KLMv7s_Batch2_40k.pth\",\n",
" \"https://huggingface.co/SeoulStreamingStation/KLMv7s/resolve/main/D_KLMv7s_Batch2_40k.pth\",\n",
" \"https://huggingface.co/SeoulStreamingStation/KLMv7s/resolve/main/G_KLMv7s_Batch2_48k.pth\",\n",
" \"https://huggingface.co/SeoulStreamingStation/KLMv7s/resolve/main/D_KLMv7s_Batch2_48k.pth\",\n",
"\n",
" # SnowieV3 X RIN_E3\n",
" \"https://huggingface.co/MUSTAR/SnowieV3.1-X-RinE3-40K/resolve/main/D_Snowie-X-Rin_40k.pth\",\n",
" \"https://huggingface.co/MUSTAR/SnowieV3.1-X-RinE3-40K/resolve/main/G_Snowie-X-Rin_40k.pth\",\n",
"]\n",
"output_directory = \"/content/program_ml/rvc/pretraineds/pretraineds_custom\"\n",
"for url in pretrained_urls:\n",
" filename = os.path.join(output_directory, os.path.basename(url))\n",
" urllib.request.urlretrieve(url, filename)"
]
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"collapsed_sections": [
"3b59-2x-qEnX"
],
"gpuType": "T4",
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
|