fix spawning training subprocess for unixes

This commit is contained in:
mrq 2023-02-18 02:40:30 +00:00
parent d5c1433268
commit 650eada8d5
2 changed files with 10 additions and 8 deletions

View File

@ -64,8 +64,7 @@
"!git pull\n", "!git pull\n",
"%cd ..\n", "%cd ..\n",
"!git reset --hard HEAD\n", "!git reset --hard HEAD\n",
"!git pull\n", "!git pull\n"
"!python -m pip install ffmpeg ffmpeg-python"
], ],
"metadata":{ "metadata":{
"id":"3DktoOXSHmtw" "id":"3DktoOXSHmtw"
@ -115,7 +114,6 @@
"cell_type":"code", "cell_type":"code",
"source":[ "source":[
"%cd /content/ai-voice-cloning\n", "%cd /content/ai-voice-cloning\n",
"!python -m venv venv\n",
"!source ./venv/bin/activate\n", "!source ./venv/bin/activate\n",
"\n", "\n",
"import os\n", "import os\n",

View File

@ -432,15 +432,19 @@ import subprocess
training_process = None training_process = None
def run_training(config_path): def run_training(config_path):
try:
print("Unloading TTS to save VRAM.") print("Unloading TTS to save VRAM.")
global tts global tts
del tts del tts
tts = None tts = None
except Exception as e:
pass
global training_process global training_process
torch.multiprocessing.freeze_support() torch.multiprocessing.freeze_support()
cmd = [f'train.{"bat" if args.os == "windows" else "sh"}', config_path] cmd = ['call' '.\\train.bat', config_path] if os.name == "nt" else ['bash', './train.sh', config_path]
print("Spawning process: ", " ".join(cmd)) print("Spawning process: ", " ".join(cmd))
training_process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True) training_process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
buffer=[] buffer=[]