shoegazerstella / DeepSpeech_CPU_py37

A CPU version of DeepSpeech for python 3.7 🗣️📝

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not able to infer

ssokhey opened this issue · comments

Python = 3.7
paddlepaddle=1.8.0

I am getting the following error:

NotImplementedError: Wrong number or type of arguments for overloaded function 'ctc_beam_search_decoder_batch'.

I suspect it is coming from swig.

Hi, could you write the command you are trying to execute?

python -u infer.py \
--num_samples=1 \
--beam_size=10 \
--num_proc_bsearch=4 \
--num_conv_layers=2 \
--num_rnn_layers=3 \
--rnn_layer_size=2048 \
--alpha=2.5 \
--beta=0.3 \
--cutoff_prob=1.0 \
--cutoff_top_n=40 \
--use_gru=False \
--use_gpu=False \
--share_rnn_weights=True \
--infer_manifest='data/tiny/manifest.test-clean' \
--mean_std_path='data/tiny/mean_std.npz' \
--vocab_path='data/tiny/vocab.txt' \
--model_path='./checkpoints/tiny/step_final' \
--lang_model_path='' \
--decoding_method='ctc_beam_search' \
--error_rate_type='wer' \
--specgram_type='linear'

I am using the above command.

Complete log:

-----------  Configuration Arguments -----------
alpha: 2.5
beam_size: 1
beta: 0.3
cutoff_prob: 1.0
cutoff_top_n: 40
decoding_method: ctc_beam_search
error_rate_type: wer
infer_manifest: data/tiny/manifest.test-clean
lang_model_path: 
mean_std_path: data/tiny/mean_std.npz
model_path: ./checkpoints/tiny/step_final
num_conv_layers: 2
num_proc_bsearch: 4
num_rnn_layers: 3
num_samples: 1
rnn_layer_size: 2048
share_rnn_weights: 1
specgram_type: linear
use_gpu: 0
use_gru: 0
vocab_path: data/tiny/vocab.txt
------------------------------------------------
2020-05-30 02:48:11,597-INFO: no language model provided, decoding by pure beam search without scorer.
2020-05-30 02:48:11,598-INFO: start inference ...
finish initing model from pretrained params from ./checkpoints/tiny/step_final
Traceback (most recent call last):
  File "infer.py", line 152, in <module>
    main()
  File "infer.py", line 148, in main
    infer()
  File "infer.py", line 134, in infer
    num_processes=args.num_proc_bsearch)
  File "/home/something/DeepSpeech_CPU_py37/src/model_utils/model.py", line 530, in decode_batch_beam_search
    cutoff_top_n=cutoff_top_n)
  File "/home/something/DeepSpeech_CPU_py37/src/decoders/swig_wrapper.py", line 119, in ctc_beam_search_decoder_batch
    cutoff_top_n, ext_scoring_func)
NotImplementedError: Wrong number or type of arguments for overloaded function 'ctc_beam_search_decoder_batch'.
  Possible C/C++ prototypes are:
    ctc_beam_search_decoder_batch(std::vector< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >,std::allocator< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > > > const &,std::vector< std::string,std::allocator< std::string > > const &,size_t,size_t,double,size_t,Scorer *)
    ctc_beam_search_decoder_batch(std::vector< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >,std::allocator< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > > > const &,std::vector< std::string,std::allocator< std::string > > const &,size_t,size_t,double,size_t)
    ctc_beam_search_decoder_batch(std::vector< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >,std::allocator< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > > > const &,std::vector< std::string,std::allocator< std::string > > const &,size_t,size_t,double)
    ctc_beam_search_decoder_batch(std::vector< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >,std::allocator< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > > > const &,std::vector< std::string,std::allocator< std::string > > const &,size_t,size_t)

Failed in inference!

So I wasn't able to reproduce your error but there where some bugs indeed that now should have been fixed.
Let me know if the updates work for you.
I'll try again to reproduce your error in the meantime.

Hi, Thanks for the efforts but the error still persists;

The error log is;

-----------  Configuration Arguments -----------
alpha: 1.4
beam_size: 16
beta: 0.35
cutoff_prob: 1.0
cutoff_top_n: 40
decoding_method: ctc_beam_search
error_rate_type: wer
infer_manifest: data/tiny/manifest.test-clean
lang_model_path: models/lm/wikitext-103.binary
mean_std_path: models/baidu_en8k/mean_std.npz
model_path: models/baidu_en8k/
num_conv_layers: 2
num_proc_bsearch: 5
num_rnn_layers: 3
num_samples: 4
rnn_layer_size: 1024
share_rnn_weights: False
specgram_type: linear
use_gpu: False
use_gru: True
vocab_path: models/baidu_en8k/vocab.txt
------------------------------------------------
2020-05-30 12:04:10,108-INFO: begin to initialize the external scorer for decoding
Traceback (most recent call last):
  File "infer.py", line 152, in <module>
    main()
  File "infer.py", line 148, in main
    infer()
  File "infer.py", line 120, in infer
    vocab_list)
  File "/home/user/DeepSpeech_CPU_py37/src2/model_utils/model.py", line 478, in init_ext_scorer
    language_model_path, vocab_list)
  File "/home/user/DeepSpeech_CPU_py37/src2/decoders/swig_wrapper.py", line 23, in __init__
    swig_decoders.Scorer.__init__(self, alpha, beta, model_path, vocabulary)
  File "/home/user/miniconda3/envs/paddle-cpu3/lib/python3.7/site-packages/swig_decoders-1.1-py3.7-linux-x86_64.egg/swig_decoders.py", line 1269, in __init__
    this = _swig_decoders.new_Scorer(alpha, beta, lm_path, vocabulary)
TypeError: in method 'new_Scorer', argument 4 of type 'std::vector< std::string,std::allocator< std::string > > const &'

Please let me know if we need to update or make changes in swig decoders.

@shoegazerstella

It works now, I forgot to add changes in the infer.py, so It wasn't working.

I am willing to work on enabling GPU compatibility, do you want to collaborate or any pointers you can give me to get started.

Yes, that was in my plans but I haven't had much time to focus on it lately.
To me what could be tested is either a new Dockerfile that starts from a gpu-compatible image, with all the right cuda installed for paddlepaddle==1.8.0.
Or starting from the already available paddle official image and then re-install python 3.7

Closing this.
Let's continue the discussion about GPU integration here