You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File "/code/medical/3dsam_adapter/3DSAM-adapter/modeling/Med_SAM/image_encoder.py", line 281, in forward
x = x + pos_embed
RuntimeError: The size of tensor a (10) must match the size of tensor b (32) at non-singleton dimension 3
here x #torch.Size([1, 32, 32, 10, 768]) and pos_embed #torch.Size([1, 32, 32, 32, 768]).
I didn't modify the code, but changed the training to parallel on 3 gpus . The result is the same for the colon and Pancreas data sets in the original paper. How can I solve it? Thank you very much.
The text was updated successfully, but these errors were encountered:
File "/code/medical/3dsam_adapter/3DSAM-adapter/modeling/Med_SAM/image_encoder.py", line 281, in forward x = x + pos_embed RuntimeError: The size of tensor a (10) must match the size of tensor b (32) at non-singleton dimension 3
here x #torch.Size([1, 32, 32, 10, 768]) and pos_embed #torch.Size([1, 32, 32, 32, 768]).
I didn't modify the code, but changed the training to parallel on 3 gpus . The result is the same for the colon and Pancreas data sets in the original paper. How can I solve it? Thank you very much.
It seems you are using a batch size of 1 with 3 GPUs, so the parallel mechanism divided a single image into three sub-image by the depth dimension. So that it no longer aligns with the rest of the network architecture.
If you want to use multiple GPUs, you should connect them sequentially rather than in parallel. You can put different blocks of the encoder into different GPUs and then move your intermediate variables among these GPUs. But make sure for each GPU the variables correspond to the entire image.
Thanks a lot for your work,it helps a lot.
File "/code/medical/3dsam_adapter/3DSAM-adapter/modeling/Med_SAM/image_encoder.py", line 281, in forward
x = x + pos_embed
RuntimeError: The size of tensor a (10) must match the size of tensor b (32) at non-singleton dimension 3
here x #torch.Size([1, 32, 32, 10, 768]) and pos_embed #torch.Size([1, 32, 32, 32, 768]).
I didn't modify the code, but changed the training to parallel on 3 gpus . The result is the same for the colon and Pancreas data sets in the original paper. How can I solve it? Thank you very much.
The text was updated successfully, but these errors were encountered: