Transferring layer weights of a pre trained model

Hello. I want to transfer the weights of the first ‘k’ layers (where k can be any number less than the number of layers of the model) into another model. One way is that I can make another new model with its layers being the same as of the first k layers of my original model and then transfer it. But let us assume I do not know the structure of the pre trained model. Then how can I do the same ? Please guide :slight_smile: :slight_smile:

you have to know the structure of the pre-trained model. In PyTorch model = code