Search code examples
pythontensorflowdeep-learningword2vec

tensorflow Word2Vec error


I downloaded source code of word2vec in github below. https://github.com/tensorflow/models/blob/master/tutorials/embedding/word2vec.py I am using tensorflow on pycharm. I'm using windows 10. I installed tensorflow, python, numpy which are needed to use tensorflow on windows. In word2vec.py source code, I set the savepath, trainpath, and evalpath. I downloaded the training text file from http://mattmahoney.net/dc/text8.zip which the source code recommended. But when I ran the code I get the error below:

C:\Users\Sungjin\AppData\Local\Programs\Python\Python35\python.exe C:/Users/Sungjin/PycharmProjects/untitled/ImpW2V.py Traceback (most recent call last): File "C:/Users/Sungjin/PycharmProjects/untitled/ImpW2V.py", line 43, in word2vec = tf.load_op_library(os.path.join(os.path.dirname(os.path.realpath(file)), 'word2vec_ops.so')) File "C:\Users\Sungjin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\load_library.py", line 64, in load_op_library None, None, error_msg, error_code) tensorflow.python.framework.errors_impl.NotFoundError: C:\Users\Sungjin\PycharmProjects\untitled\word2vec_ops.so not found

Process finished with exit code 1

I checked Readme.md file on github but there is nothing mentioned about the file. It seems I have to make word2Vec_ops.so file but I don't know how.


Solution

  • You're using windows and .so files are (almost) the equivalent of DLL files but under unix systems. So, even if you could find the .so file, that wouldn't work under windows.

    If you're willing to install linux and do everything from there, in the same place where you found word2vec.py you can also find how to build the .so file. ( https://github.com/tensorflow/models/tree/master/tutorials/embedding , it says You will need to compile the ops as follows ). If you don't know how linux and g++ / gcc work, you should probably switch to another project that is windows specific.