phanein / deepwalk

DeepWalk - Deep Learning for Graphs
http://www.perozzi.net/projects/deepwalk/
Other
2.69k stars 825 forks source link

AttributeError: 'Word2Vec' object has no attribute 'wv' #97

Open YutingSun163 opened 5 years ago

YutingSun163 commented 5 years ago

When I run main.py, an error occured: Traceback (most recent call last): File "main.py", line 168, in sys.exit(main()) File "main.py", line 165, in main process(args) File "main.py", line 101, in process model.wv.save_word2vec_format(args.output) AttributeError: 'Word2Vec' object has no attribute 'wv'

My python version is 3.7.0, and gensim version 0.10.2

GTmac commented 5 years ago

The gensim version is too old -- please try the latest version of gensim and let me know if that works. Thanks!

YutingSun163 commented 5 years ago

I tried upgrade the gensim version to the latest, but new error occur:

Traceback (most recent call last): File "main.py", line 17, in from gensim.models import Word2Vec File "/Users/apple/Library/Python/3.7/lib/python/site-packages/gensim-3.8.0-py3.7-macosx-10.9-x86_64.egg/gensim/init.py", line 5, in from gensim import parsing, corpora, matutils, interfaces, models, similarities, summarization, utils # noqa:F401 File "/Users/apple/Library/Python/3.7/lib/python/site-packages/gensim-3.8.0-py3.7-macosx-10.9-x86_64.egg/gensim/parsing/init.py", line 4, in from .preprocessing import (remove_stopwords, strip_punctuation, strip_punctuation2, # noqa:F401 File "/Users/apple/Library/Python/3.7/lib/python/site-packages/gensim-3.8.0-py3.7-macosx-10.9-x86_64.egg/gensim/parsing/preprocessing.py", line 42, in from gensim import utils File "/Users/apple/Library/Python/3.7/lib/python/site-packages/gensim-3.8.0-py3.7-macosx-10.9-x86_64.egg/gensim/utils.py", line 45, in from smart_open import open ImportError: cannot import name 'open' from 'smart_open' (/Users/apple/Library/Python/3.7/lib/python/site-packages/smart_open/init.py)

YutingSun163 commented 5 years ago

And also I got error : file not exist: karate.embeddings, although I have manually created one.

GTmac commented 5 years ago

Sorry for the late reply. For posterity, it seems that gensim is not properly installed on your machine.

GTmac commented 5 years ago

And also I got error : file not exist: karate.embeddings, although I have manually created one.

This is the embeddings file produced by DeepWalk on the Karate graph -- it should not be manually created.