From 9d2c7fb942a3aada9625810d7a1f386c2bda3f29 Mon Sep 17 00:00:00 2001 From: mrq Date: Tue, 14 Mar 2023 16:23:29 +0000 Subject: [PATCH] cleanup --- src/utils.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/utils.py b/src/utils.py index 7e1fe9b..0b8a282 100755 --- a/src/utils.py +++ b/src/utils.py @@ -1048,15 +1048,19 @@ def stop_training(): training_state.killed = True children = [] - # wrapped in a try/catch in case for some reason this fails outside of Linux - try: - children = [p.info for p in psutil.process_iter(attrs=['pid', 'name', 'cmdline']) if './src/train.py' in p.info['cmdline']] - except Exception as e: - pass + if args.tts_backend == "tortoise": + # wrapped in a try/catch in case for some reason this fails outside of Linux + try: + children = [p.info for p in psutil.process_iter(attrs=['pid', 'name', 'cmdline']) if './src/train.py' in p.info['cmdline']] + except Exception as e: + pass + + training_state.process.stdout.close() + training_state.process.terminate() + training_state.process.kill() + elif args.tts_backend == "vall-e": + print(training_state.process.communicate(input='quit')[0]) - training_state.process.stdout.close() - training_state.process.terminate() - training_state.process.kill() return_code = training_state.process.wait() for p in children: