Added additional instructions

This commit is contained in:
erew123 authored and GitHub committed 2024-07-27 08:46:29 +01:00
1 parent 61e6c2c105
commit 4c97c83d25
1 file changed
+234 -60
+234 -60
View File
@@ -21,77 +21,33 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {
"id": "W6ls-RHTQeZv",
"cellView": "form",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "1709d1a6-f744-4e39-fff7-1d87d7bfe454"
"id": "W6ls-RHTQeZv",
"outputId": "a20360b3-a5cb-48c5-b885-db89e8c143f0"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"\n",
"********************************\n",
"*** Installing Requirements ****\n",
"********************************\n",
"\n",
"Collecting pip<24.1\n",
" Downloading pip-24.0-py3-none-any.whl.metadata (3.6 kB)\n",
"Downloading pip-24.0-py3-none-any.whl (2.1 MB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.1/2.1 MB\u001b[0m \u001b[31m71.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hInstalling collected packages: pip\n",
" Attempting uninstall: pip\n",
" Found existing installation: pip 24.1.2\n",
" Uninstalling pip-24.1.2:\n",
" Successfully uninstalled pip-24.1.2\n",
"Successfully installed pip-24.0\n",
" 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",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m252.0/252.0 kB\u001b[0m \u001b[31m18.0 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",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m47.4/47.4 MB\u001b[0m \u001b[31m18.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
" Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
" Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m73.5/73.5 kB\u001b[0m \u001b[31m7.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m138.0/138.0 kB\u001b[0m \u001b[31m12.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m3.7/3.7 MB\u001b[0m \u001b[31m102.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m101.6/101.6 kB\u001b[0m \u001b[31m9.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m15.3/15.3 MB\u001b[0m \u001b[31m103.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m31.4/31.4 MB\u001b[0m \u001b[31m19.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m18.1/18.1 MB\u001b[0m \u001b[31m90.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m10.9/10.9 MB\u001b[0m \u001b[31m23.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m50.4/50.4 kB\u001b[0m \u001b[31m3.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
" Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m59.6/59.6 kB\u001b[0m \u001b[31m5.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m64.2/64.2 kB\u001b[0m \u001b[31m5.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m88.4/88.4 kB\u001b[0m \u001b[31m7.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m417.9/417.9 MB\u001b[0m \u001b[31m1.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[91m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[91m╸\u001b[0m \u001b[32m663.9/663.9 MB\u001b[0m \u001b[31m84.9 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m"
"************************************\n",
"** Server requirements installed ***\n",
"*** Please proceed to next step ****\n",
"************************************\n",
"\n"
]
}
],
"source": [
"#@markdown #####You can enable gdrive that drag and drop samples directly through your google drive via the `drive/Mydrive` path\n",
"#@markdown Mounting your Google Drive allows you to drag and drop samples/models via the `drive/Mydrive` path. This allows you<br>\n",
"#@markdown to store or use specific audio samples or finetuned models.<br><br>\n",
"#@markdown **Audio samples** need to be placed in `alltalk_tts/voices`<br>\n",
"#@markdown **XTTS models** need to be placed in `alltalk_tts/models/xtts/{yourmodelfolderhere}`<br>\n",
"mount_gdrive = False #@param{type:\"boolean\"}\n",
"\n",
"if mount_gdrive:\n",
@@ -167,15 +123,105 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {
"cellView": "form",
"id": "9PCQhSoiWvhL",
"cellView": "form"
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "20c6e4b0-7075-4d7c-f703-3b90e373414f"
},
"outputs": [],
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"[AllTalk TTS]\u001b[94m _ _ _ \u001b[1;35m_____ _ _ \u001b[0m _____ _____ ____ \n",
"[AllTalk TTS]\u001b[94m / \\ | | |\u001b[1;35m_ _|_ _| | | __ \u001b[0m |_ _|_ _/ ___| \n",
"[AllTalk TTS]\u001b[94m / _ \\ | | |\u001b[1;35m | |/ _` | | |/ / \u001b[0m | | | | \\___ \\ \n",
"[AllTalk TTS]\u001b[94m / ___ \\| | |\u001b[1;35m | | (_| | | < \u001b[0m | | | | ___) |\n",
"[AllTalk TTS]\u001b[94m /_/ \\_\\_|_|\u001b[1;35m |_|\\__,_|_|_|\\_\\ \u001b[0m |_| |_| |____/ \n",
"[AllTalk TTS]\n",
"[AllTalk TTS] \u001b[92mConfig file update: \u001b[93mNo Updates required\u001b[0m\n",
"[AllTalk TTS] \u001b[92mStart-up Mode : \u001b[93mStandalone mode\u001b[0m\n",
"[AllTalk TTS]\n",
"[AllTalk TTS] \u001b[92mThis is the first time startup. Please download a start TTS model.\u001b[0m\n",
"[AllTalk TTS]\n",
"[AllTalk TTS] \u001b[94mAvailable First Time Start-up models:\u001b[0m\n",
"[AllTalk TTS]\n",
"[AllTalk TTS] \u001b[93m1. \u001b[94mpiper - piper\u001b[0m\n",
"[AllTalk TTS] \u001b[93m2. \u001b[94mvits - tts_models--en--vctk--vits\u001b[0m\n",
"[AllTalk TTS] \u001b[93m3. \u001b[94mxtts - xttsv2_2.0.3\u001b[0m\n",
"[AllTalk TTS] \u001b[93m4.\u001b[94m I have my own models already\u001b[0m\n",
"[AllTalk TTS]\n",
"[AllTalk TTS] \u001b[94mIn \u001b[91m60 seconds\u001b[0m \u001b[94ma Piper model will be \u001b[91mdownloaded automatically.\u001b[0m\n",
"[AllTalk TTS]\n",
"[AllTalk TTS] \u001b[92mEnter your choice 1-4: \u001b[0m \n",
"[AllTalk TTS]\n",
"[AllTalk TTS] No input received. Proceeding with the default model (piper).\n",
"/content/alltalk_tts/models/piper/en_US-ljspeech-high.onnx: 100% 114M/114M [00:01<00:00, 80.8MiB/s]\n",
"/content/alltalk_tts/models/piper/en_US-ljspeech-high.onnx.json: 100% 4.97k/4.97k [00:00<00:00, 14.9MiB/s]\n",
"[AllTalk TTS] piper model downloaded and configuration updated successfully.\n",
"[AllTalk TTS]\n",
"[AllTalk TTS] \u001b[93mIf you have you have UPGRADED from v1 ensure you have re-installed\u001b[0m\n",
"[AllTalk TTS] \u001b[93mthe requirements. Otherwise you will get failures and errors!\u001b[0m\n",
"[AllTalk TTS] \u001b[93mOn Linux ignore the \u001b[0m'sparse_attn requires a torch version' \u001b[93mand\u001b[0m\n",
"[AllTalk TTS] \u001b[0m'using untested triton version' \u001b[93mmessages.\u001b[0m\n",
"[AllTalk TTS]\n",
"[AllTalk TTS] \u001b[92mWAV file deletion :\u001b[93m Disabled\u001b[0m\n",
"[AllTalk TTS] \u001b[92mGithub updated :\u001b[93m 1st July 2024 at 08:57\u001b[0m\n",
"[AllTalk TTS]\n",
"[AllTalk TTS] \u001b[94mGoogle Colab Detected\u001b[00m\n",
"[AllTalk TTS]\n",
"[AllTalk ENG] \u001b[92mTranscoding :\u001b[93m ffmpeg found\u001b[0m\n",
"\u001b[93m [WARNING] \u001b[0m Please specify the CUTLASS repo directory as environment variable $CUTLASS_PATH\n",
"\u001b[93m [WARNING] \u001b[0m NVIDIA Inference is only supported on Ampere and newer architectures\n",
"\u001b[93m [WARNING] \u001b[0m sparse_attn requires a torch version >= 1.5 and < 2.0 but detected 2.3\n",
"\u001b[93m [WARNING] \u001b[0m using untested triton version (2.3.1), only 1.0.0 is known to be compatible\n",
"[AllTalk ENG] \u001b[92mDeepSpeed version :\u001b[93m 0.14.4 \u001b[0m\n",
"[AllTalk ENG] \u001b[92mPython Version :\u001b[93m 3.10.12\u001b[0m\n",
"[AllTalk ENG] \u001b[92mPyTorch Version :\u001b[93m 2.3.1+cu121\u001b[0m\n",
"[AllTalk ENG] \u001b[92mCUDA Version :\u001b[93m 12.1\u001b[0m\n",
"[AllTalk ENG]\n",
"[AllTalk ENG]\u001b[94m Model/Engine :\u001b[93m Piper\u001b[94m Ready\u001b[0m\n",
"[AllTalk ENG] \u001b[94mLoad time :\u001b[93m 0.00 seconds.\u001b[0m\n",
"[AllTalk TTS]\n",
"[AllTalk TTS] \u001b[94mAPI Address :\u001b[00m \u001b[92mhttps://refresh-jackson-firefox-elementary.trycloudflare.com\u001b[00m\n",
"[AllTalk TTS] \u001b[94mGradio Light:\u001b[00m \u001b[92mhttps://lawsuit-effectively-assessing-z.trycloudflare.com\u001b[00m\n",
"[AllTalk TTS] \u001b[94mGradio Dark :\u001b[00m \u001b[92mhttps://lawsuit-effectively-assessing-z.trycloudflare.com?__theme=dark\u001b[00m\n",
"[AllTalk TTS]\n",
"themes/theme_schema@0.0.1.json: 100% 13.1k/13.1k [00:00<00:00, 45.7MB/s]\n",
"[AllTalk TTS] Please use \u001b[91mCtrl+C\u001b[0m when exiting AllTalk otherwise a\n",
"[AllTalk TTS] subprocess may continue running in the background.\n",
"[AllTalk TTS]\n",
"[AllTalk TTS] AllTalk Server Ready\n",
"Downloading LICENSE.txt...\n",
"100% 4.01k/4.01k [00:00<00:00, 11.6MiB/s]\n",
"Downloading README.md...\n",
"100% 4.26k/4.26k [00:00<00:00, 13.0MiB/s]\n",
"Downloading config.json...\n",
"100% 4.37k/4.37k [00:00<00:00, 12.1MiB/s]\n",
"Downloading model.pth...\n",
"100% 1.87G/1.87G [00:30<00:00, 61.2MiB/s]\n",
"Downloading dvae.pth...\n",
"100% 211M/211M [00:04<00:00, 50.7MiB/s]\n",
"Downloading mel_stats.pth...\n",
"100% 1.07k/1.07k [00:00<00:00, 2.90MiB/s]\n",
"Downloading speakers_xtts.pth...\n",
"100% 7.75M/7.75M [00:00<00:00, 77.9MiB/s]\n",
"Downloading vocab.json...\n",
"100% 361k/361k [00:00<00:00, 26.4MiB/s]\n",
"[AllTalk Shutdown] \u001b[94mReceived Ctrl+C, terminating subprocess. Kill your Python processes if this fails to exit.\u001b[92m\n",
"[AllTalk Shutdown] \u001b[94mReceived Ctrl+C, terminating subprocess. Kill your Python processes if this fails to exit.\u001b[92m\n",
"^C\n"
]
}
],
"source": [
"#@markdown Links to the API and Gradio interface will be shown when AllTalk has loaded in.<br>\n",
"#@markdown The API address is what you would use in SillyTavern.\n",
"#@markdown The API address is what you would use in SillyTavern.<br>\n",
"#@markdown Do not start this if you want to run Finetuning.\n",
"import re\n",
"import time\n",
"import json\n",
@@ -246,6 +292,134 @@
"# Start API server.\n",
"!python /content/alltalk_tts/script.py\n"
]
},
{
"cell_type": "markdown",
"source": [
"# Start Finetuning"
],
"metadata": {
"id": "gDzNPMwM7qvs"
}
},
{
"cell_type": "code",
"source": [
"#@markdown Starts the Finetuning application for XTTS models.<br><br>\n",
"#@markdown You can either run the `Start AllTalk` to download the base XTTS model(s) for finetuning. Or you can use the folder icon on the left hand<br>\n",
"#@markdown side of the screen and upload an XTTS model that you want to finetune. If you are manually uploading a model, you would place your model<br>\n",
"#@markdown files in `models/xtts/{yourmodelfolderhere}` and you will need all the models files in that folder `config.json, dvae.pth, mel_stats.pth,`<br>\n",
"#@markdown `model.pth, speakers_xtts.pth, vocab.json`. Without 1x model available, Finetuning will not start.<br><br>\n",
"#@markdown Likewise you can download your finetuned model from there, OR copy it to your Google Drive after finetuning, for later use in AllTalk.<br><br>\n",
"#@markdown To access the Finetuning Gradio interface, connect to the `Google Colab Finetuning url` when Finetuning has started.<br>\n",
"import re\n",
"import time\n",
"import json\n",
"import threading\n",
"import time\n",
"\n",
"def keep_alive():\n",
" while True:\n",
" time.sleep(60) # Run every 60 seconds (adjust as needed)\n",
"\n",
"keep_alive_thread = threading.Thread(target=keep_alive)\n",
"keep_alive_thread.start()\n",
"\n",
"Tunnel = \"cloudflare\"\n",
"host = \"127.0.0.1\"\n",
"ports = [7052]\n",
"tunnel_urls = []\n",
"\n",
"# Starting tunnels for each port.\n",
"for port in ports:\n",
" if Tunnel == \"cloudflare\":\n",
" !nohup cloudflared tunnel --url http://{host}:{port} > lt_{port}.log 2>&1 &\n",
" else:\n",
" !nohup npx lt -p {port} > lt_{port}.log 2>&1 &\n",
"\n",
"# Wait a couple of seconds for the tunnels to initialize.\n",
"time.sleep(10)\n",
"\n",
"# Extract URLs for each tunnel.\n",
"for port in ports:\n",
" log_file = f'lt_{port}.log'\n",
" with open(log_file, 'r') as testwritefile:\n",
" log_content = testwritefile.read()\n",
"\n",
" # Use regular expressions to find the URL.\n",
" if Tunnel == \"cloudflare\":\n",
" url_match = re.search(r'(https://[-a-z0-9]+\\.trycloudflare\\.com)', log_content)\n",
" else:\n",
" url_match = re.search(r'your url is: (https?://\\S+)', log_content)\n",
"\n",
" if url_match:\n",
" tunnel_url = url_match.group(1)\n",
" tunnel_urls.append(tunnel_url)\n",
" print(f\"Google Colab Finetuning url: {tunnel_url}\\n\")\n",
" print(f\"********************************************************************\")\n",
" print(f\"**** Use the above URL to connect to Finetuning on Google Colab ****\")\n",
" print(f\"********************************************************************\")\n",
" print(f\"************* Now starting the Finetuning Application **************\")\n",
" print(f\"********************************************************************\\n\")\n",
" else:\n",
" print(f\"URL for port {port} not found.\")\n",
"\n",
"# Save the tunnel URLs to a JSON file.\n",
"try:\n",
" # Try to open the JSON file for reading.\n",
" with open('/content/alltalk_tts/googlecolab.json', 'r') as f:\n",
" data = json.load(f)\n",
"except FileNotFoundError:\n",
" # If the file doesn't exist, create an empty dictionary.\n",
" data = {}\n",
"\n",
"data['google_ip_address'] = tunnel_urls\n",
"\n",
"# Write the modified data (or newly created data) back to the file.\n",
"with open('/content/alltalk_tts/googlecolab.json', 'w') as f:\n",
" json.dump(data, f)\n",
"\n",
"host = \"0.0.0.0\"\n",
"\n",
"if Tunnel == \"localtunnel\":\n",
" print(\"Before you copy the link above click on it and copy that ip:\")\n",
" !curl ipv4.icanhazip.com\n",
"\n",
"# Start API server.\n",
"!python /content/alltalk_tts/finetune.py\n"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"cellView": "form",
"id": "Dewvq5s38Sfd",
"outputId": "30689b4e-2af2-4595-f2be-8bf42753f355"
},
"execution_count": 7,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Google Colab Finetuning url: https://assistance-amazing-periods-payday.trycloudflare.com\n",
"\n",
"********************************************************************\n",
"**** Use the above URL to connect to Finetuning on Google Colab ****\n",
"********************************************************************\n",
"\n",
"[FINETUNE] HTTP Request: GET https://checkip.amazonaws.com/ \"HTTP/1.1 200 \"\n",
"[FINETUNE] HTTP Request: GET https://api.gradio.app/pkg-version \"HTTP/1.1 200 OK\"\n",
"Running on local URL: http://127.0.0.1:7052\n",
"[FINETUNE] HTTP Request: GET http://127.0.0.1:7052/startup-events \"HTTP/1.1 200 OK\"\n",
"[FINETUNE] HTTP Request: HEAD http://127.0.0.1:7052/ \"HTTP/1.1 200 OK\"\n",
"\n",
"To create a public link, set `share=True` in `launch()`.\n",
"[FINETUNE] Received interrupt signal. Cleaning up and exiting...\n",
"\u001b[0m"
]
}
]
}
],
"metadata": {