KohakuBlueleaf / a1111-sd-webui-lycoris

An extension for stable-diffusion-webui to load lycoris models.
Apache License 2.0
861 stars 116 forks source link

Extra call to `list_available_lycos` wastes seconds of startup time #30

Closed catboxanon closed 1 year ago

catboxanon commented 1 year ago

While debugging the web UI looking for possible performance improvements on startup, I noticed there's an extra call made to list_available_lycos() at the very end of lycoris.py that seems to serve no purpose.

https://github.com/KohakuBlueleaf/a1111-sd-webui-lycoris/blob/1f3e452c314e7b1dd903f723d3c552702519f4a3/lycoris.py#L789

This function is utilized in the UI module for listing and refreshing items, which should probably be the only place it exists.

https://github.com/KohakuBlueleaf/a1111-sd-webui-lycoris/blob/1f3e452c314e7b1dd903f723d3c552702519f4a3/ui_extra_networks_lyco.py#L12-L16

Removing that call in lycoris.py shaved off a full 2 seconds of startup time for me. Opening the extra networks UI lists all LyCORIS models just fine. Is there any reason this is included or can it be safely removed?

KohakuBlueleaf commented 1 year ago

@catboxanon I haven't trace the src code of sd-webui for the ui-related part and this "list available lycos" are copied from original built-in lora extension (Which also has a list_available_loras)

And, if you don't call this function before running generation, lyco extension will think there is no lycos. So if you want to remove thie function call, you will need to open the extra network tab before you start generate image after start up the sd-webui.

So basically this is necessary.

KohakuBlueleaf commented 1 year ago

this function is to let the extension know there are what models So if you don't call this function, the extension will say "there is no lyco models" This function is not only for UI

catboxanon commented 1 year ago

You're right, that was an oversight on my part. Thanks! Closing now.