JingXuTHU / Random-Masking-Finds-Winning-Tickets-for-Parameter-Efficient-Fine-tuning

11 stars 0 forks source link

How to load the saved model? #1

Open au-revoir opened 3 months ago

au-revoir commented 3 months ago

Hi, Congratulations on your work. I have saved the model after training using line. However, how do I load this saved model since the architecture is now modified and using from_pretrained(model_saved_path) isn't working?

JingXuTHU commented 3 months ago

Hi, thanks for your interest in our work. You can first define a custom model class and call from_pretrained on this class. I guess you directly call from_pretrained on Huggingface's AutoModel, which cannot recognize the custom architecture. An alternative is to directly load the saved state dict, and assign it to the model.