AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
136.31k stars 25.97k forks source link

[Feature Request]: Custom Names for LoRAs (Checkpoints, TIs, etc) #13217

Open Exodius opened 10 months ago

Exodius commented 10 months ago

Is there an existing issue for this?

What would your feature do ?

I'd like to propose an option in "Edit Metadata" to allow us to add custom names for the LoRAs (and Checkpoints, TIs, etc) and an option to sort them by Custom Names. Those names should be stored along with all other info inside the .json file that is located next to the .safetensors file.

Main issue is that there are no unified guidelines that people would/should follow when it comes to the names of the "models". There are no rules that state: If you are gonna make a Clothing LoRA, prefix must be Clothing or however else is agreed upon. Or, you are training an Artstyle, filename must be "Artist_NAME".

All of this is affected at the entry point when LoRA is set to be trained in the settings. Everybody is naming their LoRAs however they want and names are pretty inconsistent and, in some cases, do not have anything to do with the LoRA in question.

It could be a Clothing Lora, trying to replicate a certain style of Wedding Dress but the filename and it's trigger/bracket could be something else, like ... Totally unrelated.

I am trying to incorporate SD into my Image Editing and when I want to inpaint something and open the LoRA tab but can't remember how a certain Clothing piece is called, it's a wreck. Luckily for me, it eases up the search the fact that I usually download an original preview from the LoRA page.

Now, as we all know, there are LoRAs that are triggered by a certain phrase, regardless of the these are usually Artstyle LoRAs that are trying to mimic an artist. There are no additional trigger words besides the angle brackets.

There are LoRAs, like the one I just linked, that will work regardless of how you rename the original file. Example: Hatsune Miku Magical Mirai 2023 but when you download the model, it is named 1658378037724213726.safetensors. If you keep it like that, all numbers and bunch, it will be added as such to the prompt. If you rename the original file to Hatsune.safetensors it will be added to the prompt as and it will still work.

There are LoRAs, like the newest Poison Ivy LoRA. Original File PoisonIvy-10.safetensors and regardless of how you rename the original file, added prompt will always be .

Initially, I tried organizing my LoRA folder by custom names, assigned by me on download. Artstyles would have a prefix "Artist - Name", Clothing would have a prefix "Clothing - Name of the dress", etc. But I've noticed that some LoRAs get broken and stop functioning when you rename the original file name and don't obey the rules of previous two examples that I've mentioned. For the life of me, I can't remember which ones did break. It's been a while since I tried that.

It's like an OCD for me to have things organized the certain way and when I open my LoRA tab, I'd like them sorted by cathegories, and by that, I mean custom names that can be assigned by us.

Am I making any sense? :)

Proposed workflow

  1. Go to Lora/Checkpoint/TI/Hypernetworks
  2. Press "Edit Metadata" button
  3. Assign custom name for the Lora/Checkpoint/TI/Hypernetworks
  4. Add the option to sort LoRAs by those custom names.

Additional information

No response

missionfloyd commented 10 months ago

There are LoRAs, like the newest Poison Ivy LoRA. Original File PoisonIvy-10.safetensors and regardless of how you rename the original file, added prompt will always be lora:PoisonIvy:1.

You can change this in Settings > Extra Networks image

Exodius commented 10 months ago

You can change this in Settings > Extra Networks image

Thanks for this info. I didn't dig TOO deep into the settings.

RedFoxNightfox commented 3 months ago

I too wish for this feature to exist. renaming the files can cause issues with some extensions.

RedFoxNightfox commented 3 months ago

Civitai Browser+ can even show what the name of the model/lora is, but the file names are sometimes lacking and changing the file names means going into the folder, finding the lora, and changing the name. When you have many loras, this becomes tedious.

image

As you can see, if this extension can display the name of the lora, It should be a reasonable thought that we could keep that name in the metadata of the model card, without having to manually change the file names.