AUTOMATIC1111 / stable-diffusion-webui-pixelization

stable-diffusion-webui-pixelization
MIT License
562 stars 75 forks source link

Error The size of tensor a (4) must match the size of tensor b (3) #32

Open demiguelm opened 1 month ago

demiguelm commented 1 month ago

HI! After update to new A1, some error appears :(

Works with the regular non-fixed postprocessing_pixelization.py Everything with the color/brightness fix was working great but...

image

image

image

initialize network with normal Error completing request Arguments: ('task(iz8svjo899oawb6)', 0.0, <PIL.Image.Image image mode=RGBA size=1280x720 at 0x2152D7A5BA0>, None, '', '', True, True, 0.0, 4, 0.0, 512, 512, True, 'None', 'None', 0, False, 1, False, 1, 0, False, 0.5, 0.2, False, 0.9, 0.15, 0.5, False, False, 384, 768, 4096, 409600, 'Maximize area', 0.1, False, ['Horizontal'], False, ['Deepbooru'], False, False, 4, True, False, 4, True, True, True, 15, 1, None, False, '0', '0', 'inswapper_128.onnx', 'CodeFormer', 1, True, 'None', 1, 1, 1, 0, 0, 0.5, 'CUDA', False, 0, 'None', '', None, False, False, 0.5, 0, 'tab_single') {} Traceback (most recent call last): File "F:\SD1.9\webui\modules\call_queue.py", line 57, in f res = list(func(*args, kwargs)) File "F:\SD1.9\webui\modules\call_queue.py", line 36, in f res = func(*args, *kwargs) File "F:\SD1.9\webui\modules\postprocessing.py", line 131, in run_postprocessing_webui return run_postprocessing(args, kwargs) File "F:\SD1.9\webui\modules\postprocessing.py", line 71, in run_postprocessing scripts.scripts_postproc.run(initial_pp, args) File "F:\SD1.9\webui\modules\scripts_postprocessing.py", line 198, in run script.process(single_image, process_args) File "F:\SD1.9\webui\extensions\stable-diffusion-webui-pixelization\scripts\postprocessing_pixelization.py", line 272, in process in_t = process(pp.image).to(devices.device) File "F:\SD1.9\webui\extensions\stable-diffusion-webui-pixelization\scripts\postprocessing_pixelization.py", line 155, in process return trans(img)[None, :, :, :] File "F:\SD1.9\system\python\lib\site-packages\torchvision\transforms\transforms.py", line 95, in call img = t(img) File "F:\SD1.9\system\python\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, *kwargs) File "F:\SD1.9\system\python\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(args, kwargs) File "F:\SD1.9\system\python\lib\site-packages\torchvision\transforms\transforms.py", line 277, in forward return F.normalize(tensor, self.mean, self.std, self.inplace) File "F:\SD1.9\system\python\lib\site-packages\torchvision\transforms\functional.py", line 363, in normalize return F_t.normalize(tensor, mean=mean, std=std, inplace=inplace) File "F:\SD1.9\system\python\lib\site-packages\torchvision\transforms_functionaltensor.py", line 928, in normalize return tensor.sub(mean).div_(std) RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0


Taruu commented 1 month ago

can u show file postprocessing_pixelization.py? from script folder. or more precisely the code on line 199

Taruu commented 1 month ago

Or is everything already working?

demiguelm commented 1 month ago

Yeah, the problem is the fix file: https://github.com/AUTOMATIC1111/stable-diffusion-webui-pixelization/issues/18

I updated the code so it will also accept 0.75 or 2.25 values from slider , also you have ratio to restore shadows and highlights, defaults work ok but youre free to change them depending on image postprocessing_pixelization.zip

I manage to fix adding line 266. image

Taruu commented 1 month ago

you can also try this changes from @y4my4my4m pull request https://github.com/AUTOMATIC1111/stable-diffusion-webui-pixelization/pull/31 I check later. I think this solution more better