Catch crash due to invalid float

This commit is contained in:
Aaron C. de Bruyn
2024-02-18 10:13:31 -08:00
parent 2ad81e8410
commit 7c5ecb069a
+12 -6
View File
@@ -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 (