Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 2 but got size 1 for tensor number 1 in the list #123

Open
deadpipe opened this issue Mar 15, 2024 · 3 comments

Comments

@deadpipe
Copy link

Hi

I am trying to generate an image but I receive the following error in the terminal :

Microsoft Windows [Version 10.0.19045.4170]
(c) Microsoft Corporation. All rights reserved.

S:\AI Softwares\Cascade>venv\scripts\activate

(venv) S:\AI Softwares\Cascade>cd stablecascade

(venv) S:\AI Softwares\Cascade\StableCascade>cd gradio_app

(venv) S:\AI Softwares\Cascade\StableCascade\gradio_app>python app.py
RUNNING ON: cuda
Loading pipeline components...:   0%|                                                                                                       | 0/6 [00:00<?, ?it/s]S:\AI Softwares\Cascade\venv\lib\site-packages\diffusers\models\lora.py:387: FutureWarning: `LoRACompatibleLinear` is deprecated and will be removed in version 1.0.0. Use of `LoRACompatibleLinear` is deprecated. Please switch to PEFT backend by installing PEFT: `pip install peft`.
  deprecate("LoRACompatibleLinear", "1.0.0", deprecation_message)
Loading pipeline components...: 100%|███████████████████████████████████████████████████████████████████████████████████████████████| 6/6 [00:00<00:00,  7.96it/s]
Loading pipeline components...: 100%|███████████████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:13<00:00,  2.66s/it]
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
seed: 164324004
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:23<00:00,  1.20s/it]
  0%|                                                                                                                                      | 0/10 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "S:\AI Softwares\Cascade\venv\lib\site-packages\gradio\queueing.py", line 501, in call_prediction
    output = await route_utils.call_process_api(
  File "S:\AI Softwares\Cascade\venv\lib\site-packages\gradio\route_utils.py", line 253, in call_process_api
    output = await app.get_blocks().process_api(
  File "S:\AI Softwares\Cascade\venv\lib\site-packages\gradio\blocks.py", line 1695, in process_api
    result = await self.call_function(
  File "S:\AI Softwares\Cascade\venv\lib\site-packages\gradio\blocks.py", line 1235, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "S:\AI Softwares\Cascade\venv\lib\site-packages\anyio\to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "S:\AI Softwares\Cascade\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 2144, in run_sync_in_worker_thread
    return await future
  File "S:\AI Softwares\Cascade\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 851, in run
    result = context.run(func, *args)
  File "S:\AI Softwares\Cascade\venv\lib\site-packages\gradio\utils.py", line 692, in wrapper
    response = f(*args, **kwargs)
  File "S:\AI Softwares\Cascade\venv\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "S:\AI Softwares\Cascade\StableCascade\gradio_app\app.py", line 91, in generate
    decoder_output = generate_decoder(
  File "S:\AI Softwares\Cascade\StableCascade\gradio_app\app.py", line 47, in generate_decoder
    decoder_output = decoder(
  File "S:\AI Softwares\Cascade\venv\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "S:\AI Softwares\Cascade\venv\lib\site-packages\diffusers\pipelines\stable_cascade\pipeline_stable_cascade.py", line 412, in __call__
    predicted_latents = self.decoder(
  File "S:\AI Softwares\Cascade\venv\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "S:\AI Softwares\Cascade\venv\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "S:\AI Softwares\Cascade\venv\lib\site-packages\diffusers\models\unets\unet_stable_cascade.py", line 603, in forward
    level_outputs = self._down_encode(x, timestep_ratio_embed, clip)
  File "S:\AI Softwares\Cascade\venv\lib\site-packages\diffusers\models\unets\unet_stable_cascade.py", line 495, in _down_encode
    x = block(x, clip)
  File "S:\AI Softwares\Cascade\venv\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "S:\AI Softwares\Cascade\venv\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "S:\AI Softwares\Cascade\venv\lib\site-packages\diffusers\models\unets\unet_stable_cascade.py", line 108, in forward
    kv = torch.cat([norm_x.view(batch_size, channel, -1).transpose(1, 2), kv], dim=1)
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 2 but got size 1 for tensor number 1 in the list.

I am using:
Windows 10
RTX 3090 24GB
RTX 3060 12GB
32GB System RAM
Python 3.10.6
CUDA 11.8
Nvidia Driver 531.18

@1Nevermore2
Copy link

COOL

@vofan
Copy link

vofan commented Mar 20, 2024

same here.
UPD: found a workaround: in advanced settings change Number of images to 1

@FurkanGozukara
Copy link

we have number of images support and amazing optimizations having app : #125

by the way the naming of number of images in original gradio is actually = batch size not looping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants