Small changes

This commit is contained in:
oobabooga 2025-06-04 11:11:23 -07:00
parent 142c4eb1a6
commit 20649b9730
2 changed files with 6 additions and 6 deletions

View file

@ -398,7 +398,6 @@ class LlamaServer:
def stop(self):
"""Stop the server process."""
if self.process:
logger.info("Terminating llama-server...")
self.process.terminate()
try:
self.process.wait(timeout=5)

View file

@ -61,11 +61,12 @@ from modules.utils import gradio
def signal_handler(sig, frame):
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
# Explicitly stop LlamaServer to avoid __del__ cleanup issues during shutdown
if shared.model and shared.model.__class__.__name__ == 'LlamaServer':
try:
shared.model.stop()
except:
pass
sys.exit(0)