LantaoYu / SeqGAN

Implementation of Sequence Generative Adversarial Nets with Policy Gradient
2.09k stars 710 forks source link

global_variables_initializer error - tensor flow 12.1 #7

Closed GenTxt closed 7 years ago

GenTxt commented 7 years ago

Hi.

I would like to start generating models from my own data but I'm unable to get the code working. Running ubuntu 16 & 14 64 bit and current tensorflow 12.1 on nvidia gpu. I've checked several forums and there are similar issues with tensorflow 12.

If this cannot be fixed is it possible to post your previous code that works on earlier versions of tensorflow?

Thanks

Traceback (most recent call last): File "pretrain_experiment.py", line 123, in main() File "pretrain_experiment.py", line 93, in main sess.run(tf.global_variables_initializer) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 766, in run run_metadata_ptr) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 951, in _run fetch_handler = _FetchHandler(self._graph, fetches, feed_dict_string) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 407, in init self._fetch_mapper = _FetchMapper.for_fetch(fetches) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 238, in for_fetch return _ElementFetchMapper(fetches, contraction_fn) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 271, in init % (fetch, type(fetch), str(e))) TypeError: Fetch argument <function global_variables_initializer at 0x7fb92909bb18> has invalid type <type 'function'>, must be a string or Tensor. (Can not convert a function into a Tensor or Operation.)

Similar error when running sequence_gan.py

eecrazy commented 7 years ago

sess.run(tf.global_variables_initializer) should be sess.run(tf.global_variables_initializer()) this correct this error.

eecrazy commented 7 years ago

I am running the code using latest version of tensorflow.

GenTxt commented 7 years ago

Thanks for the quick reply. I made the changes and the code is working fine now with the numeric data file. :)

The only issue remaining is the first one: https://github.com/LantaoYu/SeqGAN/issues/6

How does a user generate target_params.pkl to use with text file? Looking forward to your reply.

I tried processing a small text corpus with the existing target_params.pkl and it threw this error. Guess it was expecting numeric data.

Traceback (most recent call last): File "sequence_gan.py", line 257, in main() File "sequence_gan.py", line 156, in main gen_data_loader.create_batches(positive_file) File "/home/aaron/Desktop/SeqGAN_tf_12_only/MLE_SeqGAN/gen_dataloader.py", line 15, in create_batches parse_line = [int(x) for x in line] ValueError: invalid literal for int() with base 10: 'First'

eecrazy commented 7 years ago

@GenTxt please refer to question #6.