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

Problems in tensorflow 1.2.0 #3

Closed
tyashima opened this issue Jun 26, 2017 · 11 comments
Closed

Problems in tensorflow 1.2.0 #3

tyashima opened this issue Jun 26, 2017 · 11 comments

Comments

@tyashima
Copy link

Hi, I'd like to run your rnn_gan.py, but probably because I'm using the latest version of tensorflow,
I have a problem. The script doesn't work.
I modified several lines because in tensorflow 1.2.0 they change the ordering, notation, and so on.
Also, since we don't have tf.nn.bidirectional_rnn in tensorflow 1.2.0, I tried other bidirectional rnn.
Then I got some errors, (mostly ValueErrors, rank incorrespondence, different input shape, etc...)

I'm using Ubuntu 14.04 with GeForce GTX TITAN X (12GB).
Is it because of the different version of tensorflow? or Am I missing some points?
Also, could you tell me which version of tensorflow you're using?

Thanks.

@olofmogren
Copy link
Owner

olofmogren commented Jun 26, 2017 via email

@tyashima
Copy link
Author

Thank you for your reply.

As I said before, I modified the script and I thought it would work, but somehow I got an error.
so let me clarify what is happening to me.

When I type this
python rnn_gan_mod.py --model small --datadir midis --traindir traindata --select_validation_percentage 20 --select_test_percentage 20

I got this error (and some outputs for your reference).

num_song_features:4
num_meta_features:155
songlength: 4
(20, 4, 4)
(20, 4, 4)
self._input_songdata shape (20, 4, 4)
generated data shape (20, 4)
Traceback (most recent call last):
File "rnn_gan_mod.py", line 864, in
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "rnn_gan_mod.py", line 684, in main
m = RNNGAN(is_training=True, num_song_features=num_song_features, num_meta_features=num_meta_features)
File "rnn_gan_mod.py", line 367, in init
self.real_d,self.real_d_features = self.discriminator(songdata_inputs, is_training, msg='real')
File "rnn_gan_mod.py", line 433, in discriminator
outputs, state_fw, state_bw = tf.nn.bidirectional_dynamic_rnn(cell_fw, cell_bw, inputs, initial_state_fw=self._initial_state_fw, initial_state_bw=self.initial_state_bw)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/rnn.py", line 375, in bidirectional_dynamic_rnn
time_major=time_major, scope=fw_scope)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/rnn.py", line 574, in dynamic_rnn
dtype=dtype)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/rnn.py", line 637, in dynamic_rnn_loop
for input
in flat_input)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/rnn.py", line 637, in
for input
in flat_input)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_shape.py", line 649, in with_rank_at_least
raise ValueError("Shape %s must have rank at least %d" % (self, rank))
ValueError: Shape (4, 20) must have rank at least 3

Did you encounter this sort of errors before?
and do you have any idea why it happens?
Any comments would be appreciated, thanks.

@JihadFenix
Copy link

Same errors for me too. Really interested for any pointers adapting your code to tf 1.2.

@kiwiloveskiwis
Copy link

Same problem here

@Ddedalous
Copy link

same problem here.anyone have any fixes?

@RFirstman
Copy link

I changed tf.nn.bidirectional_dynamic_rnn to tf.nn.static_bidirectional_rnn, and was able to get past the error posted above. In addition, a few lines above this, there are two statements that contain tf.nn.rnn_cell.MultiRNNCell([lstm_cell] * FLAGS.num_layers_d, state_is_tuple=True). An array of lstm_cell is being made, but each of these refers to the same cell. So, I fixed it by making a simple function called getcell() that sets up the LSTM as usual, but I call it FLAGS.num_layers_d times to make that many distinct cells. So, those statements should now read tf.nn.rnn_cell.MultiRNNCell([getcell() for _ in range(FLAGS.num_layers_d)], state_is_tuple=True)

@olofmogren
Copy link
Owner

Please create a pull request, @RFirstman!

@bbrito
Copy link

bbrito commented Nov 27, 2018

@RFirstman could you share your fixes?

@RFirstman
Copy link

My fixes were only band-aid solutions, unfortunately. I was unable to get it to work following my above advice. However, I did find a fork that does fix the issues and uses TensorFlow 1.4.

https://github.com/dhruvsharma1992/Music-generation-cRNN-GAN

@bbrito
Copy link

bbrito commented Nov 27, 2018

Ok cool! I will try it! Thank you so much!

@olofmogren
Copy link
Owner

I have now incorporated the changes made by Dhruv Sharma into the original repo. It now runs and trains on TF 1.x.

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

7 participants