ofirnachum / sequence_gan

Generative adversarial networks (GAN) applied to sequential data via recurrent neural networks (RNN).
395 stars 124 forks source link

is next_sequence() {of train.py line: 43} a function()? #15

Open dhirajpatnaik16297 opened 7 years ago

dhirajpatnaik16297 commented 7 years ago

dear ofirnachum what does seq=next_sequence() in train.py mean? I don't think it is working for characters as it is showing typeerror: list object is not callable for book_demo.py but it is working for random numbers of simple_demo.py. please make me understand the book_demo.py. if i dont use lambda then its showing this error: next_sequence=get_random_sequence(token_stream, word2idx), TypeError: 'list' object is not callable and if i use lambda then the error is: Traceback (most recent call last): File "/home/dkp/Desktop/GANs/sequence_gan-master/getdata.py", line 102, in words=words) File "/home/dkp/Desktop/GANs/sequence_gan-master/test_train.py", line 29, in trainepoch , g_loss, g_pred = trainable_model.pretrain_step(sess, seq) File "/home/dkp/Desktop/GANs/sequence_gan-master/model.py", line 241, in pretrain_step self.h0: np.random.normal(size=self.hidden_dim)}) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 778, in run run_metadata_ptr) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 982, in _run feed_dict_string, options, run_metadata) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1032, in _do_run target_list, options, run_metadata) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1052, in _do_call raise type(e)(node_def, op, message) FailedPreconditionError: Attempting to use uninitialized value discriminator/Variable_6 [[Node: discriminator/Variable_6/read = IdentityT=DT_FLOAT, _class=["loc:@discriminator/Variable_6"], _device="/job:localhost/replica:0/task:0/cpu:0"]]

Caused by op u'discriminator/Variable_6/read', defined at: File "", line 1, in File "/usr/lib/python2.7/idlelib/run.py", line 115, in main ret = method(*args, **kwargs) File "/usr/lib/python2.7/idlelib/run.py", line 325, in runcode exec code in self.locals File "/home/dkp/Desktop/GANs/sequence_gan-master/getdata.py", line 89, in trainable_model = get_trainable_model(num_words) File "/home/dkp/Desktop/GANs/sequence_gan-master/getdata.py", line 76, in get_trainable_model SEQ_LENGTH, START_TOKEN) File "/home/dkp/Desktop/GANs/sequence_gan-master/model.py", line 54, in init self.d_recurrent_unit = self.create_recurrent_unit(self.d_params) # maps h_tm1 to h_t for discriminator File "/home/dkp/Desktop/GANs/sequence_gan-master/model.py", line 295, in create_recurrent_unit self.U_hh = tf.Variable(self.init_matrix([self.hidden_dim, self.hidden_dim])) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variables.py", line 197, in init expected_shape=expected_shape) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variables.py", line 316, in _init_from_args self._snapshot = array_ops.identity(self._variable, name="read") File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 1338, in identity result = _op_def_lib.apply_op("Identity", input=input, name=name) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 768, in apply_op op_def=op_def) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2336, in create_op original_op=self._default_original_op, op_def=op_def) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1228, in init self._traceback = _extract_stack()

FailedPreconditionError (see above for traceback): Attempting to use uninitialized value discriminator/Variable_6 [[Node: discriminator/Variable_6/read = IdentityT=DT_FLOAT, _class=["loc:@discriminator/Variable_6"], _device="/job:localhost/replica:0/task:0/cpu:0"]] please help me...