DeepSpeech icon indicating copy to clipboard operation
DeepSpeech copied to clipboard

CreateModel failed with error code 5 (DeepSpeechv0.4.1)

Open 20richardh opened this issue 7 years ago • 12 comments

For support and discussions, please use our Discourse forums.

If you've found a bug, or have a feature request, then please create an issue with the following information:

  • Have I written custom code (as opposed to running examples on an unmodified clone of the repository): No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu Virtual Machine (I use a Windows computer)
  • TensorFlow installed from (our builds, or upstream TensorFlow): pip install tensorflow
  • TensorFlow version (use command below): 'v1.13.1-0-g6612da8951' 1.13.1
  • Python version: 3.6
  • Bazel version (if compiling from source): N/A
  • GCC/Compiler version (if compiling from source): N/A
  • CUDA/cuDNN version: N/A
  • GPU model and memory: N/A
  • Exact command to reproduce: (deepspeech-venv) richard@DESKTOP-E345TDD:/mnt/d/richardhu/tensorflow-master/tensorflow/examples/gitLFS_fordeepspeech/scratch/DeepSpeech$ deepspeech --model models/tester_output_graph.pb --alphabet models/alphabet.txt --audio /mnt/d/UA_Data/implementation/tester/train/tester/a/a_0.wav

--Output:

Loading model from file models/tester_output_graph.pb TensorFlow: v1.12.0-10-ge232881 (why is this different from my tensorflow version?) DeepSpeech: v0.4.1-0-g0e40db6 Warning: reading entire model file into memory. Transform model file into an mmapped graph to reduce heap usage. 2019-05-15 13:10:01.985627: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA Not found: Op type not registered 'AudioSpectrogram' in binary running on DESKTOP-E345TDD. Make sure the Op and Kernel are registered in the binary running in this process. Note that if you are loading a saved graph which used ops from tf.contrib, accessing (e.g.) tf.contrib.resampler should be done before importing the graph, as contrib ops are lazily registered when the module is first accessed. Traceback (most recent call last): File "/home/richard/tmp/deepspeech-venv/bin/deepspeech", line 10, in sys.exit(main()) File "/home/richard/tmp/deepspeech-venv/lib/python3.6/site-packages/deepspeech/client.py", line 80, in main ds = Model(args.model, N_FEATURES, N_CONTEXT, args.alphabet, BEAM_WIDTH) File "/home/richard/tmp/deepspeech-venv/lib/python3.6/site-packages/deepspeech/init.py", line 14, in init raise RuntimeError("CreateModel failed with error code {}".format(status)) RuntimeError: CreateModel failed with error code 5

I downloaded the DeepSpeech repository from git clone https://github.com/mozilla/DeepSpeech . In my command line under the DeepSpeech directory, I tried to run the pretrained model from wget https://github.com/mozilla/DeepSpeech/releases/download/v0.4.1/deepspeech-0.4.1-models.tar.gz .

It worked fine for the pre-built model, but not for the model I trained under the Deepspeech version 0.4.1 using the following command: python3 DeepSpeech.py --n_hidden 2048 --checkpoint_dir /mnt/d/Mozilla/trainings/tester --epochs 1 --train_files /mnt/d/UA_Data/implementation/tester/train.csv --dev_files /mnt/d/UA_Data/implementation/tester/validate.csv --test_files /mnt/d/UA_data/implementation/tester/validate2.csv --learning_rate 0.0001 --alphabet_config_path /mnt/d/richardhu/tensorflow-master/tensorflow/examples/GitLFS_forDeepSpeech/DeepSpeech/data/alphabet.txt export_dir /mnt/d/allModels/UA/tester

export command: python DeepSpeech.py --export_dir /mnt/d/allModels/UA/tester --notrain --notest --checkpoint_dir /mnt/d/Mozilla/trainings/tester

Is the pre-built model I downloaded from your DeepSpeech readMe still compatible with models trained from the same version of DeepSpeech v0.4.1?

Other possibly relevant info:

  1. I did not build my own binary.
  2. The tester model I tried to create only trains, validates, and devs on the word "a" (I'm just trying to make this work on a basic level first before introducing my entire vocabulary).

20richardh avatar May 15 '19 20:05 20richardh

pip install tensorflow

Try pip3 install tensorflow instead.

dabinat avatar May 15 '19 22:05 dabinat

Actually, I think I did that -- but I'll do it again anyway. Guess I'll retrain after following this suggestion?

Do you think that would fix this particular problem?

Update: same problem

20richardh avatar May 15 '19 23:05 20richardh

The 0.4.1 model is compatible with the 0.4.1 code.

The 0.4.1 model is not compatible with master or the 0.5.0-alpha.[0-8] releases.

kdavis-mozilla avatar May 16 '19 05:05 kdavis-mozilla

Thanks for the clarification!

Since the command line lists the version of DeepSpeech as "DeepSpeech: v0.4.1-0-g0e40db6," can I at least safely assume that I am running the 0.4.1 version? I'm still getting some CreateModel error.

Or by 0.4.1 code, do you mean that cloning from https://github.com/mozilla/DeepSpeech gives me an alpha version, and I need to train using another deepspeech folder that specifically says 0.4.1 ?

20richardh avatar May 16 '19 05:05 20richardh

I also tried cloning v0.4.1.tar.gz from https://github.com/mozilla/DeepSpeech/releases/tag/v0.4.1, but the same training command threw this error:

(deepspeech-venv) richard@DESKTOP-E345TDD:/mnt/d/richardhu/tensorflow-master/tensorflow/examples/gitLFS_fordeepspeech/scratch/DeepSpeech-041$ python3 DeepSpeech.py --n_hidden 2048 --checkpoint_dir /mnt/d/Mozilla/trainings/tester_checkpoints --epochs 1 --train_files /mnt/d/UA_Data/implementation/tester/train.csv --dev_files /mnt/d/UA_Data/implementation/tester/validate.csv --test_files /mnt/d/UA_data/implementation/tester/validate2.csv --learning_rate 0.0001 --alphabet_config_path /mnt/d/richardhu/tensorflow-master/tensorflow/examples/GitLFS_forDeepSpeech/DeepSpeech/data/alphabet.txt export_dir /mnt/d/allModels/UA/tester

Traceback (most recent call last): File "DeepSpeech.py", line 21, in from tensorflow.contrib.lite.python import tflite_convert ImportError: cannot import name 'tflite_convert'

20richardh avatar May 16 '19 06:05 20richardh

This

TensorFlow version (use command below): 'v1.13.1-0-g6612da8951' 1.13.1

along with this

TensorFlow: v1.12.0-10-ge232881 (why is this different from my tensorflow version?)

makes it appear that you are mixing TensorFlow versions.

What happens if you follow the "Using the Python package" instructions in a new virtual environment? (Note I linked to the 0.4.1 version of "Using the Python package".)

kdavis-mozilla avatar May 16 '19 07:05 kdavis-mozilla

Thanks for the advice, but I actually solved the issue before I saw your suggestion!

Basically, instead of cloning the https://github.com/mozilla/DeepSpeech , I specifically cloned v0.4.1.tar.gz from https://github.com/mozilla/DeepSpeech/releases/tag/v0.4.1 so as to ensure that I was using the right version.

At this point, tensorflow still throws the following error:

Traceback (most recent call last): File "DeepSpeech.py", line 21, in from tensorflow.contrib.lite.python import tflite_convert ImportError: cannot import name 'tflite_convert'

To solve this, I searched up some forums on the problem and found that I should change line 21 in DeepSpeech.py from the line "from tensorflow.contrib.lite.python import" to "from tensorflow.lite.python import tflite_convert" . Because for some reason, tensorflow decided that they'd want to remove the .contrib part, screwing up any old code for their previous versions.

I still need to figure out how to make the --epoch parameter work and address a few tensorflow warnings, but it trains and the binary works!

Worst warning still being thrown during training: Please use rate instead of keep_prob. Rate should be set to rate = 1 - keep_prob. W Parameter --validation_step needs to be >0 for early stopping to work

Closing the issue.

20richardh avatar May 16 '19 15:05 20richardh

To solve this, I searched up some forums on the problem and found that I should change line 21 in DeepSpeech.py from the line "from tensorflow.contrib.lite.python import" to "from tensorflow.lite.python import tflite_convert" . Because for some reason, tensorflow decided that they'd want to remove the .contrib part, screwing up any old code for their previous versions.

That means you downloaded 0.4.1 and are running it on TensorFlow 1.13.1 and not TensorFlow 1.12 as documented. You may experience a lot of other "weirdness" if you don't use proper versions.

lissyx avatar May 16 '19 15:05 lissyx

Do you think I would encounter any significant errors that will affect my training? Meaning I must specifically download Tensorflow 1.12?

20richardh avatar May 16 '19 15:05 20richardh

Do you think I would encounter any significant errors that will affect my training? Meaning I must specifically download Tensorflow 1.12?

You already hit one of those. It's totally possible you may have some other in the future.

lissyx avatar May 16 '19 16:05 lissyx

Sounds like a good idea. I downgraded tensorflow to 1.12.0 and all the warnings have disappeared! Thanks for the help!

20richardh avatar May 16 '19 17:05 20richardh

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.

lock[bot] avatar Jun 15 '19 17:06 lock[bot]