Darshan Hiranandani : How to Replace Specific Layer Weights in One Model with Weights from Another Model?

Hi everyone,

I’m Darshan Hiranandani, I have a model (Model A) loaded using the Hugging Face Transformer library, which has a set of weights (weightA). I also have another model’s weights (weightB) and I would like to replace the weights of certain layers in Model A with the corresponding ones from Model B.

Has anyone worked on something similar, or could suggest the best approach to accomplish this? I want to ensure I only replace the weights for specific layers and preserve the rest of the model as is.

Looking forward to any tips or insights! Thanks in advance.
Regards
Darshan Hiranandani

1 Like