DeepSpeech2模型在ASR引擎部署中文模型时出错,但预测时又没有问题,如何解决?
Created by: YuHuasong123
/DeepSpeech$ python demo_server.py ----------- Configuration Arguments ----------- alpha: 2.5 beam_size: 500 beta: 0.3 cutoff_prob: 0.99 cutoff_top_n: 40 decoding_method: ctc_beam_search host_ip: localhost host_port: 8086 lang_model_path: ./models/lm/zh_giga.no_cna_cmn.prune01244.klm mean_std_path: ./data/aishell/mean_std.npz model_path: ./checkpoints/aishell/step_final num_conv_layers: 2 num_rnn_layers: 3 rnn_layer_size: 1024 share_rnn_weights: False specgram_type: linear speech_save_dir: demo_cache use_gpu: True use_gru: False vocab_path: ./data/aishell/vocab.txt warmup_manifest: ./data/aishell/manifest.test
2020-08-11 09:25:12,310-INFO: begin to initialize the external scorer for decoding 2020-08-11 09:25:17,153-INFO: language model: is_character_based = 1, max_order = 5, dict_size = 0 2020-08-11 09:25:17,153-INFO: end initializing scorer
Warming up ... manifest:370,num_test_cases:3 ('Warm-up Test Case %d: %s', 0, u'./dataset/data_aishell/wav/test/S0764/BAC009S0764W0437.wav') W0811 09:25:17.345019 849 device_context.cc:252] Please NOTE: device: 0, CUDA Capability: 70, Driver API Version: 9.2, Runtime API Version: 9.0 W0811 09:25:18.062232 849 device_context.cc:260] device: 0, cuDNN Version: 7.3. Traceback (most recent call last): File "demo_server.py", line 241, in main() File "demo_server.py", line 237, in main start_server() File "demo_server.py", line 222, in start_server num_test_cases=3) File "demo_server.py", line 139, in warm_up_test transcript = audio_process_handler(sample['audio_filepath']) File "demo_server.py", line 198, in file_to_transcript feeding_dict=data_generator.feeding) File "/home/aistudio/DeepSpeech/model_utils/model.py", line 411, in infer_batch_probs self.init_from_pretrained_model(exe, infer_program) File "/home/aistudio/DeepSpeech/model_utils/model.py", line 161, in init_from_pretrained_model filename="params.pdparams") File "/opt/conda/envs/python27-paddle120-env/lib/python2.7/site-packages/paddle/fluid/io.py", line 876, in load_params filename=filename) File "/opt/conda/envs/python27-paddle120-env/lib/python2.7/site-packages/paddle/fluid/io.py", line 750, in load_vars filename=filename) File "/opt/conda/envs/python27-paddle120-env/lib/python2.7/site-packages/paddle/fluid/io.py", line 819, in load_vars format(orig_shape, each_var.name, new_shape)) RuntimeError: Variable's shape does not match, the Program requires a parameter with the shape of ((1024L, 1024L)), while the loaded parameter (namely [ layer_3_forward_rnn_weight ]) has a shape of ((1024, 3072)). aistudio@jupyter-317807-671961:~/DeepSpeech/examples/aishell$ sh run_infer.sh Download language model ... ./zh_giga.no_cna_cmn.prune01244.klm already exists, download skipped. ----------- Configuration Arguments ----------- alpha: 2.6 beam_size: 300 beta: 5.0 cutoff_prob: 0.99 cutoff_top_n: 40 decoding_method: ctc_beam_search error_rate_type: cer infer_manifest: data/aishell/manifest.test lang_model_path: models/lm/zh_giga.no_cna_cmn.prune01244.klm mean_std_path: data/aishell/mean_std.npz model_path: checkpoints/aishell/step_final num_conv_layers: 2 num_proc_bsearch: 8 num_rnn_layers: 3 num_samples: 10 rnn_layer_size: 1024 share_rnn_weights: 0 specgram_type: linear use_gpu: 1 use_gru: 1 vocab_path: data/aishell/vocab.txt
2020-08-11 09:47:50,183-INFO: begin to initialize the external scorer for decoding 2020-08-11 09:47:50,428-INFO: language model: is_character_based = 1, max_order = 5, dict_size = 0 2020-08-11 09:47:50,428-INFO: end initializing scorer 2020-08-11 09:47:50,428-INFO: start inference ... W0811 09:47:50.497648 1689 device_context.cc:252] Please NOTE: device: 0, CUDA Capability: 70, Driver API Version: 9.2, Runtime API Version: 9.0 W0811 09:47:50.502681 1689 device_context.cc:260] device: 0, cuDNN Version: 7.3. finish initing model from pretrained params from checkpoints/aishell/step_final
Target Transcription: 甚至出现交易几乎停滞的情况 Output Transcription: 甚至出现交易几乎停滞的情况 Current error rate [cer] = 0.000000
Target Transcription: 一二线城市虽然也处于调整中 Output Transcription: 一二线城市虽然也处于调整中 Current error rate [cer] = 0.000000
Target Transcription: 但因为聚集了过多公共资源 Output Transcription: 但因为聚集了过多公共资源 Current error rate [cer] = 0.000000
Target Transcription: 为了规避三四线城市明显过剩的市场风险 Output Transcription: 为了规避三四线城市明显过剩的市场风险 Current error rate [cer] = 0.000000
Target Transcription: 标杆房企必然调整市场战略 Output Transcription: 标杆房企必然调整市场战略 Current error rate [cer] = 0.000000
Target Transcription: 因此土地储备至关重要 Output Transcription: 因此土地储备至关重要 Current error rate [cer] = 0.000000
Target Transcription: 中原地产首席分析师张大伟说 Output Transcription: 中原地产首席分析师张大伟说 Current error rate [cer] = 0.000000
Target Transcription: 一线城市土地供应量减少 Output Transcription: 一线城市土地供应量减少 Current error rate [cer] = 0.000000
Target Transcription: 也助推了土地市场的火爆 Output Transcription: 也助推了土地市场的火爆 Current error rate [cer] = 0.000000
Target Transcription: 北京仅新增住宅土地供应十宗 Output Transcription: 北京仅新增住宅土地供应时中 Current error rate [cer] = 0.153846 2020-08-11 09:47:56,189-INFO: finish inference