-
Notifications
You must be signed in to change notification settings - Fork 2
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
shape error on inference using ckpt #1
Comments
Hi, Thanks for reaching out. Which version of the stable diffusion are you using? It seems like the unet is not correctly loading. |
Where did you encounter this issue, within ControlNet or Diffusion U-Net? Which line of code? |
The error occurs in the for loop at line 478 of unet_2d_condition_multiview.py. I think that the block_out_channels value in ckp/train/syntheocc/unet/config.json might be incorrect. Additionally, in the BasicMultiviewTransformerBlock class in models/block.py, the parameters dim, num_attention_heads, and attention_head_dim were not present in ckp/train/syntheocc/unet/config.json. To address this, I manually assigned the values 320, 5, and 64, respectively, based on the computed values in the code. Could this modification be causing the issue? The error (RuntimeError: Given normalized_shape=[320], but got input of size [12, 350, 1280]) occurs when the block_out_channels in ckp/train/syntheocc/unet/config.json is changed from [320, 640, 1280, 1280] to [320, 320, 1280, 1280]. However, even with the original value [320, 640, 1280, 1280], the same error still occurs at the same location, but with the following details: Could you confirm if this is related to the configuration or if there’s an issue with how these parameters are being processed? Lastly, the issue might be related to my environment setup. If you are using Docker, would it be possible to provide the Docker image? |
I am not sure yet. I will re-run my code tomorrow to check it out. May I ask which version of diffusers are you using? Can you successfully loading the original sd2.1 to inference? I am not using docker. So it may be difficult for me to share the docker image. Basically, I think this problem can be attributed to some unknown misconfiguration. I will find the reason this week. |
Thank you for checking. |
Hi, The size mismatches are unusual. Perhaps the model configuration file or the diffusers source code has been uncorrectly modified? What is the quality of the generated image? Is it a normal image or a random one? |
I made two modifications: In infer.py, I added low_cpu_mem_usage=False and ignore_mismatched_sizes=True to UNet2DConditionModelMultiview.from_pretrained. For modification 1, the checkpoint could not be loaded without this change. Despite these adjustments, I encountered an error in the for loop at line 478 of unet_2d_condition_multiview.py, which prevented the generation of any images. |
Thanks you for your excellent works!!
I am trying to use the provided checkpoint for inference, but I encountered a size mismatch error during execution.
The error log indicates the following:
RuntimeError: Given normalized_shape=[320], but got input of size [12, 350, 1280]
I have ensured that my environment and setup match the requirements mentioned in the repository. However, I wanted to confirm whether there might be any differences in the provided checkpoint or configuration settings that could cause this issue.
Could you please help me identify the cause of this error or guide me on how to resolve it?
I suspect that the issue might be related to the config.json file of the UNet model
Thank you for your time and assistance!
The text was updated successfully, but these errors were encountered: