RuntimeError when training resnext50_32x4d
NightQing opened this issue · 2 comments
Hi,
I have trained a resnet50 model successfully, but when I train resnext50_32x4d, there is an error:
models_lpf/resnet.py", line 147, in forward
out += identity
RuntimeError: The size of tensor a (20) must match the size of tensor b (80) at non-singleton dimension 3.
In addition, in models_lpf/resnet.py, "groups=4, width_per_group=32" in resnext32x4d is differenet from "groups=32, width_per_group=4" in pytorch offical code "torchvision/models/resnet.py"
Do you have any advices?
just run into the exact sample problem, any update?
I tried switching the group and width_pre_group parameters. It messed up the network dimension even further. So that is not the solution.
Also, I noticed that the model size of this implementation is about 4x of the one built by torchvision, so it seems some dim setup is off by 4x.