SwarmUI icon indicating copy to clipboard operation
SwarmUI copied to clipboard

Missing Lora Finder

Open Cyph3r opened this issue 1 year ago • 0 comments

Feature Idea

As an avid user with many LoRAs, and a desire to keep them organized - especially with your new "Rename Model" feature - I often find that I wish to "reuse parameters" from a previous generation, make changes, and generate. Often it occurs that I've renamed or reorganized several Loras into new folders and I get the dreaded: Image When using 8+ Loras, this can become cumbersome.

Suggestion:

  1. On Generate click, if error would be produced, first do a scan for each invalid Lora, based on Lora ID or hash. (it looks like you're already doing a loop through the loras, and identifying each that is missing/invalid, and that's where you'd look for it's new location.)
  2. For each invalid/missing Lora found, update the "Current LoRAs" Lora to show and use the correct path/name.
  3. If all is well, generate as normal, else pass to the same error that already presents itself in this condition (image above).

Psuedocode:

def onGenerate(...):
    ...
    for lora in loras_selected:
        if settings.is_enabled(lora_finder):
            new_lora_location = find_missing_lora(lora)
            
            if new_lora_location:
                update_lora_info(lora, new_lora_location)
            else:
                # Append error message if no new location is found
                error_message += f"{lora.FullPath}"
    ...

Other

Add a toggle for this feature in settings.

Optionally: Update the found Loras in the old image metadata.

Cyph3r avatar Feb 06 '25 20:02 Cyph3r