stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: Error when sending image to img2img/inpaint/extras

Open fredrickflower opened this issue 2 years ago • 7 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

Whenever I try to send an image to another category, the UI presents an error. This makes img2img, inpaint and upscaling unusable.

Steps to reproduce the problem

  1. Generate image in either txt2img or img2img
  2. Press send to img2img/inpaint/extras
  3. red error appears and no input image shows

What should have happened?

The image should just appear in the next tab without any errors, so it can be edited.

Commit where the problem happens

6074175faa751dde933aa8e15cd687ca4e4b4a23

What platforms do you use to access UI ?

Windows

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

--xformers

Additional information, context and logs

Traceback (most recent call last): File "C:\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 284, in run_predict output = await app.blocks.process_api( File "C:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 982, in process_api result = await self.call_function(fn_index, inputs, iterator) File "C:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 824, in call_function prediction = await anyio.to_thread.run_sync( File "C:\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "C:\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "C:\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 867, in run result = context.run(func, *args) File "C:\stable-diffusion-webui\modules\generation_parameters_copypaste.py", line 108, in fn=lambda x: image_from_url_text(x), File "C:\stable-diffusion-webui\modules\generation_parameters_copypaste.py", line 40, in image_from_url_text assert normfn.startswith(tempdir), 'trying to open image file not in temporary directory' AssertionError: trying to open image file not in temporary directory

fredrickflower avatar Nov 27 '22 12:11 fredrickflower

Same image image My log is different but I believe it is directly related to the above. Can also see the top edge of my image in the preview on left. Send to is broken, but that was after I closed the sent image, then opened a file browser, and directly imported an image, then tried to SD Upscale.

MrFelt avatar Nov 27 '22 13:11 MrFelt

Same image image My log is different but I believe it is directly related to the above.

Yep, that's what it looks like.

fredrickflower avatar Nov 27 '22 13:11 fredrickflower

I have the same issue

Gman0909 avatar Nov 27 '22 14:11 Gman0909

Yep. I have the same issue.

RocketMobster avatar Nov 27 '22 15:11 RocketMobster

Happens when you hit the Save button as well. ScreenHunter 78

RocketMobster avatar Nov 27 '22 15:11 RocketMobster

fdfsdff

Secrios avatar Nov 27 '22 17:11 Secrios

same

IkariDevGIT avatar Nov 27 '22 17:11 IkariDevGIT

I did the update yesterday and everything was working. The errors only show up when you updated in the last 24 hours

VinPre avatar Nov 27 '22 18:11 VinPre

Seems to be a bug when the programer tries to tighten file access but did'nt do enough testing.

I did a temp fix, use as your own risk. (Should be OK)

vi +40 your_path/stable-diffusion-webui/modules/generation_parameters_copypaste.py

comment out this line as the following:

#assert normfn.startswith(tempdir), 'trying to open image file not in temporary directory'

OK, for now.

ebziw avatar Nov 27 '22 18:11 ebziw

I‘ve got the same bug. Updated yesterday: No problems. Updated two hours ago: The bug occurs.

Zeddi92 avatar Nov 27 '22 19:11 Zeddi92

Seems to be a bug when the programer tries to tighten file access but did'nt do enough testing.

I did a temp fix, use as your own risk. (Should be OK)

vi +40 your_path/stable-diffusion-webui/modules/generation_parameters_copypaste.py

comment out this line as the following:

#assert normfn.startswith(tempdir), 'trying to open image file not in temporary directory'

OK, for now.

This seems to have worked for me as well. Thanks, ebziw.

alexanderdutton avatar Nov 27 '22 19:11 alexanderdutton

Updated again and it looks like it is fixed now without using the fix of @alexanderdutton

VinPre avatar Nov 27 '22 21:11 VinPre

I just did a fresh install and still get this error

Loading weights [81761151] from C:\Users\WinUsr\stable-diffusion-webui\models\Stable-diffusion\Stable-Diffusion-V1-5-Pruned-Emaonly.ckpt
Applying cross attention optimization (Doggettx).
Weights loaded.
Loading weights [3e16efc8] from C:\Users\WinUsr\stable-diffusion-webui\models\Stable-diffusion\Stable-Diffusion-V1-5-Inpainting.ckpt
Traceback (most recent call last):
  File "C:\Users\WinUsr\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 284, in run_predict
    output = await app.blocks.process_api(
  File "C:\Users\WinUsr\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 982, in process_api
    result = await self.call_function(fn_index, inputs, iterator)
  File "C:\Users\WinUsr\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 824, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "C:\Users\WinUsr\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\Users\WinUsr\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "C:\Users\WinUsr\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "C:\Users\WinUsr\stable-diffusion-webui\modules\ui.py", line 1664, in <lambda>
    fn=lambda value, k=k: run_settings_single(value, key=k),
  File "C:\Users\WinUsr\stable-diffusion-webui\modules\ui.py", line 1505, in run_settings_single
    if not opts.set(key, value):
  File "C:\Users\WinUsr\stable-diffusion-webui\modules\shared.py", line 477, in set
    self.data_labels[key].onchange()
  File "C:\Users\WinUsr\stable-diffusion-webui\webui.py", line 45, in f
    res = func(*args, **kwargs)
  File "C:\Users\WinUsr\stable-diffusion-webui\webui.py", line 87, in <lambda>
    shared.opts.onchange("sd_model_checkpoint", wrap_queued_call(lambda: modules.sd_models.reload_model_weights()))
  File "C:\Users\WinUsr\stable-diffusion-webui\modules\sd_models.py", line 302, in reload_model_weights
    load_model_weights(sd_model, checkpoint_info)
  File "C:\Users\WinUsr\stable-diffusion-webui\modules\sd_models.py", line 192, in load_model_weights
    model.load_state_dict(sd, strict=False)
  File "C:\Users\WinUsr\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1604, in load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for LatentDiffusion:
        size mismatch for model.diffusion_model.input_blocks.0.0.weight: copying a param with shape torch.Size([320, 9, 3, 3]) from checkpoint, the shape in current model is torch.Size([320, 4, 3, 3]).

Oem42 avatar Nov 28 '22 02:11 Oem42

https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/aa12dfada05a1f5bef558f24f3a318a1c293a01f fixes this issue. Do a "git pull" on your install directory.

Munichschntz avatar Nov 28 '22 15:11 Munichschntz