Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add description support for extra networks #7953

Closed
wants to merge 1 commit into from

Conversation

heyhippari
Copy link

@heyhippari heyhippari commented Feb 20, 2023

Describe what this pull request is trying to achieve.

Adds support for descriptions in the Extra Networks section, shown as a tooltip when hovering the model. These live alongside the model.preview.png files and follow generally the same idea, except they're named model.description.txt.

The goal is to allow users to keep easily visible notes alongside their models, for example related prompts.

Models without a description will simply omit the tooltip.

For consistency, I also unified the way preview images are handled, in regards to filenames (Textual Inversions had a slightly different behavior, which could be confusing for users)

Additional notes and description of your changes

None, it's pretty straightforward.

Environment this was tested in

  • OS: Windows
  • Browser: Firefox 110
  • Graphics card: NVIDIA RTX2070

Screenshots or videos of your changes

image

@space-nuko
Copy link
Contributor

space-nuko commented Feb 22, 2023

Just so you're aware if the models are trained with https://github.com/kohya-ss/sd-scripts in safetensors format they can contain some metadata, the full list is here

https://github.com/kohya-ss/sd-scripts/blob/08ae46b16345274b52b07615b93d75fb1ffed6c6/train_network.py#L332

And users can attach the description to the same metadata

https://github.com/kohya-ss/sd-webui-additional-networks/blob/822f2136fa6d63b85663597b03ef3edafab01187/scripts/metadata_editor.py#L297

@MrKuenning
Copy link

MrKuenning commented Feb 22, 2023

Other uses for the TXT file could be:

  • Setting the multiplier level per LoRA.
    The web UI lets you set a default level, but being able to specify when I click "X" LoRA use 0.9 and when I click "Y" LoRA use level 0.3

  • Setting a default prompt / keyword for a LoRA.
    So when you click on it, not only do you get the but you also get the keyword with it.

The end result, you could have a LoRA called FlatColors. When you mouse over it, you get a description of the style.
When you click on it it would add <lora:Flat Color:0.8> flat_color to the prompt.

Currently, I am using the styles list to do this, as I have about 200 LoRAs and I have all of them in the styles list with the correct level and keyword. But if you could store all of that in a text file next to the LoRA or hypernetwork, that would be better.

@space-nuko
Copy link
Contributor

You can also store the keywords in the ssmd_keywords field of the .safetensors metadata with additional_networks

@ClashSAN
Copy link
Collaborator

@space-nuko that seems like the better standard, for LoRAs.

Textual inversion - already looks like it can be made all-in-one https://github.com/dfaker/embedding-to-png-script (I have not seen a .safetensors embeddings before?)

then if hypernetworks and models can already store metadata we could be using that instead..

@heyhippari
Copy link
Author

I think there could be room for both approaches, potentially. Though there doesn't seem to be a standard on what the ss_training_comment field contains, so people could potentially use it to put credit, version info, a full description or whatever. If we were sure it was used for trigger words, we could add a "Copy triggers to clipboard" button on the card (That was my main reason for making this PR, since I keep forgetting which keywords are associated with the models I download or train).

I initially chose this solution because it leaves more control to the user, it works with every format and it mirrors how the preview images work.

Furthermore, the sd-civitai-browser extension already saves .txt of the description when downloading models, which now shows up as a tooltip, giving more information if needed.

@FullBleed
Copy link

Textual inversion - already looks like it can be made all-in-one https://github.com/dfaker/embedding-to-png-script (I have not seen a .safetensors embeddings before?)

Is there some reason people aren't using the .safetensor format for embeddings? Is it not supported?

@space-nuko
Copy link
Contributor

I guess because it's just not what the embeddings trainer outputs and there was already a self-contained PNG format for embeds

@AUTOMATIC1111
Copy link
Owner

I merged another PR that did this feature so I'm closing this one.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants