mix1009 / model-keyword

Automatic1111 WEBUI extension to autofill keyword for custom stable diffusion models and LORA models.
MIT License
248 stars 13 forks source link

[Feature Request] Lora support? #24

Closed scruffynerf closed 1 year ago

scruffynerf commented 1 year ago

With Loras gaining massive speed (and small size), they are growing in popularity. Mostly similar to the checkpoint models, they use trigger words... so a hash/trigger word approach would be needed. Pretty much like a middle ground between TIs and Checkpoint models.

Loras only get loaded on prompt start, so either adding them via model keyword (similar to TIs), or detecting they are in prompt as (# is strength, can be floating and more or less than 1)

gitpulled commented 1 year ago

This would be amazing. Could we get this to be a thing? I download Loras and have to keep referencing outside sources from the gui.

axsddlr commented 1 year ago

this would be revolutionary

mix1009 commented 1 year ago

How are you using Lora models? Is it natively supported in webui or do we still need https://github.com/kohya-ss/sd-webui-additional-networks ?

mix1009 commented 1 year ago

https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Features#lora

Looks like it's natively supported :)

scruffynerf commented 1 year ago

lorahashtriggerlist.txt

Here's a jumpstart... hashes v1, trigger, and lora filename... sourced from Civitai json records. Not every lora is there, as some only have hashv2, and I didn't list any with no training words listed.

I'll post code I used to generate this list on a gist/repo later. I have a bunch of lora/TI code to post, including how to identify if a TI or Lora is v1 or v2 (myself, I rename the v2s to avoid confusion)

mix1009 commented 1 year ago

How did you get nsfw contents? The REST API for models only returns nsfw=False without the api key. Could not find any documentation on how to use the api key for REST API.

scruffynerf commented 1 year ago

Most of that is sourced before apikey was added.

We have a script that should work, and I'll get @justmaier of Civitai involved if need be.

mix1009 commented 1 year ago

That would be great. I'm running cron scripts to update the text file.

mix1009 commented 1 year ago

Implemented LORA support. Default database doesn't contain NSFW, but users can add custom mappings.

mix1009 commented 1 year ago

About the AutoV1 hash problem. AutoV1 hashes 64KB starting from 1MB. Even though some hashes are missing from the civitai json, it's really easy to calculate hash without downloading the whole model file. But some LORA models are smaller than 1MB. I'll try to hash the whole file in this case. The workaround shouldn't have side effects since nobody seems to use it now :>

scruffynerf commented 1 year ago

There are hash v2s in Civitai, I just didn't include them because you were not using them. Easily added.

scruffynerf commented 1 year ago

That would be great. I'm running cron scripts to update the text file.

If you msg me or post the cron job script, I'll review and get it working. "API key shouldn’t be necessary unless they’re trying to do user specific stuff like getting favorites or downloading an early access model." is the official answer I got.

scruffynerf commented 1 year ago

"There was a bug in the api after adding the browsing mode changes yesterday. This should be working as expected again now." Try it now. Let me know if you get all of the models you are looking for.

mix1009 commented 1 year ago

Tried it now, but seems civitai.com is down. 502(cloudflare) for website. 503 for api.

I'll try later. Thanks.

mix1009 commented 1 year ago

The API is working and it's returning all LORA models including NSFW.