Check model existence before unloading

Add a check to ensure model exists before unloading.
This commit is contained in:
McCloudS
2026-01-07 17:17:11 -05:00
parent 948d44ca66
commit 11cca018ae

View File

@@ -1,4 +1,4 @@
subgen_version = '2026.01.3' subgen_version = '2026.01.4'
""" """
ENVIRONMENT VARIABLES DOCUMENTATION ENVIRONMENT VARIABLES DOCUMENTATION
@@ -797,9 +797,10 @@ def delete_model():
global model global model
if clear_vram_on_complete and task_queue.is_idle(): if clear_vram_on_complete and task_queue.is_idle():
logging.debug("Queue idle; clearing model from memory.") logging.debug("Queue idle; clearing model from memory.")
model.model.unload_model() if model:
del model model.model.unload_model()
model = None del model
model = None
if transcribe_device.lower() == 'cuda' and torch.cuda.is_available(): if transcribe_device.lower() == 'cuda' and torch.cuda.is_available():
torch.cuda.empty_cache() torch.cuda.empty_cache()
logging.debug("CUDA cache cleared.") logging.debug("CUDA cache cleared.")