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

Dimension issue with conditioning #272

Open
anshumansinha16 opened this issue Nov 27, 2023 · 1 comment
Open

Dimension issue with conditioning #272

anshumansinha16 opened this issue Nov 27, 2023 · 1 comment

Comments

@anshumansinha16
Copy link

anshumansinha16 commented Nov 27, 2023

I am trying to run the 1D diffusion model with conditioning but getting the following error.

x = self.init_conv(x) in line

The input is torch.Size([64, 705]) i.e batch size is 64 and input is 704+1 (1 for the conditioning) but when I put this in the int_conv ; the error is

RuntimeError: Given groups=1, weight of size [64, 2, 7], expected input[1, 64, 705] to have 2 channels, but got 64 channels instead

As the init_conv is Conv1d(2, 64, kernel_size=(7,), stride=(1,), padding=(3,)) ; I wish to know why do we have input_channels = channels * (2 if self_condition else 1) ; Do we need to have the input condition as a separate channel in our case?

@Nikos-86
Copy link

I had experienced a similar error before. The issue is that for the 1D, each of the input tensor dimensions mean something. That is , [ "number of 1D training sequences", "number of channels in each sequence", "length of each sequence" ] . The error says that it was expecting a dimension of sample size 64, 2 channels and length 7. Instead it got, 1 sequence, 64 channels, 705 length ( [1, 64, 705] ) . Maybe a permutation to change the dimensions to [64, 1, 705] could help? Also, you might want to change your "channels" variable in the Unet to 1 ( that is where the Conv1d gets the number of channels from. In your case it is set to 2 ). Give it a try, it might work.

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

2 participants