node2vec icon indicating copy to clipboard operation
node2vec copied to clipboard

DeprecationWarning: Deprecated. Use model.wv.save_word2vec_format instead.

Open yuedeji opened this issue 8 years ago • 12 comments

I met this error when I tried to run the karate sample graph. I searched online and the reason is that gensim updates their word2vec model as shown here https://groups.google.com/forum/#!topic/gensim/pjZo1ZunIZA Could you help to solve this issue?

Details: python src/main.py --input graph/karate.edgelist Walk iteration: 1 / 10 2 / 10 3 / 10 4 / 10 5 / 10 6 / 10 7 / 10 8 / 10 9 / 10 10 / 10 Traceback (most recent call last): File "src/main.py", line 104, in main(args) File "src/main.py", line 100, in main learn_embeddings(walks) File "src/main.py", line 88, in learn_embeddings model.save_word2vec_format(args.output) File "/usr/local/lib/python2.7/dist-packages/gensim/models/word2vec.py", line 1438, in save_word2vec_format raise DeprecationWarning("Deprecated. Use model.wv.save_word2vec_format instead.") DeprecationWarning: Deprecated. Use model.wv.save_word2vec_format instead.

yuedeji avatar Jun 02 '17 15:06 yuedeji

Got the same error here. Did you fix it ?

carodak avatar Jun 30 '17 10:06 carodak

No, I didn't. We can either try to use an older version of word2vec or change the source code of using word2vec. While, I am counting on the authors to fix this. If you get any lucky, please let me know.

yuedeji avatar Jun 30 '17 14:06 yuedeji

Hello,

I found the solution here : https://github.com/aditya-grover/node2vec/issues/11

So he said : "line 88 in main.py should be changed to model.wv.save_word2vec_format"

Best reguards

carodak avatar Jun 30 '17 18:06 carodak

This change can make the code run. But the format of the embedding file is broken, which cannot be loaded again. Is there any solution to this problem?

WillzZhu avatar Nov 02 '17 19:11 WillzZhu

I am not sure that I get it. Do you mean that this change broke your input (adjacences matrixes) ? It doesn't do that to me. I can properly load again and again my matrixes. I made some change not loading adjacences from files but from my numpy graphs. Anyway, it was working when I did it with adjacences list. I could load the same adjacences list 2 times or more.

Le jeudi 2 novembre 2017, HZ [email protected] a écrit :

This change can make the code run. But the format of the embedding file is broken, which cannot be loaded again.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/aditya-grover/node2vec/issues/18#issuecomment-341538151, or mute the thread https://github.com/notifications/unsubscribe-auth/AYHIm5X1c63mikw2kQpPEkXoK1e_WxU-ks5syh0pgaJpZM4NubXp .

carodak avatar Nov 06 '17 09:11 carodak

Sorry I mean that the input is adjacency list. And I can properly load them again and again

Le lundi 6 novembre 2017, Caro Dak [email protected] a écrit :

I am not sure that I get it. Do you mean that this change broke your input (adjacences matrixes) ? It doesn't do that to me. I can properly load again and again my matrixes. I made some change not loading adjacences from files but from my numpy graphs. Anyway, it was working when I did it with adjacences list. I could load the same adjacences list 2 times or more.

Le jeudi 2 novembre 2017, HZ <[email protected] javascript:_e(%7B%7D,'cvml','[email protected]');> a écrit :

This change can make the code run. But the format of the embedding file is broken, which cannot be loaded again.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/aditya-grover/node2vec/issues/18#issuecomment-341538151, or mute the thread https://github.com/notifications/unsubscribe-auth/AYHIm5X1c63mikw2kQpPEkXoK1e_WxU-ks5syh0pgaJpZM4NubXp .

carodak avatar Nov 06 '17 09:11 carodak

Oh the adjacency list (input) is fine, but my embedding matrix (output file) is broken, with wrong dimension (output [14, 128] while it should be [34, 128] in author's experiment), mixed with '[' and ']' symbols :(

I'm sure the parser arguments are all correct.

WillzZhu avatar Nov 07 '17 03:11 WillzZhu

I don't know what to say. I did not have such problems (I was using python 3, I made some change to make it work with python 3). The problem is that I didn't take a look at my code since 3 months and I do not have a computer with everything installed in atm. It's a bit messy, ahah. I can just suggest to take a look at my code even if it's node2vec applied for something else you may find something usefull.

2017-11-07 4:51 GMT+01:00 HZ [email protected]:

Oh the adjacency list (input) is fine, but my embedding matrix (output) is broken, with wrong dimension (output 14128 while it should be 34128 in author's experiment), mixed with '[' and ']' symbols :(

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/aditya-grover/node2vec/issues/18#issuecomment-342367847, or mute the thread https://github.com/notifications/unsubscribe-auth/AYHIm7CMxy15NEo2TgH-8eND7AaiktT3ks5sz9OzgaJpZM4NubXp .

carodak avatar Nov 08 '17 19:11 carodak

Make sure you're using the correct python package versions. I'm using the python 2.7 and the package versions specified in the requirements.txt file, not having any issues.

alavertu avatar Mar 18 '18 06:03 alavertu

Same for me. I used the exact versions specified in the requirements.txt file and the code ran successfully. I ran the following: pip install networkx==1.11 numpy==1.11.2 gensim==0.13.3 And then ran this: python src/main.py --input graph/karate.edgelist --output emb/karate.emd Code ran successfully. :)

urmisaha avatar Jan 22 '19 06:01 urmisaha

I'm using the python 2.7 and the package versions specified in the requirements.txt file, but the modules cannot be installed. 图像 001 图像 002 图像 003 How can I install the required modules correctly? Thank you very much!

king-zkai avatar Jun 19 '19 07:06 king-zkai

I am not getting any output graph just getting only 👍 Walk iteration: 1 / 10 2 / 10 3 / 10 4 / 10 5 / 10 6 / 10 7 / 10 8 / 10 9 / 10 10 / 10

amitmishramtech avatar Oct 22 '20 11:10 amitmishramtech