stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

Extra network description files

Open akx opened this issue 1 year ago • 2 comments

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 avatar Mar 06 '23 19:03 akx

Related: https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/7953

catboxanon avatar Mar 07 '23 07:03 catboxanon

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.

MrKuenning avatar Mar 08 '23 09:03 MrKuenning

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 avatar Mar 11 '23 10:03 AUTOMATIC1111

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! 👍

akx avatar Mar 11 '23 14:03 akx

[...] 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! :)

schumar avatar Mar 11 '23 15:03 schumar

I did this in here https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/7458 In a very bad way but hey, it works on my local atm. it sets the weight and adds to the positive prompt

WesleyNery avatar Mar 13 '23 10:03 WesleyNery