Closed s101010tw closed 1 year ago
i may answer your question, you should take care of the initialized self.size in function selfattention, which is consisitent with the image_size 64. if you use imge_size=128, make sure that modify the initialized self.size firstly.
how would you change the size of the attention block to fit with every image_size choice?
You would simply modify this line here: https://github.com/dome272/Diffusion-Models-pytorch/blob/be352208d0576039fec061238c0e4385a562a2d4/modules.py#L50
Instead of having a fixed resolution you would just take x.shape and use the hight and width from there and then reshape according to that.
So e.g.: x = x.view(-1, self.channels, x.shape[2] * x.shape[3]).swapaxes(1, 2)
And then you can also adjust it here: https://github.com/dome272/Diffusion-Models-pytorch/blob/be352208d0576039fec061238c0e4385a562a2d4/modules.py#L55
I tried it at anything above 64, and it crashes...is this the only place you need to change things?
Thanks for your great work!!
The code can be trained using image_size with 64, and the sampling results are OK. However, I try to use large size for training (e.g. image_size = 128), and the code cannot be trained.
Could you share how to resolve this problem. I appreciate your help very much~
I have the same issue, althought when i use an image with a smaller size, i recieve this error. for reference the img_size is 6
Thanks for your great work!! The code can be trained using image_size with 64, and the sampling results are OK. However, I try to use large size for training (e.g. image_size = 128), and the code cannot be trained. Could you share how to resolve this problem. I appreciate your help very much~
I have the same issue, althought when i use an image with a smaller size, i recieve this error. for reference the img_size is 6
Hello, I'm encountering the same problem when I try to train the model on 32*32 images. Did you solve it ?
Thanks
@karkay22 Hey, I kind of played around with the code a little bit and I figured that it was only wise to use 64x64 images. Since a change in the image size would also require a change in the input & output dimensions for each attention block, which can be quite tedious.
A solution to this would be to try changing the attention block dimensions as well as the ConvTranspose & Upscale blocks to meet the image size transformations.
Take a look here https://github.com/dome272/Diffusion-Models-pytorch/issues/7
Do you have detail code to show how to change img_size to 128 for your solution?
Thanks for your great work!!
The code can be trained using image_size with 64, and the sampling results are OK. However, I try to use large size for training (e.g. image_size = 128), and the code cannot be trained.
Could you share how to resolve this problem. I appreciate your help very much~