-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Saving/loading Word2Vec as described in the tutorial fails #2170
Labels
need info
Not enough information for reproduce an issue, need more info from author
Comments
Not reproduced, this is an code that I used from gensim.test.utils import common_corpus, common_texts, get_tmpfile
from gensim.models.callbacks import CallbackAny2Vec
from gensim.models import Word2Vec
class EpochSaver(CallbackAny2Vec):
'''Callback to save model after each epoch.'''
def __init__(self, path_prefix):
self.path_prefix = path_prefix
self.epoch = 0
def on_epoch_end(self, model):
output_path = get_tmpfile('{}_epoch{}.model'.format(self.path_prefix, self.epoch))
model.save(output_path)
self.epoch += 1
saver = EpochSaver("my_w2v")
model = Word2Vec(common_texts, iter=5, size=10, min_count=0, seed=42, callbacks=[saver]) # other interpreter
from gensim.models import Word2Vec
loaded_model = Word2Vec.load("/tmp/my_w2v_epoch3.model") @jbayardo please
|
menshikh-iv
added
need info
Not enough information for reproduce an issue, need more info from author
and removed
bug
Issue described a bug
labels
Sep 4, 2018
I reinstalled gensim and everything worked as expected |
Great @jbayardo, thanks for the clarification. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Trained a W2V model as shown in the documentation, along with a callback to save it to disk. When I try to reload one of the checkpoints, I get the following error:
Steps/Code/Corpus to Reproduce
And then, from a different notebook, with the same environment:
Expected Results
Model loaded
Actual Results
Versions
The text was updated successfully, but these errors were encountered: