stable-diffusion-webui
stable-diffusion-webui copied to clipboard
RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.
Describe the bug When I try to generate I get the following error:
Error completing request Arguments: ('Test', '', 'None', 'None', 20, 0, False, False, 1, 1, 7, -1.0, -1.0, 0, 0, 0, False, 512, 512, False, 0.7, 0, 0, 0, False, False, None, '', 1, '', 0, '', True, False, False) {}
RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.
File "/usr/local/lib/python3.10/site-packages/torch/nn/functional.py", line 2503, in layer_norm return torch.layer_norm(input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled) RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.
Mac M1
I have the same error after the last git pull
Windows 10
Makes sense -- because I had generated 1 successfully, this morning -- then started it back up and got that error.
modules\textual_inversion\image_embedding.py, insert_image_data_embed(),
change
data_np_low.resize(next_size)
data_np_low = data_np_low.reshape((h, -1, d))
data_np_high.resize(next_size)
data_np_high = data_np_high.reshape((h, -1, d))
to
np.resize(data_np_low,next_size)
data_np_low = data_np_low.reshape((h, -1, d))
np.resize(data_np_high, next_size)
data_np_high = data_np_high.reshape((h, -1, d))
The solution is mentioned here: https://github.com/Birch-san/stable-diffusion#patch
all what you have to do is going the file mentioned by the error, i.e. from cli: open /usr/local/lib/python3.10/site-packages/torch/nn/functional.py or in my ios case in a conda env: open /opt/homebrew/Caskroom/miniforge/base/envs/web-ui/lib/python3.10/site-packages/torch/nn/functional.py
and when it opens go to the mentioned line 2503 to change input to input..contiguous()
save, rerun the app and it worked 👍
the problem appeard on my mac M1 but not on colab
Happened to me today on m2 macbook air.
Happened to me today on m1pro MacBook Pro.
The solution is mentioned here: https://github.com/Birch-san/stable-diffusion#patch
all what you have to do is going the file mentioned by the error, i.e. from cli: open /usr/local/lib/python3.10/site-packages/torch/nn/functional.py or in my ios case in a conda env: open /opt/homebrew/Caskroom/miniforge/base/envs/web-ui/lib/python3.10/site-packages/torch/nn/functional.py
and when it opens go to the mentioned line 2503 to change input to input..contiguous()
save, rerun the app and it worked 👍
the problem appeard on my mac M1 but not on colab
this worked for me, however looks like it has been fixed already in torch 1.13.1