TrustAGI-Lab / ARGA

This is a TensorFlow implementation of the Adversarially Regularized Graph Autoencoder(ARGA) model as described in our paper: Pan, S., Hu, R., Long, G., Jiang, J., Yao, L., & Zhang, C. (2018). Adversarially Regularized Graph Autoencoder for Graph Embedding, [https://www.ijcai.org/proceedings/2018/0362.pdf].
MIT License
185 stars 58 forks source link

got this error, please help! #9

Open hellomuse opened 5 years ago

hellomuse commented 5 years ago

Traceback (most recent call last): File "/Users/linda/mywork/ARGA-master/ARGA/arga/run.py", line 18, in runner.erun() File "/Users/linda/mywork/ARGA-master/ARGA/arga/link_prediction.py", line 27, in erun placeholders = get_placeholder(feas['adj']) KeyError: 'adj'

EdisonLeeeee commented 5 years ago

Traceback (most recent call last): File "/Users/linda/mywork/ARGA-master/ARGA/arga/run.py", line 18, in runner.erun() File "/Users/linda/mywork/ARGA-master/ARGA/arga/link_prediction.py", line 27, in erun placeholders = get_placeholder(feas['adj']) KeyError: 'adj'

I met this problem, too. And I solved it by using python with version 3.7, and I run it successfully now.

Using py37, However, you may need to modify several pieces of code.

TrabelsiAhmed commented 4 years ago

Traceback (most recent call last): File "/Users/linda/mywork/ARGA-master/ARGA/arga/run.py", line 18, in runner.erun() File "/Users/linda/mywork/ARGA-master/ARGA/arga/link_prediction.py", line 27, in erun placeholders = get_placeholder(feas['adj']) KeyError: 'adj'

I met this problem, too. And I solved it by using python with version 3.7, and I run it successfully now.

Using py37, However, you may need to modify several pieces of code.

Hello EdisonLeeeee,

I am trying to use the ARGA model with py37 too. So I need to modify the code in order to make it work. I am having some problems with that however. Could you be contact me? I could use your help.

EdisonLeeeee commented 4 years ago

Traceback (most recent call last): File "/Users/linda/mywork/ARGA-master/ARGA/arga/run.py", line 18, in runner.erun() File "/Users/linda/mywork/ARGA-master/ARGA/arga/link_prediction.py", line 27, in erun placeholders = get_placeholder(feas['adj']) KeyError: 'adj'

I met this problem, too. And I solved it by using python with version 3.7, and I run it successfully now. Using py37, However, you may need to modify several pieces of code.

Hello EdisonLeeeee,

I am trying to use the ARGA model with py37 too. So I need to modify the code in order to make it work. I am having some problems with that however. Could you be contact me? I could use your help.

Hi TrabelsiAhmed.

Can I do anything to help?

TrabelsiAhmed commented 4 years ago

Hi,

I am trying to debug the code step by step. Currently I am stuck with something that seems to be easy to solve.

I am getting this error:

Traceback (most recent call last):

File "C:\ARGA\ARGA\arga\run.py", line 18, in runner.erun()

File "C:\ARGA\ARGA\arga\link_prediction.py", line 25, in erun feas = format_data(self.data_name)

File "C:\ARGA\ARGA\arga\constructor.py", line 43, in format_data adj, features, y_test, tx, ty, test_maks, true_labels = load_data(data_name)

File "C:\ARGA\ARGA\arga\input_data.py", line 24, in load_data objects.append(pkl.load(open("data/ind.{}.{}".format(dataset, names[i])), encoding = 'ansi', errors = 'ignore'))

File "E:\Programme\py\envs\keras-gpu\lib\encodings\cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0]

UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 34: character maps to

I tried to solve it by trying different encodings, by addind errors = 'ignore'. But nothing works. Can you please tell, what did you do to solve this?

Thank you in advance

EdisonLeeeee commented 4 years ago

well, it is easy to solve this problem.

First I will introduce the solution below:

change the code in input.py, line 23-25:

    for i in range(len(names)):
        objects.append(pkl.load(open("data/ind.{}.{}".format(dataset, names[i]))))

to

    for name in names:
        with open("data/ind.{}.{}".format(dataset, name), 'rb') as f:
            objects.append(pkl.load(f, encoding='latin1'))

It occurs because of the version of pickle. (Not exactly!)

Hope it help for you!

TrabelsiAhmed commented 4 years ago

Yes it worked, thank you so much!

Of course I got another error, i will try to solve it myself.

Is it okey to contact you again if i get in trouble again? xD

EdisonLeeeee commented 4 years ago

Sure, but I'm not sure I'll be able to reply in time. XD

TrabelsiAhmed commented 4 years ago

No problem, only if you have time ofcourse :D

TrabelsiAhmed commented 4 years ago

Hi, I need help again xD

Traceback (most recent call last):

File "C:\ARGA\ARGA\arga\run.py", line 18, in runner.erun()

File "C:\ARGA\ARGA\arga\link_prediction.py", line 34, in erun opt = get_optimizer(model_str, ae_model, discriminator, placeholders, feas['pos_weight'], feas['norm'], d_real, feas['num_nodes'])

File "C:\ARGA\ARGA\arga\constructor.py", line 90, in get_optimizer d_fake=d_fake)

File "C:\ARGA\ARGA\arga\optimizer.py", line 43, in init beta1=0.9, name='adam2').minimize(self.generator_loss, var_list=en_var)

File "C:\Users\trahm\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\training\optimizer.py", line 413, in minimize name=name)

File "C:\Users\trahm\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\training\optimizer.py", line 597, in apply_gradients self._create_slots(var_list)

File "C:\Users\trahm\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\training\adam.py", line 131, in _create_slots self._zeros_slot(v, "m", self._name)

File "C:\Users\trahm\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\training\optimizer.py", line 1156, in _zeros_slot new_slot_variable = slot_creator.create_zeros_slot(var, op_name)

File "C:\Users\trahm\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\training\slot_creator.py", line 190, in create_zeros_slot colocate_with_primary=colocate_with_primary)

File "C:\Users\trahm\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\training\slot_creator.py", line 164, in create_slot_with_initializer dtype)

File "C:\Users\trahm\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\training\slot_creator.py", line 74, in _create_slot_var validate_shape=validate_shape)

File "C:\Users\trahm\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\ops\variable_scope.py", line 1504, in get_variable aggregation=aggregation)

File "C:\Users\trahm\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\ops\variable_scope.py", line 1247, in get_variable aggregation=aggregation)

File "C:\Users\trahm\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\ops\variable_scope.py", line 567, in get_variable aggregation=aggregation)

File "C:\Users\trahm\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\ops\variable_scope.py", line 519, in _true_getter aggregation=aggregation)

File "C:\Users\trahm\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\ops\variable_scope.py", line 886, in _get_single_variable "reuse=tf.AUTO_REUSE in VarScope?" % name)

ValueError: Variable arga_32/Encoder/e_dense_1_vars/weights/adam2/ does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=tf.AUTO_REUSE in VarScope?

I don't have any idea to solve this :/

EdisonLeeeee commented 4 years ago

I'm not quite sure why this is happening, but I think it may caused by the code in optimizer.py:

self.generator_optimizer = tf.train.AdamOptimizer(learning_rate=FLAGS.discriminator_learning_rate, beta1=0.9, name='adam2').minimize(self.generator_loss, var_list=en_var)

There may have something wrong with that var_list=en_var, the variable of arga_32/Encoder/e_dense_1_vars/weights/adam2/ does not exist and it's really not going to do, maybe you can print it en_var.

BTW, it works well in my environment (py 3.7, tensorflow 1.12.0), MayI ask you that the version of tensorflow?

TrabelsiAhmed commented 4 years ago

I am using tensorflow 2.0.0. Should i downgrade it?

EdisonLeeeee commented 4 years ago

I am using tensorflow 2.0.0. Should i downgrade it?

Yes it must be. Tf2.0 if quite different from the previous version. You can downgrade it to any version except for 2.0 (1.12 1.13 1.14 is availiable).

TrabelsiAhmed commented 4 years ago

I will do it and tell you if it works. Thank you :D

EdisonLeeeee commented 4 years ago

That's all right. Hope it works (if I'm not mistaken) : )

TrabelsiAhmed commented 4 years ago

It worked !! Thank you man 💃

EdisonLeeeee commented 4 years ago

Great! : )

DreamerDW commented 4 years ago

Hello, I also encountered this problem, how did you solve it? Thank you!

Billy1900 commented 4 years ago

Could anyone give me the code of python3.7 version? I try to transform it but met some problems.

Billy1900 commented 4 years ago

Could anyone give me the code of python3.7 version? I try to transform it but met some problems.

I made it. Thanks!