AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
142.61k stars 26.9k forks source link

[Bug]: Extra networks previews do not work with the cli options for different directories #7046

Closed rvkwi closed 1 year ago

rvkwi commented 1 year ago

Is there an existing issue for this?

What happened?

The previews for extra networks seem to not function if one of the directory options outside of the install folder are used.

For example when using --embeddings-dir. It will look for them there and try to use them, it will also save them to that directory with the embedding correctly. But it won't load the previews, it just shows a blank image and throws this error:

ValueError: File cannot be fetched: /mnt/mldrive/ai/files/stable-diffusion-library/embeddings/poset2.preview.png. All files must contained within the Gradio python app working directory, or be a temp file created by the Gradio python app.

Steps to reproduce the problem

  1. Start with --embeddings-dir "/path/to/somewhere/outside/of/installdir/with/embeddings/"
  2. Open `Show extra networks"
  3. Generate something, select it, go to an embedding and click replace preview

What should have happened?

It should load/show the preview image that it saved/detects

Commit where the problem happens

0792fae078ba362a5119f56d84e3f490a88690ae

What platforms do you use to access UI ?

Linux

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

webui.sh --embeddings-dir PATH --hypernetwork-dir PATH --ckpt-dir PATH --esrgan-models-path PATH

Additional information, context and logs

No response

neojam commented 1 year ago

Wanted to report this as well, but for Windows. I have all my SD-Resources on a different drive, so the previews are not working for:

--embeddings-dir --hypernetwork-dir --lora-dir

Same error with Gradio ValueError: File cannot be fetched: F:/SD/embeddings/030-Chars/marin_7.preview.png. All files must contained within the Gradio python app working directory, or be a temp file created by the Gradio python app.

RandomLegend commented 1 year ago

Linux here, i also don't have previews but i didn't change my hypernetwork_dir. It's default. Embeddings and Lora Previews work, but hypernetworks don't

rvkwi commented 1 year ago

@RandomLegend Just tried it, it works for me as expected if i copy the files into the install dir and not use the options for an outside path (on debian 11), including hypernetworks. Might be a different issue causing this on your end.

catboxanon commented 1 year ago

I think this is by design in Gradio for security. It also, currently, breaks symlinks too, but that should be fixed by the next release. https://github.com/gradio-app/gradio/pull/3037

rvkwi commented 1 year ago

@catboxanon Interesting, i just tried the symlinking and yeah it throws the same error.

So i suppose one workaround would be storing previews in a temp directory before being displayed with gradio? I'm not sure if gradio has something built in for this already, not very familiar with it but their docs don't seem to mention it.

Or maybe serialize the previews into memory?

neojam commented 1 year ago

Just want to point out, that symlink-option is a workaround at best, since some filesystems don't support symlinks (exFAT etc)

catboxanon commented 1 year ago

https://github.com/gradio-app/gradio/pull/3075 would make symlinks not required.

catboxanon commented 1 year ago

Fixed now as of 1d8e06d542176beade37d2d36cb57460c3c6772f, I think this can be closed.

ghostsquad commented 1 year ago

I'm running 3715ece0adce7bf7c5e9c5ab3710b2fdc3848f39 and none of my embeddings/loras have previews. They actually aren't in a separate location from the install (just the txt2image, etc directories are), and I still have this issue.

brainbent commented 1 year ago

You can work around this by storing a PNG file with the same name as the network and refresh the view. Works for checkpoints and LORA, but I haven't tested with the others as I don't have any installed...

ghostsquad commented 1 year ago

You can work around this by storing a PNG file with the same name as the network and refresh the view. Works for checkpoints and LORA, but I haven't tested with the others as I don't have any installed...

Thanks. I actually inadvertently fixed this issue by getting the civitai helper extension, which downloaded images and links. Its super helpful.

brainbent commented 1 year ago

Thanks. I actually inadvertently fixed this issue by getting the civitai helper extension, which downloaded images and links. Its super helpful.

Nice! Civitai is definitely my new fave source, after finding it a couple of days ago...

Because I ended up losing a number of fantastic prompts today (which I hadn't quite rendered and were refreshed out of existence), I've just setup InvokeAI to play around with...