Skip to content

Commit

Permalink
Merge pull request #331 from Haidra-Org/main
Browse files Browse the repository at this point in the history
fix: don't abandon job on bad lora file
  • Loading branch information
tazlin authored Sep 17, 2024
2 parents f2ce9f3 + ba9456e commit e33736f
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions hordelib/nodes/node_lora_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def load_lora(self, model, clip, lora_name, strength_model, strength_clip):
return (model, clip)

lora_path = folder_paths.get_full_path("loras", lora_name)

lora = None
if self.loaded_lora is not None:
if self.loaded_lora[0] == lora_path:
Expand All @@ -69,13 +68,18 @@ def load_lora(self, model, clip, lora_name, strength_model, strength_clip):
self.loaded_lora = None
del temp

if lora is None:
lora = comfy.utils.load_torch_file(lora_path, safe_load=True)
self.loaded_lora = (lora_path, lora)

model_lora, clip_lora = comfy.sd.load_lora_for_models(model, clip, lora, strength_model, strength_clip)
log_free_ram()
return (model_lora, clip_lora)
try:
with logger.catch(reraise=True):
if lora is None:
lora = comfy.utils.load_torch_file(lora_path, safe_load=True)
self.loaded_lora = (lora_path, lora)

model_lora, clip_lora = comfy.sd.load_lora_for_models(model, clip, lora, strength_model, strength_clip)
log_free_ram()
return (model_lora, clip_lora)
except Exception as e:
logger.error(f"Error loading lora {lora_name}: {e}")
return (model, clip)


NODE_CLASS_MAPPINGS = {"HordeLoraLoader": HordeLoraLoader}

0 comments on commit e33736f

Please sign in to comment.