Skip to content

Fix a bug of streaming_tts_server #3865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 6, 2024
Merged

Fix a bug of streaming_tts_server #3865

merged 2 commits into from
Nov 6, 2024

Conversation

SuiYunsy
Copy link
Contributor

PR types

Bug fixes

PR changes

Others

Describe

Fix "Failed to get model related files" when using fastspeech2_csmsc_onnx model in streaming_tts_server.

Fix "Failed to get model related files" when using fastspeech2_csmsc_onnx model in streaming_tts_server.
@CLAassistant
Copy link

CLAassistant commented Oct 25, 2024

CLA assistant check
All committers have signed the CLA.

@mergify mergify bot added the Server label Oct 25, 2024
@zxcd
Copy link
Collaborator

zxcd commented Oct 30, 2024

Which environment are you running in? This issue should not occur under the recommended configuration.

@SuiYunsy
Copy link
Contributor Author

Which environment are you running in? This issue should not occur under the recommended configuration.

环境:

最新代码自己构建的镜像,以及 paddlecloud/paddlespeech:develop-cpu-latest

配置:

将默认配置里的 am

am: 'fastspeech2_cnndecoder_csmsc_onnx'

改成另一个可用模型 fastspeech2_csmsc_onnx

启动 paddlespeech_server 后就会报错 Failed to get model related files


究其原因,选择 fastspeech2_csmsc_onnx 模型

"fastspeech2_csmsc_onnx-zh": {
'1.0': {
'url':
'https://paddlespeech.bj.bcebos.com/Parakeet/released_models/fastspeech2/fastspeech2_csmsc_onnx_0.2.0.zip',
'md5':
'fd3ad38d83273ad51f0ea4f4abf3ab4e',
'ckpt':
'fastspeech2_csmsc.onnx',
'phones_dict':
'phone_id_map.txt',

这里的 ckpt 键对应的值并非列表,但是目前的代码中是这么处理的,就会报错:

if am == "fastspeech2_csmsc_onnx":
# get model info
if am_ckpt is None or phones_dict is None:
self.task_resource.set_task_model(
model_tag=am_tag,
model_type=0, # am
version=None, # default version
)
self.am_res_path = self.task_resource.res_dir
self.am_ckpt = os.path.join(
self.am_res_path, self.task_resource.res_dict['ckpt'][0])
# must have phones_dict in acoustic


相对地,默认配置选择的是 fastspeech2_cnndecoder_csmsc_onnx

"fastspeech2_cnndecoder_csmsc_onnx-zh": {
'1.0': {
'url':
'https://paddlespeech.bj.bcebos.com/Parakeet/released_models/fastspeech2/fastspeech2_cnndecoder_csmsc_streaming_onnx_1.0.0.zip',
'md5':
'5f70e1a6bcd29d72d54e7931aa86f266',
'ckpt': [
'fastspeech2_csmsc_am_encoder_infer.onnx',
'fastspeech2_csmsc_am_decoder.onnx',
'fastspeech2_csmsc_am_postnet.onnx',
],

这里的 ckpt 键对应的值为列表,代码中有正确处理,可以正常运行:

elif am == "fastspeech2_cnndecoder_csmsc_onnx":
if am_ckpt is None or am_stat is None or phones_dict is None:
self.task_resource.set_task_model(
model_tag=am_tag,
model_type=0, # am
version=None, # default version
)
self.am_res_path = self.task_resource.res_dir
self.am_encoder_infer = os.path.join(
self.am_res_path, self.task_resource.res_dict['ckpt'][0])
self.am_decoder = os.path.join(
self.am_res_path, self.task_resource.res_dict['ckpt'][1])
self.am_postnet = os.path.join(
self.am_res_path, self.task_resource.res_dict['ckpt'][2])
# must have phones_dict in acoustic


所以有了这个 PR😊
不足之处还望赐教😀

@zxcd
Copy link
Collaborator

zxcd commented Oct 31, 2024

好的,也麻烦把CI过一下,方便合入代码:D

@SuiYunsy
Copy link
Contributor Author

好的,也麻烦把CI过一下,方便合入代码:D

image

想问问上图这个CodeStyle,它建议是改成这样:

image

但是我仅仅把 [0] 删掉了,文件中其他部分的代码也是这个格式:

self.am_res_path = self.task_resource.res_dir
self.am_ckpt = os.path.join(
self.am_res_path, self.task_resource.res_dict['ckpt'][0])
# must have phones_dict in acoustic
self.phones_dict = os.path.join(
self.am_res_path,
self.task_resource.res_dict['phones_dict'])

self.am_res_path = self.task_resource.res_dir
self.am_encoder_infer = os.path.join(
self.am_res_path, self.task_resource.res_dict['ckpt'][0])
self.am_decoder = os.path.join(
self.am_res_path, self.task_resource.res_dict['ckpt'][1])
self.am_postnet = os.path.join(
self.am_res_path, self.task_resource.res_dict['ckpt'][2])
# must have phones_dict in acoustic
self.phones_dict = os.path.join(
self.am_res_path,
self.task_resource.res_dict['phones_dict'])
self.am_stat = os.path.join(
self.am_res_path,
self.task_resource.res_dict['speech_stats'])

感觉保持原样比较统一,还是说一定要过了才能合并呢😂😂😂

@zxcd
Copy link
Collaborator

zxcd commented Nov 1, 2024

关于代码风格的问题,你可以使用pre-commit这个工具,使用参考:

pip install pre-commit
pre-commit run --file 你修改的代码

@PaddlePaddle PaddlePaddle locked and limited conversation to collaborators Nov 6, 2024
@PaddlePaddle PaddlePaddle unlocked this conversation Nov 6, 2024
@zxcd
Copy link
Collaborator

zxcd commented Nov 6, 2024

LGTM. Thank you for your contribution!

@zxcd zxcd merged commit 8279539 into PaddlePaddle:develop Nov 6, 2024
5 checks passed
@luotao1
Copy link
Collaborator

luotao1 commented Nov 6, 2024

hi, @SuiYunsy

  • 非常感谢你对飞桨的贡献,我们正在运营一个PFCC组织,会通过定期分享技术知识与发布开发者主导任务的形式持续为飞桨做贡献,详情可见 https://github.com/luotao1 主页说明。
  • 如果你对PFCC有兴趣,请发送邮件至 ext_paddle_oss@baidu.com,我们会邀请你加入~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants