AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 1 #5978

Closed Flonixcorn closed 1 year ago

Flonixcorn commented 1 year ago

Is there an existing issue for this?

What happened?

When SD upscaling getting this error with SWINIR and similar errors with other methods

This with other upscalers: RuntimeError: Given groups=1, weight of size [64, 3, 3, 3], expected input[1, 4, 192, 192] to have 3 channels, but got 4 channels instead

SwinIR tiles: 0%| | 0/35 [00:00<?, ?it/s] Error completing request Arguments: (0, 'a highly detailed surreal airbrushed art of dopamine flowing from Venus and through space into me, CGSociety, Unreal Engine, 8K, render, CGI, concept art, trending on artstation, dutch golden hour\n, highly detailed, intricate, focus, sharp, mjart, vray-render, chempunk-96, photohelper', 'blurry, 2D, cartoon, animated, mutated hands, floating hands, painting, artist name, jpeg artifact, out of frame', 'None', 'None', <PIL.Image.Image image mode=RGBA size=1280x768 at 0x1FF4A971FF0>, {'image': <PIL.Image.Image image mode=RGBA size=2560x1536 at 0x1FF4A972E90>, 'mask': <PIL.PngImagePlugin.PngImageFile image mode=RGBA size=2560x1536 at 0x1FF4A972800>}, None, None, None, 0, 40, 0, 4, 0, 0, False, False, 1, 1, 7, 0.3, -1.0, -1.0, 0, 0, 0, False, 768, 1280, 3, False, 32, 0, '', '', 14, 0, 0, 0, 0, 0.25, '

\n

Combinations

\n\n Choose a number of terms from a list, in this case we choose two artists: \n {2$$artist1|artist2|artist3}
\n\n If $$ is not provided, then 1$$ is assumed.

\n\n If the chosen number of terms is greater than the available terms, then some terms will be duplicated, otherwise chosen terms will be unique. This is useful in the case of wildcards, e.g.\n {2$$artist} is equivalent to {2$$artist|artist}

\n\n A range can be provided:\n {1-3$$artist1|artist2|artist3}
\n In this case, a random number of artists between 1 and 3 is chosen.

\n\n Wildcards can be used and the joiner can also be specified:\n {{1-$$and$$adjective}}
\n\n Here, a random number between 1 and 3 words from adjective.txt will be chosen and joined together with the word \'and\' instead of the default comma.\n\n

\n\n

Wildcards

\n Find and manage wildcards in the Wildcards Manager tab.\n\n

\n\n You can add more wildcards by creating a text file with one term per line and name is mywildcards.txt. Place it in X:\AI\StableDiffusion\stable-diffusion-webui\extensions\sd-dynamic-prompts\wildcards. <folder>/mywildcards will then become available.\n
\n\n', False, False, 1, False, False, False, 100, 0.7, False, False, False, False, False, False, 0.9, 5, '0.0001', False, 'None', '', 0.1, False, 0, '\n

Combinations

\n 리스트에서 단어들을 선택합니다. 이 경우에는 아티스트를 2가지 골라보죠 :\n {2$artist1|artist2|artist3}\n $가 입력되지 않으면, 1$가 자동으로 입력됩니다.\n
\n 범위도 지정 가능합니다 :\n {1-3$artist1|artist2|artist3}\n 이 경우에는 1~3가지의 아티스트가 랜덤하게 결정됩니다.\n

\n\n

Wildcards

\n

사용가능한 와일드카드

\n \n
\n 와일드카드 경로: scripts/wildcards
\n mywildcards.txt라는 이름의 텍스트 파일을 만들어, 1줄당 1개의 단어를 입력하면 와일드카드를 추가할 수 있습니다. 텍스트 파일은 scripts/wildcards 에 넣어주세요. 재시작 후 mywildcards를 사용할 수 있게 됩니다.\n ', 100, 10, 30, 6, 15, True, 100, 10, 30, 6, 15, True, 4.0, 1, 1, 0, 0, 0.0, 4.0, 0.1, 0.1, 1, True, False, False, 0, False, '', 1, False, 0, 1, False, False, False, '', '', '\n', True, True, '', '', True, 50, True, 1, 0, False, 4, 1, 4, 0.09, True, 1, 0, 7, False, False, '

Recommended settings: Sampling Steps: 80-100, Sampler: Euler a, Denoising strength: 0.8

', 128, 8, ['left', 'right', 'up', 'down'], 1, 0.05, 128, 4, 0, ['left', 'right', 'up', 'down'], False, False, False, False, '', 2, '

Will upscale the image by the selected scale factor; use width and height sliders to set tile size

', 256, 4, 4, 10.0, True, 30.0, True, 1, '', 0, '', True, False, False, '

Deforum v0.5-webui-beta

', '

This script is deprecated. Please use the full Deforum extension instead.
\nUpdate instructions:

', '

github.com/deforum-art/deforum-for-automatic1111-webui/blob/automatic1111-webui/README.md

', '

discord.gg/deforum

', False, 0, True, 384, 384, False, 2, True, True, False, False, False, 4.0, '', 10.0, False, False, True, 30.0, True, False, False, 0, 0.0, '{inspiration}', None, 'fixed', 1, 'linear', '30', 'grad_min', 0.01, 1, 'clip', 1.0, 1.0, 'mp4', 10.0, 0, '', True) {} Traceback (most recent call last): File "X:\AI\StableDiffusion\stable-diffusion-webui\modules\call_queue.py", line 45, in f res = list(func(*args, kwargs)) File "X:\AI\StableDiffusion\stable-diffusion-webui\modules\call_queue.py", line 28, in f res = func(*args, *kwargs) File "X:\AI\StableDiffusion\stable-diffusion-webui\modules\img2img.py", line 150, in img2img processed = modules.scripts.scripts_img2img.run(p, args) File "X:\AI\StableDiffusion\stable-diffusion-webui\modules\scripts.py", line 328, in run processed = script.run(p, script_args) File "X:\AI\StableDiffusion\stable-diffusion-webui\scripts\sd_upscale.py", line 40, in run img = upscaler.scaler.upscale(init_img, scale_factor, upscaler.data_path) File "X:\AI\StableDiffusion\stable-diffusion-webui\modules\upscaler.py", line 64, in upscale img = self.do_upscale(img, selected_model) File "X:\AI\StableDiffusion\stable-diffusion-webui\extensions-builtin\SwinIR\scripts\swinir_model.py", line 45, in do_upscale img = upscale(img, model) File "X:\AI\StableDiffusion\stable-diffusion-webui\extensions-builtin\SwinIR\scripts\swinir_model.py", line 122, in upscale output = inference(img, model, tile, tile_overlap, window_size, scale) File "X:\AI\StableDiffusion\stable-diffusion-webui\extensions-builtin\SwinIR\scripts\swinir_model.py", line 150, in inference out_patch = model(in_patch) File "X:\AI\StableDiffusion\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl return forward_call(input, kwargs) File "X:\AI\StableDiffusion\stable-diffusion-webui\extensions-builtin\SwinIR\swinir_model_arch.py", line 810, in forward x = (x - self.mean) * self.img_range RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 1

Steps to reproduce the problem

  1. Go to img2img
  2. Press SD upscale in scripts
  3. read error in cmd

What should have happened?

normal SD upscale

Commit where the problem happens

1595c258e1cc58e2786a067f51256c39ab325cd6

What platforms do you use to access UI ?

Windows

What browsers do you use to access the UI ?

Microsoft Edge

Command Line Arguments

REM rm *.json
git pull
for /D %%i in (extensions*) do @ git -C "%%i" pull --recurse-submodules
@echo off
git pull
set PYTHON=
set GIT=
set VENV_DIR=
set COMMANDLINE_ARGS=--xformers
set STABLE_DIFFUSION_REPO=https://github.com/Stability-AI/stablediffusion
set STABLE_DIFFUSION_COMMIT_HASH=33910c386eaba78b7247ce84f313de0f2c314f61
set/export REQS_FILE=.\extensions\sd_dreambooth_extension\requirements.txt
call webui.bat

Additional information, context and logs

No response

ClashSAN commented 1 year ago

same issue - https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/5963