mozilla / DeepSpeech

DeepSpeech is an open source embedded (offline, on-device) speech-to-text engine which can run in real time on devices ranging from a Raspberry Pi 4 to high power GPU servers.
Mozilla Public License 2.0
25.29k stars 3.96k forks source link

Running on Tensorflow 1.0.0 #287

Closed lissyx closed 7 years ago

lissyx commented 7 years ago
$ ./bin/run-ldc93s1.sh 
+ export ds_importer=ldc93s1
+ export ds_train_batch_size=4
+ export ds_dev_batch_size=4
+ export ds_test_batch_size=4
+ export ds_epochs=2000
+ [ ! -f DeepSpeech.ipynb ]
+ jupyter-nbconvert --to script DeepSpeech.ipynb --stdout
+ python -u
[NbConvertApp] Converting notebook DeepSpeech.ipynb to script
WARNING:tensorflow:From util/text.py:147: pack (from tensorflow.python.ops.array_ops) is deprecated and will be removed after 2016-12-14.
Instructions for updating:
This op will be removed after the deprecation date. Please switch to tf.stack().
WARNING:tensorflow:From util/text.py:148: pack (from tensorflow.python.ops.array_ops) is deprecated and will be removed after 2016-12-14.
Instructions for updating:
This op will be removed after the deprecation date. Please switch to tf.stack().
WARNING:tensorflow:From /home/alex/codaz/Mozilla/DeepSpeech/tensorflow/tensorflowLocal/local/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py:1185: concat (from tensorflow.python.ops.array_ops) is deprecated and will be removed after 2016-12-14.
Instructions for updating:
This op will be removed after the deprecation date. Please switch to tf.concat_v2().
WARNING:tensorflow:From /home/alex/codaz/Mozilla/DeepSpeech/tensorflow/tensorflowLocal/local/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py:1185: concat (from tensorflow.python.ops.array_ops) is deprecated and will be removed after 2016-12-14.
Instructions for updating:
This op will be removed after the deprecation date. Please switch to tf.concat_v2().
WARNING:tensorflow:From util/text.py:164: concat (from tensorflow.python.ops.array_ops) is deprecated and will be removed after 2016-12-14.
Instructions for updating:
This op will be removed after the deprecation date. Please switch to tf.concat_v2().
WARNING:tensorflow:From util/text.py:130: unpack (from tensorflow.python.ops.array_ops) is deprecated and will be removed after 2016-12-14.
Instructions for updating:
This op will be removed after the deprecation date. Please switch to tf.unstack().
WARNING:tensorflow:From /home/alex/codaz/Mozilla/DeepSpeech/tensorflow/tensorflowLocal/local/lib/python2.7/site-packages/tensorflow/python/ops/rnn_cell_impl.py:145: pack (from tensorflow.python.ops.array_ops) is deprecated and will be removed after 2016-12-14.
Instructions for updating:
This op will be removed after the deprecation date. Please switch to tf.stack().
WARNING:tensorflow:From /home/alex/codaz/Mozilla/DeepSpeech/tensorflow/tensorflowLocal/local/lib/python2.7/site-packages/tensorflow/python/ops/rnn_cell_impl.py:145: pack (from tensorflow.python.ops.array_ops) is deprecated and will be removed after 2016-12-14.
Instructions for updating:
This op will be removed after the deprecation date. Please switch to tf.stack().
WARNING:tensorflow:From /home/alex/codaz/Mozilla/DeepSpeech/tensorflow/tensorflowLocal/local/lib/python2.7/site-packages/tensorflow/python/ops/rnn_cell_impl.py:145: pack (from tensorflow.python.ops.array_ops) is deprecated and will be removed after 2016-12-14.
Instructions for updating:
This op will be removed after the deprecation date. Please switch to tf.stack().
WARNING:tensorflow:From /home/alex/codaz/Mozilla/DeepSpeech/tensorflow/tensorflowLocal/local/lib/python2.7/site-packages/tensorflow/python/ops/rnn_cell_impl.py:145: pack (from tensorflow.python.ops.array_ops) is deprecated and will be removed after 2016-12-14.
Instructions for updating:
This op will be removed after the deprecation date. Please switch to tf.stack().
WARNING:tensorflow:From <stdin>:292: concat (from tensorflow.python.ops.array_ops) is deprecated and will be removed after 2016-12-14.
Instructions for updating:
This op will be removed after the deprecation date. Please switch to tf.concat_v2().
Traceback (most recent call last):
  File "<stdin>", line 1208, in <module>
  File "<stdin>", line 1116, in train
  File "<stdin>", line 895, in create_execution_context
  File "<stdin>", line 619, in get_tower_results
  File "<stdin>", line 441, in calculate_accuracy_and_loss
  File "/home/alex/codaz/Mozilla/DeepSpeech/tensorflow/tensorflowLocal/local/lib/python2.7/site-packages/tensorflow/python/ops/ctc_ops.py", line 133, in ctc_loss
    raise TypeError("Expected labels (first argument) to be a SparseTensor")
TypeError: Expected labels (first argument) to be a SparseTensor
kdavis-mozilla commented 7 years ago

This seems like a bug in TensorFlow not an API change.

The documentation[1] states the first argument inputs is a normal Tensor. However it also states labels the second argument is a SparseTensor.

We pass inputsas a normal Tensor and labels as a SparseTensor. So there should be no problem.

lissyx commented 7 years ago

Ah ah, next time, use named arguments I guess :D https://github.com/tensorflow/tensorflow/commit/e72ad6333ee0204b7d2df93df1f7a85ec4b9ab10

kdavis-mozilla commented 7 years ago

Yeah, that's an annoying API change for no good reason.

kdavis-mozilla commented 7 years ago

I guess we should address this issue by simply using named arguments here.

lissyx commented 7 years ago

Got most of the issues figured out, we should just ensure about that tf.variable_scope() thing.

lissyx commented 7 years ago

FYI the PR for TensorFlow is at https://github.com/mozilla/tensorflow/pull/7 and it contains not only fixes, but also updates warpctc python code to remove deprecated use of tf.concat(), changes PIP package naming (hopefully would avoid new upstream to install over warpctc build). With that build I could run LDC93S1 sample with both CTC and WarpCTC, successfully.

kentsommer commented 7 years ago

Using #324 as well as mozilla/tensorflow#7, I am able to run on LDC93S1 (tested only CTC, have not tested WarpCTC yet).

lissyx commented 7 years ago

On top of the changes for 0.12, we need to change back tf.concat_v2() to tf.concat()

lissyx commented 7 years ago

https://github.com/mozilla/DeepSpeech/pull/387

lissyx commented 7 years ago

Overfitting LDC93S1 without any problem.

lissyx commented 7 years ago

New PR: https://github.com/mozilla/DeepSpeech/pull/389

lissyx commented 7 years ago

This PR https://github.com/mozilla/tensorflow/pull/11 should be good enough now.

lissyx commented 7 years ago

PR mozilla/tensorflow#11 merged in https://github.com/mozilla/tensorflow/commit/616a8ea8626e318e98daa794197ec85a0bb8794a

lissyx commented 7 years ago

Automation has been switched to TF 1.0.0, relying on upstream official package (because of segfault when using ours. Debugging this is halted until further notice)

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.