The provided code shouldn’t work, so please make sure you are really executing the posted code.
This line of code:
self.model.avgpool = nn.AdaptiveAvgPool2d(self.model.fc.out_features)

will initialize an adaptive pooling layer with a spatial output size of 1000, which won’t work using the following self.model.fc layer with in_features = 2048.