DeepSpeech icon indicating copy to clipboard operation
DeepSpeech copied to clipboard

Training a model with ubuntu 16.04 using 64 bit machine

Open guruCDL opened this issue 9 years ago • 49 comments

Hi All,

Installed Tensorflow from source as per native_client read me.

Built tensorflow and native library successfully as well. make successful as well. Lib path has all the binaries which are required.

Tensorflow version installed from source - 1.4.0 gcc version - 5.4.0 os - ubuntuv version 16.04 using 64 bit machine python - 2.7

When i try to train a model below error occurs - is this related to cpu compatibility?

("deepspeech/ldc93s1"))

  • checkpoint_dir=/root/.local/share/deepspeech/ldc93s1
  • python -u DeepSpeech.py --train_files data/ldc93s1/ldc93s1.csv --dev_files data/ldc93s1/ldc93s1.csv --test_files data/ldc93s1/ldc93s1.csv --train_batch_size 1 --dev_batch_size 1 --test_batch_size 1 --n_hidden 494 --epoch 50 --checkpoint_dir /root/.local/share/deepspeech/ldc93s1 Traceback (most recent call last): File "DeepSpeech.py", line 468, in custom_op_module = tf.load_op_library(FLAGS.decoder_library_path) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/load_library.py", line 56, in load_op_library lib_handle = py_tf.TF_LoadLibrary(library_filename, status) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/errors_impl.py", line 473, in exit c_api.TF_GetCode(self.status.status)) tensorflow.python.framework.errors_impl.NotFoundError: native_client/libctc_decoder_with_kenlm.so: undefined symbol: _ZN10tensorflow10DEVICE_CPUE

Note- This error does not occur if i run tensorflow version 1.3.0 but the training will fail at the end saying illegal instruction(core dumped).

Any suggestions?

guruCDL avatar Oct 18 '17 22:10 guruCDL

I can also confirm the same issue on a CPU only machine. But the same on a GPU machine works

voidspacexyz avatar Oct 19 '17 06:10 voidspacexyz

1.4 is an unknown area, the CTC decoder was worked on against ~1.3.

lissyx avatar Oct 19 '17 07:10 lissyx

I guess @reuben can provide more insight, but I would advise either sticking to our prebuilt binaries and/or if you need to rebuild, using our tensorflow master https://github.com/mozilla/tensorflow

lissyx avatar Oct 19 '17 07:10 lissyx

@lissyx The problem with custom tensorflow is the need for me as an ops to maintain many versions and its usually not approved at multiple places. I know its a very vauge reason, but this is the reality. So if there is someway we could stick to the default tensorflow with a specific version, it just get much easier.

Will wait to hear from @reuben as well

voidspacexyz avatar Oct 19 '17 08:10 voidspacexyz

@lissyx I am currently running 1.3 tensorflow. Following is the details root@cdedce3dbcd9:/work/DeepSpeech# pip freeze | grep tensorflow tensorflow==1.3.0 tensorflow-tensorboard==0.1.8 So I guess, there is something else,that is going wrong.

voidspacexyz avatar Oct 19 '17 08:10 voidspacexyz

@voidspacexyz I can understand your admin issue, but for diagnosing problems we need to be sure it's not just a broken setup that triggers your bug. So far, you just confirm that you are running a prebuilt, upstream Tensorflow.

You really need to get that straight: either use ALL of ours prebuilt binaries (tensorflow, libctc, libdeepspeech), or build everything from compatible source code. Mixing prebuilt binaries would clearly trigger that kind of segfault (I know, I have been there, there might be differences in ABI, in headers, in data structure sizes).

Compatibility with upstream tensorflow cannot be guaranteed, because they don't guarantee C++ API stability. So they might have done some changes to 1.3 API between the snapshot we started worked on, and the release, and the same story can apply to 1.4.

lissyx avatar Oct 19 '17 09:10 lissyx

@voidspacexyz In your latest message, the Docker refers to https://index.taskcluster.net/v1/task/project.deepspeech.tensorflow.pip.cpu.0b3924976af2f14707702156973725ec5fd4a32d/artifacts/public/tensorflow_warpctc-1.3.0rc0-cp27-cp27mu-linux_x86_64.whl ... That's quite an old commit, and not the one https://index.taskcluster.net/v1/task/project.deepspeech.deepspeech.native_client.master.cpu/artifacts/public/native_client.tar.xz is getting linked against for sure.

lissyx avatar Oct 19 '17 10:10 lissyx

Please use:

  • https://index.taskcluster.net/v1/task/project.deepspeech.deepspeech.native_client.master.cpu/artifacts/public/native_client.tar.xz
  • https://index.taskcluster.net/v1/task/project.deepspeech.tensorflow.pip.master.cpu/artifacts/public/tensorflow_warpctc-1.3.0rc0-cp27-cp27mu-linux_x86_64.whl

lissyx avatar Oct 19 '17 10:10 lissyx

Also, the full log run would be useful to diagnose what is failing.

lissyx avatar Oct 19 '17 10:10 lissyx

I am currently building everything manually and testing it out, just to make sure I dont repeat these silly mistakes again. Once I finish, I will immediately update here. Also will update the docker accordingly.

PS : Thanks for the right links. There was a certain degree of confusion with that.

voidspacexyz avatar Oct 19 '17 10:10 voidspacexyz

FYI, all the prebuilt binaries are being built and tested on TaskCluster, training included. Technically, there's Docker below the TaskCluster linux instances, so there's no reason anything would not work on your side.

lissyx avatar Oct 19 '17 10:10 lissyx

@lissyx This is the gist I followed in a fresh ubuntu 16.04 docker.

https://gist.github.com/voidspacexyz/9890dfb02e0730acbfc218980c59fdc9

I am still stuck with Illegal instruction (core dumped) Can you have a look at it once ?

voidspacexyz avatar Oct 19 '17 11:10 voidspacexyz

If you built TensorFlow and libctc_decode_with_kenlm.so out of the same tensorflow source tree then there should be no symbol mismatches. I haven't personally tested with TensorFlow 1.4, I'll update my clone and rebuild to see if I run into the same problem.

reuben avatar Oct 19 '17 12:10 reuben

Illegal instruction is not segfault :-). @voidspacexyz Can you document your bazel build flags ?

lissyx avatar Oct 19 '17 12:10 lissyx

Something weird is going on with TensorFlow 1.4.0rc0, I recommend sticking with stable versions. I'll investigate more carefully before 1.4.0 is released, but I can't focus on that right now.

reuben avatar Oct 19 '17 12:10 reuben

@lissyx @reuben I am running tensorflow 1.3 and not 1.4. I just did a pip install tensorflow==1.3 , and I still havent compiled mozilla's tensorflow. That is something I am going to do now.Will update once done.

voidspacexyz avatar Oct 20 '17 05:10 voidspacexyz

@lissyx I have not been able to build mozilla's version of tensorflow . Any build instructions. From tensorflow-wrapctc I figured out, the tensorflow version is 1.3.0rc0 . I tried installing tensorflow==1.3.0rc0 from pypi, and this is the error I get.

root@1792d90ae9dc:/work/DeepSpeech# ./bin/run-ldc93s1.sh

  • [ ! -f DeepSpeech.py ]
  • [ ! -f data/ldc93s1/ldc93s1.csv ]
  • [ -d ]
  • python -c from xdg import BaseDirectory as xdg; print(xdg.save_data_path("deepspeech/ldc93s1"))
  • checkpoint_dir=/root/.local/share/deepspeech/ldc93s1
  • python -u DeepSpeech.py --train_files data/ldc93s1/ldc93s1.csv --dev_files data/ldc93s1/ldc93s1.csv --test_files data/ldc93s1/ldc93s1.csv --train_batch_size 1 --dev_batch_size 1 --test_batch_size 1 --n_hidden 494 --epoch 50 --checkpoint_dir /root/.local/share/deepspeech/ldc93s1 2017-10-20 06:36:32.353648: F tensorflow/core/platform/cpu_feature_guard.cc:35] The TensorFlow library was compiled to use AVX2 instructions, but these aren't available on your machine. Aborted (core dumped)

I am clearly missing something very silly here. BTW, just in case, I am running all this on a CPU only machine.

ALso in the same GIST, I have updated the bazel build flags and its relative error

voidspacexyz avatar Oct 20 '17 06:10 voidspacexyz

@voidspacexyz Well the error is explicit, you are using upstream tensorflow with AVX2 enabled and you system does not support that. There are two problems in your statement about 1.3.0rc0 ; first, you pick upstream with AVX2 :). Second, you get tricked by the versionning from Tensorflow, which seems to use 1.3.0rc0 all along dev period, so what we have with that version number might not be compatible with theirs.

There is really no reason you should not be able to build yourself. Looking at your gist, I see several problems:

  • -c opt and --config=opt does the same
  • you have --copt=-mavx2, you are going to have issues
  • what is that -k ?

I never ever saw that weird ERROR: error loading package '': Extension file 'closure/private/defs.bzl' has errors. Which version of bazel are you using ? 0.5.2 and 0.5.4 should work. It might also be possible that the fact you run everything as root is not a good idea.

lissyx avatar Oct 20 '17 08:10 lissyx

@voidspacexyz Another thing I saw in your gist: there's a pip install tensorflow==1.3 statement at line 23, so I'm unsure about your other install at line 38. It might get your into a weird state.

On line 44 you copy all the .so files, to /work/DeepSpeech/native_client/, it is likely you will need to change your LD_LIBRARY_PATH to contain that path otherwise the bindings you install on line 47 won't pick the .so files.

And there's no trace of your bazel installation there.

lissyx avatar Oct 20 '17 09:10 lissyx

I got similar reports from other contributor hitting similar issue than you regarding the bazel error. This was with Bazel 0.7.0. Switching to 0.5.4 fixed that.

lissyx avatar Oct 20 '17 12:10 lissyx