seyonechithrananda / bert-loves-chemistry

bert-loves-chemistry: a repository of HuggingFace models applied on chemical SMILES data for drug design, chemical modelling, etc.
MIT License
389 stars 60 forks source link

fix regression ft #35

Closed walid0925 closed 3 years ago

walid0925 commented 3 years ago

Finetuning from MTR models was causing issues because of matching weights names. Essentially, pytorch would try to load the same weights even when the output shape had changed. This fix works by loading the state_dict manually, removing the weights for the last layer, and then passing that into the HuggingFace .from_pretrained method