Merge branch 'RVC-Boss:main' into main
commit
fb69e72d1a
@ -0,0 +1,152 @@
|
||||
{
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0,
|
||||
"metadata": {
|
||||
"colab": {
|
||||
"provenance": []
|
||||
},
|
||||
"kernelspec": {
|
||||
"name": "python3",
|
||||
"display_name": "Python 3"
|
||||
},
|
||||
"accelerator": "GPU"
|
||||
},
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"# Credits for bubarino giving me the huggingface import code (感谢 bubarino 给了我 huggingface 导入代码)"
|
||||
],
|
||||
"metadata": {
|
||||
"id": "himHYZmra7ix"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"metadata": {
|
||||
"id": "e9b7iFV3dm1f"
|
||||
},
|
||||
"source": [
|
||||
"!git clone https://github.com/RVC-Boss/GPT-SoVITS.git\n",
|
||||
"%cd GPT-SoVITS\n",
|
||||
"!apt-get update && apt-get install -y --no-install-recommends tzdata ffmpeg libsox-dev parallel aria2 git git-lfs && git lfs install\n",
|
||||
"!pip install -r requirements.txt"
|
||||
],
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"# @title Download pretrained models 下载预训练模型\n",
|
||||
"!mkdir -p /content/GPT-SoVITS/GPT_SoVITS/pretrained_models\n",
|
||||
"!mkdir -p /content/GPT-SoVITS/tools/damo_asr/models\n",
|
||||
"!mkdir -p /content/GPT-SoVITS/tools/uvr5\n",
|
||||
"%cd /content/GPT-SoVITS/GPT_SoVITS/pretrained_models\n",
|
||||
"!git clone https://huggingface.co/lj1995/GPT-SoVITS\n",
|
||||
"%cd /content/GPT-SoVITS/tools/damo_asr/models\n",
|
||||
"!git clone https://www.modelscope.cn/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch.git\n",
|
||||
"!git clone https://www.modelscope.cn/damo/speech_fsmn_vad_zh-cn-16k-common-pytorch.git\n",
|
||||
"!git clone https://www.modelscope.cn/damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch.git\n",
|
||||
"# @title UVR5 pretrains 安装uvr5模型\n",
|
||||
"%cd /content/GPT-SoVITS/tools/uvr5\n",
|
||||
"!git clone https://huggingface.co/Delik/uvr5_weights\n",
|
||||
"!git config core.sparseCheckout true\n",
|
||||
"!mv /content/GPT-SoVITS/GPT_SoVITS/pretrained_models/GPT-SoVITS/* /content/GPT-SoVITS/GPT_SoVITS/pretrained_models/"
|
||||
],
|
||||
"metadata": {
|
||||
"id": "0NgxXg5sjv7z",
|
||||
"cellView": "form"
|
||||
},
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"#@title Create folder models 创建文件夹模型\n",
|
||||
"import os\n",
|
||||
"base_directory = \"/content/GPT-SoVITS\"\n",
|
||||
"folder_names = [\"SoVITS_weights\", \"GPT_weights\"]\n",
|
||||
"\n",
|
||||
"for folder_name in folder_names:\n",
|
||||
" if os.path.exists(os.path.join(base_directory, folder_name)):\n",
|
||||
" print(f\"The folder '{folder_name}' already exists. (文件夹'{folder_name}'已经存在。)\")\n",
|
||||
" else:\n",
|
||||
" os.makedirs(os.path.join(base_directory, folder_name))\n",
|
||||
" print(f\"The folder '{folder_name}' was created successfully! (文件夹'{folder_name}'已成功创建!)\")\n",
|
||||
"\n",
|
||||
"print(\"All folders have been created. (所有文件夹均已创建。)\")"
|
||||
],
|
||||
"metadata": {
|
||||
"cellView": "form",
|
||||
"id": "cPDEH-9czOJF"
|
||||
},
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"import requests\n",
|
||||
"import zipfile\n",
|
||||
"import shutil\n",
|
||||
"import os\n",
|
||||
"\n",
|
||||
"#@title Import model 导入模型 (HuggingFace)\n",
|
||||
"hf_link = 'https://huggingface.co/modelloosrvcc/Nagisa_Shingetsu_GPT-SoVITS/resolve/main/Nagisa.zip' #@param {type: \"string\"}\n",
|
||||
"\n",
|
||||
"output_path = '/content/'\n",
|
||||
"\n",
|
||||
"response = requests.get(hf_link)\n",
|
||||
"with open(output_path + 'file.zip', 'wb') as file:\n",
|
||||
" file.write(response.content)\n",
|
||||
"\n",
|
||||
"with zipfile.ZipFile(output_path + 'file.zip', 'r') as zip_ref:\n",
|
||||
" zip_ref.extractall(output_path)\n",
|
||||
"\n",
|
||||
"os.remove(output_path + \"file.zip\")\n",
|
||||
"\n",
|
||||
"source_directory = output_path\n",
|
||||
"SoVITS_destination_directory = '/content/GPT-SoVITS/SoVITS_weights'\n",
|
||||
"GPT_destination_directory = '/content/GPT-SoVITS/GPT_weights'\n",
|
||||
"\n",
|
||||
"for filename in os.listdir(source_directory):\n",
|
||||
" if filename.endswith(\".pth\"):\n",
|
||||
" source_path = os.path.join(source_directory, filename)\n",
|
||||
" destination_path = os.path.join(SoVITS_destination_directory, filename)\n",
|
||||
" shutil.move(source_path, destination_path)\n",
|
||||
"\n",
|
||||
"for filename in os.listdir(source_directory):\n",
|
||||
" if filename.endswith(\".ckpt\"):\n",
|
||||
" source_path = os.path.join(source_directory, filename)\n",
|
||||
" destination_path = os.path.join(GPT_destination_directory, filename)\n",
|
||||
" shutil.move(source_path, destination_path)\n",
|
||||
"\n",
|
||||
"print(f'Model downloaded. (模型已下载。)')"
|
||||
],
|
||||
"metadata": {
|
||||
"cellView": "form",
|
||||
"id": "vbZY-LnM0tzq"
|
||||
},
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"# @title launch WebUI 启动WebUI\n",
|
||||
"!/usr/local/bin/pip install ipykernel\n",
|
||||
"!sed -i '10s/False/True/' /content/GPT-SoVITS/config.py\n",
|
||||
"%cd /content/GPT-SoVITS/\n",
|
||||
"!/usr/local/bin/python webui.py"
|
||||
],
|
||||
"metadata": {
|
||||
"id": "4oRGUzkrk8C7",
|
||||
"cellView": "form"
|
||||
},
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,218 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "45857cb2",
|
||||
"metadata": {
|
||||
"_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19",
|
||||
"_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5",
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-02-18T14:43:46.735480Z",
|
||||
"iopub.status.busy": "2024-02-18T14:43:46.735183Z",
|
||||
"iopub.status.idle": "2024-02-18T14:48:10.724175Z",
|
||||
"shell.execute_reply": "2024-02-18T14:48:10.723059Z"
|
||||
},
|
||||
"papermill": {
|
||||
"duration": 263.994935,
|
||||
"end_time": "2024-02-18T14:48:10.726613",
|
||||
"exception": false,
|
||||
"start_time": "2024-02-18T14:43:46.731678",
|
||||
"status": "completed"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!git clone https://github.com/RVC-Boss/GPT-SoVITS.git\n",
|
||||
"%cd GPT-SoVITS\n",
|
||||
"!apt-get update && apt-get install -y --no-install-recommends tzdata ffmpeg libsox-dev parallel aria2 git git-lfs && git lfs install\n",
|
||||
"!pip install -r requirements.txt"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "b9d346b4",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-02-18T14:48:10.815802Z",
|
||||
"iopub.status.busy": "2024-02-18T14:48:10.814899Z",
|
||||
"iopub.status.idle": "2024-02-18T14:50:31.253276Z",
|
||||
"shell.execute_reply": "2024-02-18T14:50:31.252024Z"
|
||||
},
|
||||
"papermill": {
|
||||
"duration": 140.484893,
|
||||
"end_time": "2024-02-18T14:50:31.255720",
|
||||
"exception": false,
|
||||
"start_time": "2024-02-18T14:48:10.770827",
|
||||
"status": "completed"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# @title Download pretrained models 下载预训练模型\n",
|
||||
"!mkdir -p /kaggle/working/GPT-SoVITS/GPT_SoVITS/pretrained_models\n",
|
||||
"!mkdir -p /kaggle/working/GPT-SoVITS/tools/damo_asr/models\n",
|
||||
"!mkdir -p /kaggle/working/GPT-SoVITS/tools/uvr5\n",
|
||||
"%cd /kaggle/working/GPT-SoVITS/GPT_SoVITS/pretrained_models\n",
|
||||
"!git clone https://huggingface.co/lj1995/GPT-SoVITS\n",
|
||||
"%cd /kaggle/working/GPT-SoVITS/tools/damo_asr/models\n",
|
||||
"!git clone https://www.modelscope.cn/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch.git\n",
|
||||
"!git clone https://www.modelscope.cn/damo/speech_fsmn_vad_zh-cn-16k-common-pytorch.git\n",
|
||||
"!git clone https://www.modelscope.cn/damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch.git\n",
|
||||
"# # @title UVR5 pretrains 安装uvr5模型\n",
|
||||
"%cd /kaggle/working/GPT-SoVITS/tools/uvr5\n",
|
||||
"!git clone https://huggingface.co/Delik/uvr5_weights\n",
|
||||
"!git config core.sparseCheckout true\n",
|
||||
"!mv /kaggle/working/GPT-SoVITS/GPT_SoVITS/pretrained_models/GPT-SoVITS/* /kaggle/working/GPT-SoVITS/GPT_SoVITS/pretrained_models/"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "ea94d245",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-02-18T14:29:01.071549Z",
|
||||
"iopub.status.busy": "2024-02-18T14:29:01.070592Z",
|
||||
"iopub.status.idle": "2024-02-18T14:40:45.318368Z",
|
||||
"shell.execute_reply": "2024-02-18T14:40:45.317130Z",
|
||||
"shell.execute_reply.started": "2024-02-18T14:29:01.071512Z"
|
||||
},
|
||||
"papermill": {
|
||||
"duration": null,
|
||||
"end_time": null,
|
||||
"exception": false,
|
||||
"start_time": "2024-02-18T14:50:31.309013",
|
||||
"status": "running"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# @title launch WebUI 启动WebUI\n",
|
||||
"%cd /kaggle/working/GPT-SoVITS/\n",
|
||||
"!npm install -g localtunnel\n",
|
||||
"import subprocess\n",
|
||||
"import threading\n",
|
||||
"import time\n",
|
||||
"import socket\n",
|
||||
"import urllib.request\n",
|
||||
"def iframe_thread(port):\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",
|
||||
"\n",
|
||||
" from colorama import Fore, Style\n",
|
||||
" print (Fore.GREEN + \"\\nIP: \", Fore. RED, urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"), \"\\n\", Style. RESET_ALL)\n",
|
||||
" p = subprocess.Popen([\"lt\", \"--port\", \"{}\".format(port)], stdout=subprocess.PIPE)\n",
|
||||
" for line in p.stdout:\n",
|
||||
" print(line.decode(), end='')\n",
|
||||
"threading.Thread (target=iframe_thread, daemon=True, args=(9874,)).start()\n",
|
||||
"\n",
|
||||
"!python webui.py"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "dda88a6d",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-02-18T14:40:56.880608Z",
|
||||
"iopub.status.busy": "2024-02-18T14:40:56.879879Z"
|
||||
},
|
||||
"papermill": {
|
||||
"duration": null,
|
||||
"end_time": null,
|
||||
"exception": null,
|
||||
"start_time": null,
|
||||
"status": "pending"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# 开启推理页面\n",
|
||||
"%cd /kaggle/working/GPT-SoVITS/\n",
|
||||
"!npm install -g localtunnel\n",
|
||||
"import subprocess\n",
|
||||
"import threading\n",
|
||||
"import time\n",
|
||||
"import socket\n",
|
||||
"import urllib.request\n",
|
||||
"def iframe_thread(port):\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",
|
||||
"\n",
|
||||
" from colorama import Fore, Style\n",
|
||||
" print (Fore.GREEN + \"\\nIP: \", Fore. RED, urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"), \"\\n\", Style. RESET_ALL)\n",
|
||||
" p = subprocess.Popen([\"lt\", \"--port\", \"{}\".format(port)], stdout=subprocess.PIPE)\n",
|
||||
" for line in p.stdout:\n",
|
||||
" print(line.decode(), end='')\n",
|
||||
"threading.Thread (target=iframe_thread, daemon=True, args=(9872,)).start()\n",
|
||||
"\n",
|
||||
"!python ./GPT_SoVITS/inference_webui.py"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kaggle": {
|
||||
"accelerator": "nvidiaTeslaT4",
|
||||
"dataSources": [
|
||||
{
|
||||
"datasetId": 4459328,
|
||||
"sourceId": 7649639,
|
||||
"sourceType": "datasetVersion"
|
||||
}
|
||||
],
|
||||
"dockerImageVersionId": 30646,
|
||||
"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.10.13"
|
||||
},
|
||||
"papermill": {
|
||||
"default_parameters": {},
|
||||
"duration": null,
|
||||
"end_time": null,
|
||||
"environment_variables": {},
|
||||
"exception": null,
|
||||
"input_path": "__notebook__.ipynb",
|
||||
"output_path": "__notebook__.ipynb",
|
||||
"parameters": {},
|
||||
"start_time": "2024-02-18T14:43:44.011910",
|
||||
"version": "2.5.0"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
Loading…
Reference in New Issue