From 668dfeb02d93bd64045daa0fa0879d97999f6925 Mon Sep 17 00:00:00 2001 From: db0 Date: Thu, 26 Sep 2024 16:42:12 +0200 Subject: [PATCH] fix: avoid crashing when lora to delete is missing --- hordelib/model_manager/lora.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hordelib/model_manager/lora.py b/hordelib/model_manager/lora.py index b3fdcc4..8ce08fc 100644 --- a/hordelib/model_manager/lora.py +++ b/hordelib/model_manager/lora.py @@ -949,7 +949,10 @@ def delete_unused_loras(self, timeout=0): time.sleep(0.2) loras_to_delete = self.find_unused_loras() for lora_filename in loras_to_delete: - self.delete_lora_files(lora_filename) + try: + self.delete_lora_files(lora_filename) + except FileNotFoundError: + logger.warning(f"Expected to delete lora file {lora_filename} but it was not found.") return loras_to_delete def delete_lora_files(self, lora_filename: str):