Evaluation words error
I changed the eval words to some of my own I end up with this error, any idea why?
KeyError Traceback (most recent call last)
KeyError: 'economic'
My environment is python:3.6.6, tensorflow-gpu:1.12
2 reasone may lead to this, i found.
First you should check the key's type, actually i found the orginal key type is "bytes", like b"five". If this is true, change your key to byte type.
Next, maybe word2id doesn't have this key, you should print out that to see what it has.
thanks mate, it works.
@wmaa0002 how did you fix this?
Traceback (most recent call last):
File "word2vec.py", line 160, in <module>
x_test = np.array([word2id[w] for w in eval_words])
File "word2vec.py", line 160, in <listcomp>
x_test = np.array([word2id[w] for w in eval_words])
KeyError: 'five'
The script has:
# Words for testing.
x_test = np.array([word2id[w] for w in eval_words])
Still getting this with TF 2.6.2, CUDA11.0
Traceback (most recent call last):
File "word2vec.py", line 158, in <module>
for step in xrange(1, num_steps + 1):
NameError: name 'xrange' is not defined