stablediffusion icon indicating copy to clipboard operation
stablediffusion copied to clipboard

Shape invalid for input of size

Open alexw92 opened this issue 2 years ago • 2 comments

I am using stable diffussion with 2.1 weights and execute prompts from a list. However I sometimes get the error

RuntimeError: shape \'[10, 77, 5, 64]\' is invalid for input of size 221760

for some prompts but not for all. For other prompts it works totally fine. I am currently trying to find out which specific prompts trigger it.

Did this happen to anyone else before?

For reference I am running it on WSL and have the dependencies installed in a conda environment.

alexw92 avatar Jul 14 '23 23:07 alexw92

Hello, I've come across the same error. I discovered that this runtime issue stems from a shape mismatch between 'q' and 'k' in the cross-attention module. The batch sizes differ between 'q' and 'k' due to the unequal batch sizes between the cues and images. Kindly make sure that the number of your prompts is divisible by 'n_sample' solves the problem.

Andrew0613 avatar Aug 31 '23 02:08 Andrew0613