Yes, thanks.
Trying the latest Gensim makes sense indeed.
Post by Gordon MohrThat superficially-confirmatory log line comes from the superclass's
`load()`, before the full load has finished – this error is happening
when the subclass tries to complete the necessary reconstruction of of
the cumulative-distribution-table, used for negative-sampling.
So the error is coming from gensim's `load()`, not user code. It
suggests to me that some part of the 'alignment' may have left the
internal vocabulary-related structures inconsistent, perhaps when
working with a mixture of older and newer code, or models.
But, that `make_cum_table()` line hasn't been on line 631 since gensim
3.3.0. So a first thing to try would be using the latest gensim – to
generate the models and/or align them.
while Andrey's successful test has applied the update he suggests in a
comment there?)
- Gordon
Hi,
The log you provided tells that the model is loaded successfully
('2018-11-30 14:23:44,053 : INFO : loaded model_1970').
What happens after that is a result of some other code that you seem to
run. Can you provide the full content of your word2vec_distance.py script?
P.S. I now tried to align two models using the same code and then load
the aligned model into the latest Gensim. No problems with that.
Post by e***@gmail.comHi Andrey,
My other python programme is as follows (These are only lines I
have).
Post by e***@gmail.com######Input Data
word2vec_model_name_1 = "model_1970"
%(message)s',
Post by e***@gmail.comlevel=logging.INFO)
######Open word2vec model
model_1 = word2vec.Word2Vec.load(word2vec_model_name_1)
Here is the log I received. Any thoughts on how to resolve this
issue? :)
Post by e***@gmail.com|2018-11-3014:23:43,897:INFO :loading Word2Vecobject frommodel_1970
2018-11-3014:23:43,961:INFO :loading wv recursively
frommodel_1970.wv.*withmmap=None2018-11-3014:23:43,965:INFO :loading
vectors frommodel_1970.wv.vectors.npy
withmmap=None2018-11-3014:23:44,005:INFO :setting ignored attribute
vectors_norm to None2018-11-3014:23:44,009:INFO :loading vocabulary
recursively
frommodel_1970.vocabulary.*withmmap=None2018-11-3014:23:44,009:INFO
:loading trainables recursively
frommodel_1970.trainables.*withmmap=None2018-11-3014:23:44,009:INFO
:loading syn1neg frommodel_1970.trainables.syn1neg.npy
withmmap=None2018-11-3014:23:44,053:INFO :setting ignored attribute
cum_table to None2018-11-3014:23:44,053:INFO :loaded model_1970
Reloadedmodules:__mp_main__ Traceback(most recent call
last):File"<ipython-input-3-3b9230dacba9>",line
1,in<module>runfile('C:/Users/Emi/Desktop/code/word2vec_distance.py',wdir='C:/Users/Emi/Desktop/code')File"C:\Users\Emi\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py",line
execfile(filename,namespace)File"C:\Users\Emi\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py",line
exec(compile(f.read(),filename,'exec'),namespace)File"C:/Users/Emi/Desktop/code/word2vec_distance.py",line
=word2vec.Word2Vec.load(word2vec_model_name_1)File"C:\Users\Emi\Anaconda3\lib\site-packages\gensim\models\word2vec.py",line
returnsuper(Word2Vec,cls).load(*args,**kwargs)File"C:\Users\Emi\Anaconda3\lib\site-packages\gensim\models\base_any2vec.py",line
Post by e***@gmail.com631,inload model.vocabulary.make_cum_table(model.wv)# rebuild
cum_table
vocabularyFile"C:\Users\Emi\Anaconda3\lib\site-packages\gensim\models\word2vec.py",line
Post by e***@gmail.com1383,inmake_cum_table train_words_pow
+=wv.vocab[wv.index2word[word_index]].count**power KeyError:'cmnx'|
--
You received this message because you are subscribed to the Google
Groups "Gensim" group.
To unsubscribe from this group and stop receiving emails from it,
send
Post by e***@gmail.comFor more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.
--
Solve et coagula!
Andrey
--
You received this message because you are subscribed to the Google Groups "Gensim" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.