PaddleSpeech icon indicating copy to clipboard operation
PaddleSpeech copied to clipboard

如何使用Python部署自己的模型

Open zyw11270106 opened this issue 2 years ago • 4 comments

General Question

Hello,我微调asr模型后,部署自己微调后模型报错,一直未能解决,请帮忙指点下啊,感谢。 使用Python的进行调用,

调用如下 text = asr_executor( output_name, model='conformer_wenetspeech-zh-16k', config='/home/formal_ai/www/PaddleSpeech-develop/examples/aishell/asr1/conf/conformer1.yaml', ckpt_path='/home/formal_ai/www/PaddleSpeech-develop/examples/aishell/asr1/exp/conformer/checkpoints/5', device=paddle.get_device())

报错: [2022-09-20 15:15:59,625] [ INFO] - checking the audio file format...... [2022-09-20 15:15:59,628] [ INFO] - The sample rate is 16000 [2022-09-20 15:15:59,628] [ INFO] - The audio file format is right [2022-09-20 15:15:59,628] [ INFO] - start to init the model [2022-09-20 15:15:59,628] [ INFO] - /home/formal_ai/www/PaddleSpeech-develop/examples/aishell/asr1/conf/conformer.yaml [2022-09-20 15:15:59,629] [ INFO] - /home/formal_ai/www/PaddleSpeech-develop/examples/aishell/asr1/exp/conformer/checkpoints/5.pdparams [2022-09-20 15:15:59] [INFO] [_internal.py:224] 127.0.0.1 - - [20/Sep/2022 15:15:59] "POST /upload1 HTTP/1.1" 500 - Traceback (most recent call last): File "/home/anaconda3/envs/py37_pp/lib/python3.7/site-packages/flask/app.py", line 2091, in call return self.wsgi_app(environ, start_response) File "/home/anaconda3/envs/py37_pp/lib/python3.7/site-packages/flask/app.py", line 2076, in wsgi_app response = self.handle_exception(e) File "/home/anaconda3/envs/py37_pp/lib/python3.7/site-packages/flask/app.py", line 2073, in wsgi_app response = self.full_dispatch_request() File "/home/anaconda3/envs/py37_pp/lib/python3.7/site-packages/flask/app.py", line 1519, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/anaconda3/envs/py37_pp/lib/python3.7/site-packages/flask/app.py", line 1517, in full_dispatch_request rv = self.dispatch_request() File "/home/anaconda3/envs/py37_pp/lib/python3.7/site-packages/flask/app.py", line 1503, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args) File "/home/formal_ai/www/PaddleSpeech-develop/asr11.py", line 32, in upload_wav device=paddle.get_device()) File "/home/formal_ai/www/PaddleSpeech-develop/paddlespeech/cli/utils.py", line 346, in _warpper return executor_func(self, *args, **kwargs) File "/home/formal_ai/www/PaddleSpeech-develop/paddlespeech/cli/asr/infer.py", line 469, in call ckpt_path) File "/home/formal_ai/www/PaddleSpeech-develop/paddlespeech/cli/asr/infer.py", line 189, in _init_from_path self.config.decode.decoding_method = decode_method File "/home/anaconda3/envs/py37_pp/lib/python3.7/site-packages/yacs/config.py", line 141, in getattr raise AttributeError(name) AttributeError: decode

zyw11270106 avatar Sep 20 '22 09:09 zyw11270106

最新代码对应的配置文件见: https://github.com/PaddlePaddle/PaddleSpeech/blob/develop/examples/aishell/asr1/conf/tuning/decode.yaml

用老的配置文件需要用老的代码,用新的代码的话,得用新的配置文件。

zh794390558 avatar Sep 20 '22 10:09 zh794390558

CLI里的调用的话,可以看下下载的模型里对应的配置。 打包好的模型类的model.yaml是通过./utils/generate_infer_yaml.py 这个生成的,和训练的是不一样的。需要注意下。

zh794390558 avatar Sep 20 '22 10:09 zh794390558

最新代码对应的配置文件见: https://github.com/PaddlePaddle/PaddleSpeech/blob/develop/examples/aishell/asr1/conf/tuning/decode.yaml

用老的配置文件需要用老的代码,用新的代码的话,得用新的配置文件。

好的,我仔细检查一下配置文件,可能是在更换服务器时没有同步好

zyw11270106 avatar Sep 20 '22 10:09 zyw11270106

CLI里的调用的话,可以看下下载的模型里对应的配置。 打包好的模型类的model.yaml是通过./utils/generate_infer_yaml.py 这个生成的,和训练的是不一样的。需要注意下。

我再检查一下配置文件,的确存在您说的这种问题,感谢。稍后有问题的话我再问您

zyw11270106 avatar Sep 20 '22 10:09 zyw11270106

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 12 '22 20:11 stale[bot]

This issue is closed. Please re-open if needed.

stale[bot] avatar Dec 23 '22 21:12 stale[bot]