Skip to content

Commit 431f992

Browse files
committed
fixing stop button
1 parent f2ad3c6 commit 431f992

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

run_trainer.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,15 @@ def run(self, config: Config, finetrainers_path: str, log_file: str):
9494
return "Unknown result"
9595

9696
def stop(self):
97-
self.running = False
98-
if self.process:
99-
self.process.terminate()
100-
time.sleep(3)
101-
if self.process.poll() is None:
102-
self.process.kill()
103-
return "Training stopped"
97+
try:
98+
self.running = False
99+
if self.process:
100+
self.process.terminate()
101+
time.sleep(3)
102+
if self.process.poll() is None:
103+
self.process.kill()
104+
except Exception as e:
105+
return f"Error stopping training: {e}"
106+
finally:
107+
self.process.wait()
108+
return "Training forcibly stopped"

0 commit comments

Comments
 (0)