MAIF / melusine

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

loading a model #130

Closed CameliaSNCF closed 2 years ago

CameliaSNCF commented 2 years ago

Hey there and thank you for using Issue Tracker!

Python version : 3.8.10

Melusine version : 2.3.2

Operating System : Windows

Hello, I am trying to save a model and then load it and test it in another notebook. Unfortunately I can't find any exammple of this process in your documentation and I can't figure out how to load the model properly and keep having an error.

savedModel1

savedModel2

savedModel3

Could you give me some pointers ?

Best regards, Camelia.

TFA-MAIF commented 2 years ago

Hello Camelia,

I will be working on the library next week. I will take a look at your issue then except if someone answers you before.

Have a good week-end. Best regards, Tiphaine

hugo-quantmetry commented 2 years ago

Hello Camelia, I think I know where your problem comes from. Could you try the solution suggested in this issue ? https://github.com/MAIF/melusine/issues/89

import joblib
model.save_nn_model("MY_MODEL")
joblib.dump(model, "MY_MODEL.pkl", compress=True)

loaded_model = joblib.load("MY_MODEL.pkl")
loaded_model.load_nn_model("MY_MODEL")

The way Melusine models should be saved is not obvious, sorry about that

hugo-quantmetry commented 2 years ago

Closing the issue for now, Feel free to re-open it if needed