From 7c5ecb069a01b60949df7aeac0274d8fe08dfd9f Mon Sep 17 00:00:00 2001 From: "Aaron C. de Bruyn" Date: Sun, 18 Feb 2024 10:13:31 -0800 Subject: [PATCH] Catch crash due to invalid float --- gpl3/__init__.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/gpl3/__init__.py b/gpl3/__init__.py index 31e903c..9074f11 100644 --- a/gpl3/__init__.py +++ b/gpl3/__init__.py @@ -89,12 +89,18 @@ class DarkLoraTagLoader: lora = comfy.utils.load_torch_file(lora_path, safe_load=True) self.loaded_lora = (lora_path, lora) - strength_model = float(wModel) - strength_clip = float(wClip) - model_lora, clip_lora = comfy.sd.load_lora_for_models( - model_lora, clip_lora, lora, strength_model, strength_clip - ) - lora_stack.extend([(lora_name, strength_model, strength_clip)]) + try: + strength_model = float(wModel) + strength_clip = float(wClip) + model_lora, clip_lora = comfy.sd.load_lora_for_models( + model_lora, clip_lora, lora, strength_model, strength_clip + ) + lora_stack.extend([(lora_name, strength_model, strength_clip)]) + except ValueError: + print( + "Unable to load LoRA %s due to invalid floats: %s and %s" + % (lora_name, wModel, wClip) + ) plain_prompt = re.sub(self.tag_pattern, "", text) return (