My suggestion is to print(model) then you can see the layers involved.
For example, ResNet final layer is under model.fc. You can then do this to suit it to your own final layers:
model = models.resnet18(pretrained=True)
num_features = model.fc.in_features #the number of nodes in the last layer for the ResNet model
num_classes = 20 #whatever number of classes u have.
model.fc = nn.Linear(num_features, num_classes) #connect ur own layer into it.

There is more flexibility, you just have to determine from which layer u want to make the changes. This is an example of just changing the final linear layer to connect to the number of outputs that you desired.