blakechi / ComVEX

Implementations of Recent Papers in Computer Vision
Apache License 2.0
39 stars 4 forks source link

Expected all tensors to be on the same device issue even though images and labels are in gpu. #1

Closed Gowtham171996 closed 2 years ago

Gowtham171996 commented 2 years ago

Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument index in method wrapper_gather) /CoAtNet/nn/Transformer.py", line 69, in forward relative_biases = relative_bias.gather(dim=-1, index=relative_indices) /CoAtNet/nn/Transformer.py", line 147, in forward x = self.attention(x) /CoAtNet/nn/CoAtNet.py", line 143, in forward x = self.s3(x) line 43, in Train outputs = net(inputs)

blakechi commented 2 years ago

Hello @Gowtham171996 ,

Thanks for your effort and pointing out this issue!

But could you be more specific on which parts of the code have the issue? I think what you meant is this line, right?

Again, I'm appreciating you brought this up!

Gowtham171996 commented 2 years ago

Hi @blakechi ,

Explanation: Sorry, I solved the issue. The wrong was from my end in input image resolution. While training, I was sending the image of the wrong dimension in size (3232 instead of 224224) and strangely it was hitting this error.

Solution: I gave a right-sized image and things went fine.

Associated behavior observed: i also observed the same error when memory overload scenarios too. Yes, it is strange. But yes it happened.

Appreciate your work. Please keep it up going.

blakechi commented 2 years ago

I see. I will look into it as well.

Thanks! Currently I'm rethinking what other contributions this library can make, so probably won't have updates recently. If you have some ideas, please feel free to reach out!