oborchers / Fast_Sentence_Embeddings

Compute Sentence Embeddings Fast!
GNU General Public License v3.0
616 stars 83 forks source link

method save works( somehow) but load does not #24

Closed mathias3 closed 4 years ago

mathias3 commented 4 years ago

Hi when I call .save method on sif model it works - although as I understand the only way to save/serialize model on disc is by using pickle?

model_sif.save("model_sif2")

trying to using save should return error , the same as when i try to load saved model

model_sif2= FT_gensim.load("model_sif2")

AttributeError: Can't get attribute 'FastTextKeyedVectors' on <module 'gensim.models.deprecated.keyedvectors' from '/j/miniconda3/envs/clean_unsup/lib/python3.7/site-packages/gensim/models/deprecated/keyedvectors.py'>

oborchers commented 4 years ago

Hi, i suspect that your FT_gensim is a fasttext instance. Please use a SIF class to load the model.

model_sif.save("model_sif2")
model_sif2 = SIF.load("model_sif2")
mathias3 commented 4 years ago

OK I just found out thst SIF uses SaveLoad from gensim.utils.

thanks