bnosac / ruimtehol

R package to Embed All the Things! using StarSpace
Mozilla Public License 2.0
99 stars 13 forks source link

`loss` is different after saving and then loading a model #8

Closed fzhang612 closed 5 years ago

fzhang612 commented 5 years ago

I trained a model with loss = 'softmax' and saved it into a binary file by starspace_save_model. Later on I used starspace_load_model to load the same binary file and realized its loss became 'hinge'. Thanks!

jwijffels commented 5 years ago

With which method did you save your model, was it "binary", "tsv-starspace", "tsv-data.table", "ruimtehol"

Advise is to use starspace_save_model with method 'ruimtehol', and also use starspace_load_model with method 'ruimtehol', did you do that?

fzhang612 commented 5 years ago

If a model is saved and then loaded back with method = 'binary', its hyperparameters are lost.

If with method = 'ruimtehol', all hyperparameters are preserved.

Didn't test the other 2 options.

Thanks!

jwijffels commented 5 years ago

Good to know. Please use method = 'ruimtehol', I specifically made sure for that type of saving hyperparameters are kept. For the other ones, you need to pass the hyperparameters to starspace_load_model again which is the reason why I created method = 'ruimtehol' and it is also way faster. I personally only use method = 'ruimtehol', I'm planning to remove the other ones.

jwijffels commented 5 years ago

Closing as the loading using method = 'binary' and method = 'tsv-starspace' has been disabled since commit https://github.com/bnosac/ruimtehol/commit/9791b1a674d3dcf37796aef85dac222f3eb9944b. You should now use the method 'ruimtehol' for saving and loading, which is now the default.