AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: unable to save checkpoint preview pictures when model is in symlink folder #7692

Open halr9000 opened 1 year ago

halr9000 commented 1 year ago

Is there an existing issue for this?

What happened?

See #7266. Same symptom, but on the Checkpoints tab

Steps to reproduce the problem

  1. create folder for models as in example below
  2. generate any image
  3. open checkpoints tab
  4. hover over one of them and click replace preview
  5. image is not replaced and error appears in console

My example folder layout

d:
  /stable-diffusion
    /models
      /stable-diffusion<- symlink source
   /auto <- sd-ui main folder
    /models
      /stable-diffusion<- symlink destination

What should have happened?

pic should be replaced

Commit where the problem happens

ea9bd9f

What platforms do you use to access the UI ?

Windows, iOS, Android

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

set COMMANDLINE_ARGS=--listen --enable-insecure-extension-access --deepdanbooru --no-half --api --xformers

List of extensions

a1111-sd-webui-haku-img a1111-sd-webui-tagcomplete animator_extension asymmetric-tiling-sd-webui custom-diffusion-webui deforum-for-automatic1111-webui depthmap2mask gif2gif model-keyword multi-subject-render openOutpaint-webUI-extension prompt-fusion-extension sd_smartprocess sd-dynamic-thresholding sd-extension-steps-animation sd-extension-system-info sd-webui-ar seed_travel shift-attention stable-diffusion-webui-anti-burn stable-diffusion-webui-auto-tls-https stable-diffusion-webui-depthmap-script stable-diffusion-webui-images-browser stable-diffusion-webui-model-toolkit stable-diffusion-webui-Prompt_Generator stable-diffusion-webui-prompt-travel stable-diffusion-webui-promptgen stable-diffusion-webui-randomize stable-diffusion-webui-sonar StylePile ultimate-upscale-for-automatic1111

Console logs

Traceback (most recent call last):
  File "D:\hal\stable-diffusion\auto\venv\lib\site-packages\gradio\routes.py", line 337, in run_predict
    output = await app.get_blocks().process_api(
  File "D:\hal\stable-diffusion\auto\venv\lib\site-packages\gradio\blocks.py", line 1015, in process_api
    result = await self.call_function(
  File "D:\hal\stable-diffusion\auto\venv\lib\site-packages\gradio\blocks.py", line 833, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "D:\hal\stable-diffusion\auto\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "D:\hal\stable-diffusion\auto\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "D:\hal\stable-diffusion\auto\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "D:\hal\stable-diffusion\auto\modules\ui_extra_networks.py", line 233, in save_preview
    assert is_allowed, f'writing to {filename} is not allowed'
AssertionError: writing to D:\hal\stable-diffusion\auto\models\stable-diffusion\experience_exp65.png is not allowed

Additional information

No response

halr9000 commented 1 year ago

fyi @mcmonkey4eva

mcmonkey4eva commented 1 year ago

I don't have the same issue myself.

~~I think you're probably using --ckpt-dir or --data-dir or one of those? And you have the same issue as https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/7041 It appears that the alternate root directory command line args probably break previews, for a similar (but separate) reason as to why symlinks were broken.~~ EDIT: no, you're not, you posted your command line args. Huh. That's got me confused then.

On an updated copy of the WebUI, I can both update and view previews on all tabs within extra networks, on both Windows and Linux.

It might be related to the type of symlink you made? (Symlink vs Hardlink vs Junction).

halr9000 commented 1 year ago

It might be related to the type of symlink you made? (Symlink vs Hardlink vs Junction)

Just plain ole symlinks. Haven't tried in linux or wsl2, that's too much work for me at the moment. The other tabs work fine, it is indeed bizarre.

springheeledjack66 commented 1 year ago

I had the problem of the images the additional networks tab not working on any of its subtabs (embeddings, hypernets and Loras), does anyone know what might be causing it?

CErratum commented 1 year ago

An oddity: images worked for me when I had the entire models folder symlinked; however, it seems anything below that causes issues with previews - i.e., if you have the stable-diffusion models folder symlinked, or a subfolder created for sorting.

MNeMoNiCuZ commented 1 year ago

Since ~1.5 update. And it doesn't update the Extra Networks list right away, nor the new "Settings" window. You must do a REFRESH-button press to get the new preview image.

The file is created as it should of course.