thunlp / OpenNE

An Open-Source Package for Network Embedding (NE)
MIT License
1.68k stars 485 forks source link

Problem with LINE #63

Closed msaebi closed 4 years ago

msaebi commented 5 years ago

I am using LINE for link prediction on my graph. When I run LINe on the entire graph, I get no error. However, when I run it on the training graph for link prediction, I get the following error:

_"ValueError: Variable model/embeddings1 already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTOREUSE in VarScope?"

What I realized is that LINE keeps training multiple times, as if it never reaches a stopping loss. I guess that's where it needs to reuse the variable. I don't understand why this happens.

I set "reuse=tf.AUTO_REUSE" in tf.variablescope, to see if it stops after multiple training sessions, but after 2-3 training times I get the following error: "Trying to share variable model/embeddings1, but specified shape (518, 1) and found shape (517, 1)."_

Do you have any idea what's happening here?

zzy14 commented 5 years ago

Hi, can you provide the args you used?

msaebi commented 5 years ago

Hi,

The arguments are representation size (128), and order (2). All other parameters are the default.

Thanks,

On Sat, Dec 29, 2018 at 6:44 AM Zhengyan Zhang notifications@github.com wrote:

Hi, can you provide the args you used?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/thunlp/OpenNE/issues/63#issuecomment-450486984, or mute the thread https://github.com/notifications/unsubscribe-auth/AjSq8kjg6-5JUOIqk_AisM2GtboyN3H-ks5u91WfgaJpZM4ZkKeq .

-- Mandana Saebi


https://engineering.nd.edu/profiles/msaebi2

https://www.linkedin.com/in/mandana-saebi-832716a5/

msaebi commented 5 years ago

Do you have any comments or suggestions for my issue? I'd appreciate your help.

zzy14 commented 5 years ago

Do you mean that the entire graph is ok for your code and the training graph caused the error?

msaebi commented 5 years ago

I'm not sure if it's the training graph or the way I've used your code. For link prediction, I run the following commands to get the embeddings on the training graph:

1.model = line.LINE(train_graph, rep_size=dim)

  1. Vectors = model.vectors

And it keeps running over and over until it throws the above errors, and never goes to line 2. While in fact in each run I can see the embeddings are generated.

zzy14 commented 5 years ago

Did you use line.LINE() twice in the code? Just like line.LINE(whole_graph, rep_size=dim) and line.LINE(train_graph, rep_size=dim).

msaebi commented 5 years ago

No. Only once. I eventually got it to work by running the shell command in the Jupyter notebook (using !) For some reason, it works this way, but not using line.LINE().