MAIF / melusine

📧 Melusine: Use python to automatize your email processing workflow
https://maif.github.io/melusine
Other
352 stars 58 forks source link

modification train.py pour sauvegarder Bert #124

Closed CRGONCALVES closed 2 years ago

CRGONCALVES commented 2 years ago

Hello every one,

I have modified the file train.py for enabling Bert model fonction save. My modification is :

def __getstate__(self):
        """Method called before serialization for a specific treatment to save
        model weight and structure instead of standard serialization."""
        dict_attr = dict(self.__dict__)
        if "model" in dict_attr:
            del dict_attr["model"]
        if "embedding_matrix" in dict_attr:
            del dict_attr["embedding_matrix"]
            del dict_attr["pretrained_embedding"]
        return dict_attr

I am happy to contribute to this reat projet.

CRGONCALVES commented 2 years ago

It's my 2nd pull request for this issue. Indeed my fisrt one was not valid.