stable-diffusion-webui
stable-diffusion-webui copied to clipboard
[Feature Request]: Make Extra Networks ignore "empty" folders
Is there an existing issue for this?
- [X] I have searched the existing issues and checked the recent builds/commits
What would your feature do ?
I have a lot of models (same happens for LoRa, TI, etc) and am using https://github.com/CurtisDS/sd-model-preview-xd/ to store multiple previews of them.
Consequently for each model I have one folder holding multiple pictures + 1 text file and nothing else. Which makes "Extra Networks" add a lot of empty folders on top of my checkpoint cards.
I'd like for Extra Networks to add a "Folder button" only if there's some actual model/LoRa/Ti in there. If not possible, an option to turn off those directory altogether :/ would be helpful too.
Proposed workflow
For solution 1 : nothing to do on the user end For solution 2 : Settings->Extra Networks->Hide Folders : On/Off
Additional information
No response
This probably isn't the right way to do it, but it works, Replace https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/a9fed7c364061ae6efb37f797b6b522cb3cf7aa2/modules/ui_extra_networks.py#L79-L83 with
is_empty = len([item for item in os.listdir(x) if os.path.splitext(item)[1].lower() in [".pt", ".ckpt", ".safetensors"]]) == 0
if not is_empty:
if not subdir.endswith("/"):
subdir = subdir + "/"
subdirs[subdir] = 1
Not putting the images in subfolders should work, too.
(sorry for the delay)
Looking for .pt/ckpt/safetensors for is_empty looks like a valid solution to me. (maybe you can do a PR for it ?) Putting all the images out of the folder too.... but then I'm gonna end up with my models dwarfed by dozens if not hundreds of preview pictures. Just ocd stuff I guess.