Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facing the error #16

Closed
mmkjj opened this issue Apr 29, 2020 · 8 comments
Closed

Facing the error #16

mmkjj opened this issue Apr 29, 2020 · 8 comments

Comments

@mmkjj
Copy link

mmkjj commented Apr 29, 2020

RelGAN\oracle\oracle_gan\oracle_train.py", line 265, in get_losses
log_pg = tf.reduce_mean(tf.log(gen_o + EPS)) # [1], measures the log p_g(x)
TypeError: unsupported operand type(s) for +: 'TensorArray' and 'float'

Actually it also happends in real_train.py
I used the same environment ( Tensorflow1.4, python3.5)
Why :(

@weilinie
Copy link
Owner

The error seems come from gen_o has not been properly converted to a Tensor from a TenorArray. Could you add gen_o.stack() in your code? I also updated the rmc_att and rmc_vdcnn in case that you were using them.

@mmkjj
Copy link
Author

mmkjj commented Apr 30, 2020

But after adding gen_o.stack(),Another Error happended:

\oracle\oracle_gan\oracle_train.py", line 314, in get_train_ops
temp_train_op = temp_optimizer.apply_gradients(zip(temp_grads, [temperature]))
lib\site-packages\tensorflow\python\training\optimizer.py", line 472, in apply_gradients
([str(v) for _, _, v in converted_grads_and_vars],))
ValueError: No gradients provided for any variable: ['<tensorflow.python.training.optimizer._RefVariableProcessor object at 0x000001CF5ED1C390>'].

@weilinie
Copy link
Owner

Not sure where you added gen_o.stack(). Can you confirm if you are using rmc_att or rmc_vdcnn? If so, maybe you can pull it again and see if you can run properly.

@mmkjj
Copy link
Author

mmkjj commented Apr 30, 2020

I changed the get_losses() function in oracle_train.py:
from log_pg = tf.reduce_mean(tf.log(gen_o + EPS))
to 'log_pg = tf.reduce_mean(tf.log(gen_o.stack() + EPS))'
I used the default parameters, So I think that the generator and discriminator are both rmc_att, and type of the GAN is standard

@weilinie
Copy link
Owner

OK, there is something wrong with rmc_att and I fixed it. Also, I changed the default GAN architecture in run.py to rmc_vanilla, because all the experiments in the paper are based on rmc_vanilla actually. Can you pull it again?

@mmkjj
Copy link
Author

mmkjj commented Apr 30, 2020

I downloaded all of your new code again,. This time I think the default GAN architecture is rmc_vanilla.
However it seems that I'm facing a new Error :

oracle\oracle_gan\oracle_train.py", line 355, in get_metric_summary_op
metric_summary_op = tf.summary.merge(metrics_sum)
lib\site-packages\tensorflow\python\summary\summary.py", line 271, in merge
val = _gen_logging_ops._merge_summary(inputs=inputs, name=name)
lib\site-packages\tensorflow\python\ops\gen_logging_ops.py", line 314, in _merge_summary
"MergeSummary", inputs=inputs, name=name)
lib\site-packages\tensorflow\python\framework\op_def_library.py", line 570, in _apply_op_helper
(input_name, op_type_name, len(values), num_attr.minimum))
ValueError: List argument 'inputs' to 'MergeSummary' Op with length 0 shorter than minimum length 1.

@weilinie
Copy link
Owner

This is because all the metrics are set to False with the default setting in run.py (line 41-45). You can set at least one of the metrics to True to avoid this issue.

@mmkjj
Copy link
Author

mmkjj commented Apr 30, 2020

Oh,solved..
Thank you very much :)

@weilinie weilinie closed this as completed Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants