stefbraun / rnn_benchmarks

RNN benchmarks of pytorch, tensorflow and theano
87 stars 18 forks source link

tensorflow 4x320LTSC ctc is broken #1

Closed damageboy closed 6 years ago

damageboy commented 6 years ago

I get the following error with TF 1.7:

Traceback (most recent call last):
  File "4x320-LSTM_ctc/bench_tensorflow.py", line 84, in <module>
    _, output = sess.run([train_step, pred], feed_dict={x: bX, y: bY, x_len: b_lenX})
  File "/home/dans/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 905, in run
    run_metadata_ptr)
  File "/home/dans/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1116, in _run
    str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (2500, 2) for Tensor 'Placeholder_4:0', which has shape '(?, 1)'

I've managed to "fix" this, by changing the placeholder dimensions to this:

y = tf.sparse_placeholder(tf.int32, [None, 2])

I'm just not sure this is correct at all...

While on the subject, I see that the code has not been update in a while...

This isn't a problem by itself, but do you still it is a relevant resource for RNN benchmarks / best practices?

stefbraun commented 6 years ago

Thanks for testing! The current repository is only compatible with tensorflow 1.2. I will update the repository to use the latest theano (1.0.1), tensorflow (1.7) and pytorch (0.3) versions soon, so the benchmarks will stay relevant.

damageboy commented 6 years ago

Thanks for all the work.

Is there a reason tf / pytorch have a 5x factor in RNNs?

You seem to show that and running the benchmarks half a year later seemed to repeat those results...

Is pytorch that much better? Or is it a difference in how/what the networks achieve...?

stefbraun commented 6 years ago

Sorry for the late answer. The benchmarks are now upgraded to the latest version of each framework and more LSTM implementations are included. TensorFlow is as fast as PyTorch when using the cuDNN LSTM implementation.

LSTMs are complex neural network units that allow for various degrees of optimization. More details on optimization are given in the paper detailing the cuDNN LSTM implementation (Link 1) or the LSTM benchmarks paper (Link 2).

damageboy commented 6 years ago

Thank you for all the hard work of keeping this up to date. This repository has proven itself to be invaluable for me as I'm trying to make my first steps into using these Frameworks. Again, I want to thank you for all the time and energy you put into this