#freeze layers 
for param in model.parameters():
        param.requires_grad = False
# create your own layers to attach
lin1 = nn.Linear(etc...)

Now check the layers of the pretrained model: (I’m using resnet)
for ii,module in enumerate(self.resnet):
            print("module " + str(ii) + " " + str(module))

select the output of the pretrained model you want. (where do you want your training to begin.)
ii equals a number, so if you want output of layer 5, you select ii = 5
# in forward function, cycles through pretrained modules
for ii,module in enumerate(self.resnet):
            x = module(x)
            if ii == 5: 
               output = x
               # figure out shape of output in order to design your own layers
# Add your layers 
x = lin1(output)

Now your layers are trainable, whilst the pre-trained model is frozen.