2023-02-17 00:08:27 +00:00
|
|
|
{
|
|
|
|
"nbformat":4,
|
|
|
|
"nbformat_minor":0,
|
|
|
|
"metadata":{
|
|
|
|
"colab":{
|
2023-02-18 16:30:05 +00:00
|
|
|
"private_outputs":true,
|
|
|
|
"provenance":[
|
|
|
|
|
|
|
|
]
|
2023-02-17 00:08:27 +00:00
|
|
|
},
|
|
|
|
"kernelspec":{
|
|
|
|
"name":"python3",
|
|
|
|
"display_name":"Python 3"
|
|
|
|
},
|
|
|
|
"language_info":{
|
|
|
|
"name":"python"
|
|
|
|
},
|
|
|
|
"accelerator":"GPU",
|
|
|
|
"gpuClass":"standard"
|
|
|
|
},
|
|
|
|
"cells":[
|
|
|
|
{
|
|
|
|
"cell_type":"markdown",
|
|
|
|
"source":[
|
|
|
|
"## Initialization"
|
|
|
|
],
|
|
|
|
"metadata":{
|
|
|
|
"id":"ni41hmE03DL6"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type":"code",
|
|
|
|
"execution_count":null,
|
|
|
|
"metadata":{
|
|
|
|
"id":"FtsMKKfH18iM"
|
|
|
|
},
|
|
|
|
"outputs":[
|
|
|
|
|
|
|
|
],
|
|
|
|
"source":[
|
|
|
|
"!git clone https://git.ecker.tech/mrq/ai-voice-cloning/\n",
|
|
|
|
"%cd ai-voice-cloning\n",
|
2023-02-19 07:22:22 +00:00
|
|
|
"\n",
|
2023-02-20 22:56:39 +00:00
|
|
|
"!git submodule init\n",
|
2023-02-24 16:23:30 +00:00
|
|
|
"!git submodule update --remote\n",
|
2023-02-20 22:56:39 +00:00
|
|
|
"\n",
|
2023-02-18 16:30:05 +00:00
|
|
|
"# TODO: fix venvs working for subprocess.Popen calling a bash script\n",
|
2023-02-18 03:31:44 +00:00
|
|
|
"#!apt install python3.8-venv\n",
|
|
|
|
"#!python -m venv venv\n",
|
|
|
|
"#!source ./venv/bin/activate\n",
|
2023-02-19 07:22:22 +00:00
|
|
|
"\n",
|
2023-02-17 00:08:27 +00:00
|
|
|
"!python -m pip install --upgrade pip\n",
|
|
|
|
"!pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116\n",
|
2023-02-20 22:56:39 +00:00
|
|
|
"!python -m pip install -r ./dlas/requirements.txt\n",
|
|
|
|
"!python -m pip install -r ./tortoise-tts/requirements.txt\n",
|
|
|
|
"!python -m pip install -r ./requirements.txt\n",
|
2023-02-20 23:12:53 +00:00
|
|
|
"!python -m pip install -e ./tortoise-tts/\n",
|
|
|
|
"\n",
|
|
|
|
"!rm ./tortoise-tts/{main,webui}.py"
|
2023-02-17 00:08:27 +00:00
|
|
|
]
|
|
|
|
},
|
2023-02-17 20:18:57 +00:00
|
|
|
{
|
|
|
|
"cell_type":"markdown",
|
|
|
|
"source":[
|
2023-02-18 02:07:22 +00:00
|
|
|
"# Update Repos"
|
2023-02-17 20:18:57 +00:00
|
|
|
],
|
|
|
|
"metadata":{
|
2023-02-18 02:07:22 +00:00
|
|
|
"id":"IzrGt5IcHlAD"
|
2023-02-17 20:18:57 +00:00
|
|
|
}
|
|
|
|
},
|
2023-02-17 00:08:27 +00:00
|
|
|
{
|
|
|
|
"cell_type":"code",
|
|
|
|
"source":[
|
2023-02-18 16:30:05 +00:00
|
|
|
"# for my debugging purposes\n",
|
2023-02-20 22:56:39 +00:00
|
|
|
"%cd /content/ai-voice-cloning/\n",
|
2023-02-20 23:12:53 +00:00
|
|
|
"!./update.sh"
|
2023-02-17 00:08:27 +00:00
|
|
|
],
|
|
|
|
"metadata":{
|
2023-02-18 02:07:22 +00:00
|
|
|
"id":"3DktoOXSHmtw"
|
2023-02-17 00:08:27 +00:00
|
|
|
},
|
|
|
|
"execution_count":null,
|
|
|
|
"outputs":[
|
|
|
|
|
|
|
|
]
|
|
|
|
},
|
2023-02-18 02:07:22 +00:00
|
|
|
{
|
|
|
|
"cell_type":"markdown",
|
|
|
|
"source":[
|
|
|
|
"# Mount Drive"
|
|
|
|
],
|
|
|
|
"metadata":{
|
|
|
|
"id":"2Y4t9zDIZMTg"
|
|
|
|
}
|
|
|
|
},
|
2023-02-17 20:18:57 +00:00
|
|
|
{
|
|
|
|
"cell_type":"code",
|
|
|
|
"source":[
|
2023-02-18 16:30:05 +00:00
|
|
|
"# only run once, this will save all userdata to your Drive\n",
|
2023-02-22 15:45:41 +00:00
|
|
|
"# it shouldn't delete through symlinks, but you never know\n",
|
|
|
|
"\n",
|
2023-02-17 20:18:57 +00:00
|
|
|
"from google.colab import drive\n",
|
2023-02-18 02:07:22 +00:00
|
|
|
"\n",
|
|
|
|
"%cd /content/ai-voice-cloning\n",
|
2023-02-22 15:45:41 +00:00
|
|
|
"drive.flush_and_unmount()\n",
|
|
|
|
"!rm -r ./{training,results,voices,config}\n",
|
|
|
|
"drive.mount('/content/drive')\n",
|
|
|
|
"!mkdir /content/drive/MyDrive/ai-voice-cloning/\n",
|
|
|
|
"!mv /content/drive/MyDrive/{training,results,voices,config} /content/drive/MyDrive/ai-voice-cloning\n",
|
|
|
|
"!mkdir /content/drive/MyDrive/ai-voice-cloning/{training,results,voices,config}\n",
|
2023-02-24 16:23:30 +00:00
|
|
|
"!ln -s /content/drive/MyDrive/ai-voice-cloning/{training,results,voices,config} ./"
|
2023-02-17 20:18:57 +00:00
|
|
|
],
|
|
|
|
"metadata":{
|
|
|
|
"id":"SGt9gyvubveT"
|
|
|
|
},
|
|
|
|
"execution_count":null,
|
|
|
|
"outputs":[
|
|
|
|
|
|
|
|
]
|
|
|
|
},
|
2023-02-17 00:08:27 +00:00
|
|
|
{
|
|
|
|
"cell_type":"markdown",
|
|
|
|
"source":[
|
2023-02-20 23:12:53 +00:00
|
|
|
"## Running (Inlined)"
|
2023-02-17 00:08:27 +00:00
|
|
|
],
|
|
|
|
"metadata":{
|
|
|
|
"id":"o1gkfw3B3JSk"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type":"code",
|
|
|
|
"source":[
|
2023-02-17 03:30:53 +00:00
|
|
|
"%cd /content/ai-voice-cloning\n",
|
2023-02-18 03:31:44 +00:00
|
|
|
"#!source ./venv/bin/activate\n",
|
2023-02-17 03:30:53 +00:00
|
|
|
"\n",
|
|
|
|
"import os\n",
|
2023-02-17 00:08:27 +00:00
|
|
|
"import sys\n",
|
2023-02-17 03:30:53 +00:00
|
|
|
"\n",
|
2023-02-17 00:08:27 +00:00
|
|
|
"sys.argv = [\"\"]\n",
|
2023-02-20 23:12:53 +00:00
|
|
|
"if './src/' not in sys.path:\n",
|
|
|
|
"\tsys.path.append('./src/')\n",
|
|
|
|
"if './tortoise-tts/' not in sys.path:\n",
|
|
|
|
"\tsys.path.append('./tortoise-tts/')\n",
|
2023-02-17 03:30:53 +00:00
|
|
|
"\n",
|
|
|
|
"if 'TORTOISE_MODELS_DIR' not in os.environ:\n",
|
|
|
|
"\tos.environ['TORTOISE_MODELS_DIR'] = os.path.realpath(os.path.join(os.getcwd(), './models/tortoise/'))\n",
|
|
|
|
"\n",
|
|
|
|
"if 'TRANSFORMERS_CACHE' not in os.environ:\n",
|
|
|
|
"\tos.environ['TRANSFORMERS_CACHE'] = os.path.realpath(os.path.join(os.getcwd(), './models/transformers/'))\n",
|
|
|
|
"\n",
|
2023-02-20 23:12:53 +00:00
|
|
|
"import utils\n",
|
|
|
|
"import webui\n",
|
2023-02-17 00:08:27 +00:00
|
|
|
"\n",
|
2023-02-20 23:12:53 +00:00
|
|
|
"args = utils.setup_args()\n",
|
|
|
|
"ui = webui.setup_gradio()\n",
|
2023-02-18 16:30:05 +00:00
|
|
|
"# Be very, very sure to check \"Defer TTS Load\" in Settings, then restart, before you start training\n",
|
|
|
|
"# You'll crash the runtime if you don't\n",
|
|
|
|
"if not args.defer_tts_load:\n",
|
2023-02-20 23:12:53 +00:00
|
|
|
"\tutils.setup_tortoise()\n",
|
|
|
|
"\n",
|
|
|
|
"ui.launch(share=True, prevent_thread_lock=True, height=1000)\n",
|
|
|
|
"ui.block_thread()"
|
2023-02-17 00:08:27 +00:00
|
|
|
],
|
|
|
|
"metadata":{
|
|
|
|
"id":"c_EQZLTA19c7"
|
|
|
|
},
|
2023-02-17 20:18:57 +00:00
|
|
|
"execution_count":null,
|
|
|
|
"outputs":[
|
|
|
|
|
|
|
|
]
|
|
|
|
},
|
2023-02-20 23:12:53 +00:00
|
|
|
{
|
|
|
|
"cell_type":"markdown",
|
|
|
|
"source":[
|
|
|
|
"## Running (non-inlined)"
|
|
|
|
],
|
|
|
|
"metadata":{
|
|
|
|
"id":"EM3iNqgJF6Be"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type":"code",
|
|
|
|
"source":[
|
|
|
|
"%cd /content/ai-voice-cloning/\n",
|
|
|
|
"!./start.sh"
|
|
|
|
],
|
|
|
|
"metadata":{
|
|
|
|
"id":"QRA8jF3cF-YJ"
|
|
|
|
},
|
|
|
|
"execution_count":null,
|
|
|
|
"outputs":[
|
|
|
|
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type":"markdown",
|
|
|
|
"source":[
|
|
|
|
"# Restart Runtime"
|
|
|
|
],
|
|
|
|
"metadata":{
|
|
|
|
"id":"vH9KU7SMGDxb"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type":"code",
|
|
|
|
"source":[
|
|
|
|
"!rm ./tortoise-tts/{main,webui}.py\n",
|
|
|
|
"exit()"
|
|
|
|
],
|
|
|
|
"metadata":{
|
|
|
|
"id":"EWeyUPvgGDX5"
|
|
|
|
},
|
|
|
|
"execution_count":null,
|
|
|
|
"outputs":[
|
|
|
|
|
|
|
|
]
|
|
|
|
},
|
2023-02-17 20:18:57 +00:00
|
|
|
{
|
|
|
|
"cell_type":"markdown",
|
|
|
|
"source":[
|
|
|
|
"# Fallback Training"
|
|
|
|
],
|
|
|
|
"metadata":{
|
|
|
|
"id":"ggLY9A9KA21D"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type":"code",
|
|
|
|
"source":[
|
2023-02-18 02:07:22 +00:00
|
|
|
"# This is in case you can't get training through the web UI\n",
|
2023-02-17 20:18:57 +00:00
|
|
|
"%cd /content/ai-voice-cloning\n",
|
2023-02-18 02:07:22 +00:00
|
|
|
"!python ./dlas/codes/train.py -opt ./training/finetune.yaml"
|
2023-02-17 20:18:57 +00:00
|
|
|
],
|
|
|
|
"metadata":{
|
|
|
|
"id":"-KayB8klA5tY"
|
|
|
|
},
|
2023-02-17 00:08:27 +00:00
|
|
|
"execution_count":null,
|
|
|
|
"outputs":[
|
|
|
|
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type":"markdown",
|
|
|
|
"source":[
|
|
|
|
"## Exporting"
|
|
|
|
],
|
|
|
|
"metadata":{
|
|
|
|
"id":"2AnVQxEJx47p"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type":"code",
|
|
|
|
"source":[
|
2023-02-22 15:45:41 +00:00
|
|
|
"# if you're not using drive mounting\n",
|
2023-02-17 03:30:53 +00:00
|
|
|
"%cd /content/ai-voice-cloning\n",
|
2023-02-17 00:08:27 +00:00
|
|
|
"!apt install -y p7zip-full\n",
|
|
|
|
"from datetime import datetime\n",
|
|
|
|
"timestamp = datetime.now().strftime('%m-%d-%Y_%H:%M:%S')\n",
|
2023-02-18 02:07:22 +00:00
|
|
|
"!mkdir -p \"../{timestamp}/results\"\n",
|
|
|
|
"!mv ./results/* \"../{timestamp}/results/.\"\n",
|
|
|
|
"!mv ./training/* \"../{timestamp}/training/.\"\n",
|
2023-02-17 00:08:27 +00:00
|
|
|
"!7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on \"../{timestamp}.7z\" \"../{timestamp}/\"\n",
|
|
|
|
"!ls ~/\n",
|
|
|
|
"!echo \"Finished zipping, archive is available at {timestamp}.7z\""
|
|
|
|
],
|
|
|
|
"metadata":{
|
|
|
|
"id":"YOACiDCXx72G"
|
|
|
|
},
|
|
|
|
"execution_count":null,
|
|
|
|
"outputs":[
|
|
|
|
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|