reith/deepspeech-playground

Keras package not found

Closed this issue · 8 comments

Hi,
Can you specify what versions are you using for tensorflow and keras, and also Is the other package installation is same as of original baidu's deepspeech packages?

Using TensorFlow backend.
Traceback (most recent call last):
File "test.py", line 63, in
main(args.test_desc_file, args.model_config, args.weights_file)
File "test.py", line 36, in main
model_wrapper = load_model_wrapper(model_config_file, weights_file)
File "test.py", line 19, in load_model_wrapper
import model_wrp
File "/home/prashant/Documents/speech_recognition/speechRecognition/thirdpartyDP/deepspeech-playground/model_wrp.py", line 10, in
from keras.layers import (BatchNormalization, Dense, Input, GRU, concatenate,
ImportError: cannot import name concatenate

reith commented

Keras versions of 2 should work. If you want stick to Keras 1, you should use Keras 1.2.2 and comment concatenate import in model_wrp module.

If you want Theano based model you should use 0.10 and later instead of sherjilozair/ctc.

keras version 2 worked however i am getting some new error, looks like implementation error.

/home/prashant/Documents/speech_recognition/speechRecognition/thirdpartyDP/deepspeech-playground/model_wrp.py:274: UserWarning: Update your Dense call to the Keras 2 API: Dense(29, activation="softmax", kernel_initializer="glorot_uniform", name="text_dense")
activation=for_tf_or_th('softmax', 'linear')
/home/prashant/Documents/speech_recognition/speechRecognition/thirdpartyDP/deepspeech-playground/model_wrp.py:278: UserWarning: Update your Model call to the Keras 2 API: Model(outputs=[<tf.Tenso..., inputs=Tensor("ac...)
self.model = Model(input=acoustic_input, output=[network_output])
No handlers could be found for logger "data_generator"
Traceback (most recent call last):
File "test.py", line 63, in
main(args.test_desc_file, args.model_config, args.weights_file)
File "test.py", line 49, in main
trainer.validate(datagen, 32, False, False, None)
File "/home/prashant/Documents/speech_recognition/speechRecognition/thirdpartyDP/deepspeech-playground/trainer.py", line 199, in validate
for batch in datagen.iterate_validation(mb_size):
File "/home/prashant/Documents/speech_recognition/speechRecognition/thirdpartyDP/deepspeech-playground/data_generator.py", line 231, in iterate
minibatch = future.result()
File "/usr/local/lib/python2.7/dist-packages/concurrent/futures/_base.py", line 398, in result
return self.__get_result()
File "/usr/local/lib/python2.7/dist-packages/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/prashant/Documents/speech_recognition/speechRecognition/thirdpartyDP/deepspeech-playground/data_generator.py", line 147, in prepare_minibatch
max_length = max(input_lengths)
ValueError: max() arg is an empty sequence

reith commented

Would you send your data description file? (e.g. test-clean.json)

I was passing wrong file. I changed that and it worked fine. But can we have more verbose result like the predicted sentences instead of just loss value?
And also can the inference for audio file be done using this?

reith commented

Yes, but not by test.py. Try visualize.py or model-evaluation notebook.

What all it takes as input?

Got this error while inferencing audio file using visualize.py

Using TensorFlow backend.
Loading model
Compiling test function...
Traceback (most recent call last):
File "visualize.py", line 190, in
main()
File "visualize.py", line 186, in main
visualize(model, args.test_file, args.train_desc_file)
File "visualize.py", line 59, in visualize
test_fn = compile_output_fn(model)
File "/home/prashant/Documents/speech_recognition/speechRecognition/thirdpartyDP/deepspeech-playground/model.py", line 125, in compile_output_fn
network_output = network_output.dimshuffle((1, 0, 2))
AttributeError: 'Tensor' object has no attribute 'dimshuffle'

reith commented

Added a description to visualize.py usage and some little helpers. If It's a pre-trained model shipped by this repo run it like:
python visualize.py --interactive --model-config pre-trained/model_25_config.json --weights-file 25-model_19336_weights.h5