lllyasviel / Fooocus

Focus on prompting and generating
GNU General Public License v3.0
41.31k stars 5.84k forks source link

LORA preview as in styles #2029

Open Nicolayka opened 9 months ago

Nicolayka commented 9 months ago

Is it possible to pre-order (image) LORA the way it is done in mouse-over styles? Only the image should be taken from the site. I ask you to do this, because you do not remember all the styles of LORA, and every time you have to go to the site for information

eddyizm commented 9 months ago

This is a pretty good idea. In fact, It would be nice if there we could use the api to get information about the Lora, such as trigger words and ideal settings as that seems to be to be what is harder to remember. I have to stash that info in my notes. Thanks for suggesting it!

Thorian commented 9 months ago

In this it would be nice to force trigger a Lora (if not directly possible by adding the trigger words in the back to the command)

MindOfMatter commented 9 months ago

I started a code to do with pycivitai

but it become too complex to know after already downloaded model

also we need to do multiple research because it not find easily the model downloaded (also you may rename it)

I will try instead in my side to create the preview from last generated image attempt

so it will be more easily to update the preview from your last previous render

it will may generate the preview if only it was the one enabled (no conflict and make clean to undersand)

(except for SD checkpoints need to have base model with the refiner. so if it not defined, it will use by default the refiner one, if the preview is base, so overwrite it)

also this way you find the one that really work with the setup

(for lora it should be the only one enabled to update it)

the easiest first implementation will be to create a json (preview.json) in model folder (checkpoints an loras) in question that refer to output last attempt

preview.json :

"filename" : "preview output folder last location (png date image like in log)"

for the first version maybe you will need to restart app to affect change

so in the UI it will use the path output to preview it (like in log history)

I will use my custom tester feature to help me to fill the preview images https://github.com/lllyasviel/Fooocus/issues/2048

MindOfMatter commented 9 months ago

I will try something like that first (will add last date the new attempt to preview)

models\checkpoints\preview_log.json (same for loras)

{
    "juggernautXL_v8Rundiffusion.safetensors" : [
        "2024-01-20/2024-01-20_23-58-57_8208.png",
        "2024-01-21/2024-01-21_23-58-57_8208.png",
        "2024-01-22/2024-01-22_23-58-57_8208.png"
    ]
}

at app start, it cleanup outputs removed in the json (not exist image anymore) i find the latest (or oldest) one

it load it in the ui as model preview

when creating log it will also append the new concerned preview in json file

if no image peview display as tooltip all the filename by default

MindOfMatter commented 9 months ago

locally, I set up the feature (preview based on last single attempt)

Sans titre
MindOfMatter commented 9 months ago

Hi

I just created a fork fooocus project version just synced with the original project in main branch https://github.com/MindOfMatter/Fooocus-MindOfMatter-Edition

I created a pr in my fork project to show what we need to change to enable the feature

https://github.com/MindOfMatter/Fooocus-MindOfMatter-Edition/pull/14

If you want to test it, you need to replace your fooocus local folder with mine (according to selected feature branch)

Also my dev branch contains all merged tested pr features in my fork project https://github.com/MindOfMatter/Fooocus-MindOfMatter-Edition/tree/dev

I hope that it could help you :)

Have a nice day

MindOfMatter commented 9 months ago

done and a lot tested

https://github.com/lllyasviel/Fooocus/pull/2211