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

View File

@ -432,15 +432,19 @@ import subprocess
training_process = None
def run_training(config_path):
print("Unloading TTS to save VRAM.")
global tts
del tts
tts = None
try:
print("Unloading TTS to save VRAM.")
global tts
del tts
tts = None
except Exception as e:
pass
global training_process
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))
training_process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
buffer=[]