Your real problem is that you are trying to reuse a model for only part of its functionality.
The best (only?) way to do that is to load the original model fully. Then delete/ignore the parts that you don't want from that model.
This can be achieved in multiple ways:
Simply ignore the extra outputs
If some layers/heads are unnecessary, remove them by duplicating the network with only the layers you want. See here for an example https://discuss.pytorch.org/t/how-to-delete-layer-in-pretrained-model/17648/6
If only part of a head/tensor is unnecessary, you can replace it with the corresponding part. Something like this to replace the fc layer of a resnet18 network:
model = models.resnet18(pretrained=False)
new_fc = nn.Linear(512, 10) # must be the same number of input channels as the original layer
new_fc.weights = model.fc.weights[512, :10] # if you only want to keep the first 10 output features, if the layer has other parameters (bias, buffer), copy them too
model.fc = new_fc