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

Extra network description files #8366

Merged
merged 2 commits into from
Mar 11, 2023

Conversation

akx
Copy link
Collaborator

@akx akx commented Mar 6, 2023

This pull request adds support for description files for extra networks; for example, some LoRAs activate (better) with a given keyword, which may not be obvious from the LoRA's filename, so this allows for jotting notes down into a .txt (or .description.txt) file next to the model file, following how preview PNGs work.

Environment this was tested in

  • OS: Windows
  • Browser: Chrome
  • Graphics card: Irrelevant

Screenshots or videos of your changes

The UI shows up to three lines of the file to begin with, and all of it when hovering over the description.

Default:
card-desc

Hover:
card-hover

No description (as before):
image

@akx akx requested a review from AUTOMATIC1111 as a code owner March 6, 2023 19:21
@catboxanon
Copy link
Collaborator

Related: #7953

@MrKuenning
Copy link

A lot of people are on a similar path here.
This extension also adds information and buttons to the network models.
https://github.com/butaixianran/Stable-Diffusion-Webui-Civitai-Helper

What I would love to see is an extension that creates a metadata file next to each model.

That we could store the:

  • Title
  • Description
  • Recommended Weight
  • Trigger Phrase - prompt to go with the model
  • URL
  • Maybe? Example Prompt

Then when you mouse over the model you would see a description.
Clicking on the model would put not only the model tag, but also the recommended weight value and the trigger phrase.

For example, if I clicked on a Mazda Miata LoRA, rather than just adding <lora:Mazda Miata:1> to the prompt,

it would put <lora:Mazda Miata:0.6>, MazdaMiata, 1car

The metadata files should be universal, such as JSON or XML. Easy to edit manually. But there should also be an edit icon in the UI on the model to edit the fields.

Additionally, it would be nice to have it scrape starting metadata from sites like Civitai to pull the initial values, which could then be modified.

I find the default weight of 1 and recommended trigger words are almost never enough on their own to get a good result. I have been manually adding every single LoRA, TI, and Hyper to my Styles CSV list to have it fill in the best weight, and trigger phrase combo. This works, but is annoying as it requires me to double my efforts. It would be great to be able to specify the values that I want for each model.

@AUTOMATIC1111
Copy link
Owner

What's the reason for using @lru_cache for texts? Wouldn't this make them not update after you add/edit the text file?

@AUTOMATIC1111 AUTOMATIC1111 merged commit c239b3d into AUTOMATIC1111:master Mar 11, 2023
AUTOMATIC1111 added a commit that referenced this pull request Mar 11, 2023
remove LRU from #8366 because I don't know why it's there
@akx
Copy link
Collaborator Author

akx commented Mar 11, 2023

What's the reason for using @lru_cache for texts? Wouldn't this make them not update after you add/edit the text file?

Yep, it would, but I figured that's less of a problem than reading them from disk very often :)

Thanks for the merge! 👍

@schumar
Copy link

schumar commented Mar 11, 2023

[...]
What I would love to see is an extension that creates a metadata file next to each model.

Same, that's why I opened #8029.

[...]
The metadata files should be universal, such as JSON or XML.

I went with YAML (easiest to edit, and if you insist on using JSON, you can, because every JSON is also valid YAML)

[...]
Additionally, it would be nice to have it scrape starting metadata from sites like Civitai to pull the initial values, which could then be modified.

My current fork also contains 2 scripts, retrieve_civitai.pl to fetch the JSON which civitai uses, and json2yaml.pl which, for a given model file, searches those JSONs for the correct one, and extracts some information (title, example prompts,...) into a YAML, and downloads the .preview.png.

Yes, sorry, Perl, and ugly code, because I mostly wrote it for my own use -- I can also write really pretty and readable Perl code too, I swear! :)

@WesleyNery
Copy link

I did this in here #7458 In a very bad way but hey, it works on my local atm. it sets the weight and adds to the positive prompt

serg4kostiuk pushed a commit to talkable/stable-diffusion-webui that referenced this pull request Mar 22, 2023
serg4kostiuk pushed a commit to talkable/stable-diffusion-webui that referenced this pull request Mar 22, 2023
remove LRU from AUTOMATIC1111#8366 because I don't know why it's there
@akx akx deleted the extra-net-descs branch June 13, 2023 09:30
# 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