mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2025-06-08 14:46:14 -04:00
Try to stop the model if it was loaded when ctrl-c received
This commit is contained in:
parent
b38ec0ec38
commit
142c4eb1a6
2 changed files with 8 additions and 0 deletions
|
@ -398,6 +398,7 @@ class LlamaServer:
|
||||||
def stop(self):
|
def stop(self):
|
||||||
"""Stop the server process."""
|
"""Stop the server process."""
|
||||||
if self.process:
|
if self.process:
|
||||||
|
logger.info("Terminating llama-server...")
|
||||||
self.process.terminate()
|
self.process.terminate()
|
||||||
try:
|
try:
|
||||||
self.process.wait(timeout=5)
|
self.process.wait(timeout=5)
|
||||||
|
|
|
@ -60,6 +60,13 @@ from modules.utils import gradio
|
||||||
|
|
||||||
def signal_handler(sig, frame):
|
def signal_handler(sig, frame):
|
||||||
logger.info("Received Ctrl+C. Shutting down Text generation web UI gracefully.")
|
logger.info("Received Ctrl+C. Shutting down Text generation web UI gracefully.")
|
||||||
|
|
||||||
|
# Try to stop the model if loaded
|
||||||
|
try:
|
||||||
|
shared.model.stop()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue