yeyupiaoling / PaddlePaddle-DeepSpeech

基于PaddlePaddle实现的语音识别,中文语音识别。项目完善,识别效果好。支持Windows,Linux下训练和预测,支持Nvidia Jetson开发板预测。
https://yeyupiaoling.blog.csdn.net/article/details/102904306
Apache License 2.0
667 stars 145 forks source link

最新代码本地预测报错:operands could not be broadcast #71

Closed WinderWL closed 3 years ago

WinderWL commented 3 years ago

请教大佬,windows10使用master分支代码执行本地预测报错如下:(使用DeepSpeech的模型,导出模型也正常,使用1.0的分支可以正常出结果)

(DeepSpeech) D:\PythonProjects\PaddlePaddle-DeepSpeech>python infer_path.py --wav_path=./dataset/test.wav
-----------  Configuration Arguments -----------
alpha: 1.2
beam_size: 10
beta: 0.35
cutoff_prob: 1.0
cutoff_top_n: 40
decoding_method: ctc_greedy
enable_mkldnn: False
is_long_audio: False
lang_model_path: ./lm/zh_giga.no_cna_cmn.prune01244.klm
mean_std_path: ./dataset/mean_std.npz
model_dir: ./models/infer/
to_an: True
use_gpu: True
use_tensorrt: False
vocab_path: ./dataset/zh_vocab.txt
wav_path: ./dataset/test.wav
------------------------------------------------
E0903 18:29:50.756563   324 analysis_config.cc:81] Please compile with gpu to EnableGpu()
E0903 18:29:50.756563   324 analysis_config.cc:81] Please compile with gpu to EnableGpu()
e[37m---    Fused 0 subgraphs into layer_norm op.e[0m
Traceback (most recent call last):
  File "infer_path.py", line 38, in <module>
    use_tensorrt=args.use_tensorrt, enable_mkldnn=args.enable_mkldnn, to_an=args.to_an)
  File "D:\PythonProjects\PaddlePaddle-DeepSpeech\utils\predict.py", line 68, in __init__
    self.predict(warmup_audio_path)
  File "D:\PythonProjects\PaddlePaddle-DeepSpeech\utils\predict.py", line 75, in predict
    audio_feature = self.audio_process.process_utterance(audio_path)
  File "D:\PythonProjects\PaddlePaddle-DeepSpeech\data_utils\audio_process.py", line 48, in process_utterance
    specgram = self._normalizer.apply(specgram)
  File "D:\PythonProjects\PaddlePaddle-DeepSpeech\data_utils\normalizer.py", line 55, in apply
    return (features - self._mean) / (self._std + eps)
ValueError: operands could not be broadcast together with shapes (39,838) (161,1)
yeyupiaoling commented 3 years ago

你应该是用旧的模型放在新的代码上面。如果你下载旧的模型代码就要用旧的代码。

WinderWL commented 3 years ago

我重新下载了模型,执行通过了,感谢!!