-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix: 🐛 修复服务端 python ASREngine 无法使用conformer_talcs模型 #3230
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
163 changes: 163 additions & 0 deletions
163
demos/speech_server/conf/conformer_talcs_application.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
# This is the parameter configuration file for PaddleSpeech Offline Serving. | ||
|
||
################################################################################# | ||
# SERVER SETTING # | ||
################################################################################# | ||
host: 0.0.0.0 | ||
port: 8090 | ||
|
||
# The task format in the engin_list is: <speech task>_<engine type> | ||
# task choices = ['asr_python', 'asr_inference', 'tts_python', 'tts_inference', 'cls_python', 'cls_inference', 'text_python', 'vector_python'] | ||
protocol: 'http' | ||
engine_list: ['asr_python', 'tts_python', 'cls_python', 'text_python', 'vector_python'] | ||
|
||
|
||
################################################################################# | ||
# ENGINE CONFIG # | ||
################################################################################# | ||
|
||
################################### ASR ######################################### | ||
################### speech task: asr; engine_type: python ####################### | ||
asr_python: | ||
model: 'conformer_talcs' | ||
lang: 'zh_en' | ||
sample_rate: 16000 | ||
cfg_path: # [optional] | ||
ckpt_path: # [optional] | ||
decode_method: 'attention_rescoring' | ||
force_yes: True | ||
codeswitch: True | ||
device: # set 'gpu:id' or 'cpu' | ||
|
||
################### speech task: asr; engine_type: inference ####################### | ||
asr_inference: | ||
# model_type choices=['deepspeech2offline_aishell'] | ||
model_type: 'deepspeech2offline_aishell' | ||
am_model: # the pdmodel file of am static model [optional] | ||
am_params: # the pdiparams file of am static model [optional] | ||
lang: 'zh' | ||
sample_rate: 16000 | ||
cfg_path: | ||
decode_method: | ||
force_yes: True | ||
|
||
am_predictor_conf: | ||
device: # set 'gpu:id' or 'cpu' | ||
switch_ir_optim: True | ||
glog_info: False # True -> print glog | ||
summary: True # False -> do not show predictor config | ||
|
||
|
||
################################### TTS ######################################### | ||
################### speech task: tts; engine_type: python ####################### | ||
tts_python: | ||
# am (acoustic model) choices=['speedyspeech_csmsc', 'fastspeech2_csmsc', | ||
# 'fastspeech2_ljspeech', 'fastspeech2_aishell3', | ||
# 'fastspeech2_vctk', 'fastspeech2_mix', | ||
# 'tacotron2_csmsc', 'tacotron2_ljspeech'] | ||
am: 'fastspeech2_csmsc' | ||
am_config: | ||
am_ckpt: | ||
am_stat: | ||
phones_dict: | ||
tones_dict: | ||
speaker_dict: | ||
|
||
|
||
# voc (vocoder) choices=['pwgan_csmsc', 'pwgan_ljspeech', 'pwgan_aishell3', | ||
# 'pwgan_vctk', 'mb_melgan_csmsc', 'style_melgan_csmsc', | ||
# 'hifigan_csmsc', 'hifigan_ljspeech', 'hifigan_aishell3', | ||
# 'hifigan_vctk', 'wavernn_csmsc'] | ||
voc: 'mb_melgan_csmsc' | ||
voc_config: | ||
voc_ckpt: | ||
voc_stat: | ||
|
||
# others | ||
lang: 'zh' | ||
device: # set 'gpu:id' or 'cpu' | ||
|
||
|
||
################### speech task: tts; engine_type: inference ####################### | ||
tts_inference: | ||
# am (acoustic model) choices=['speedyspeech_csmsc', 'fastspeech2_csmsc'] | ||
am: 'fastspeech2_csmsc' | ||
am_model: # the pdmodel file of your am static model (XX.pdmodel) | ||
am_params: # the pdiparams file of your am static model (XX.pdipparams) | ||
am_sample_rate: 24000 | ||
phones_dict: | ||
tones_dict: | ||
speaker_dict: | ||
|
||
|
||
am_predictor_conf: | ||
device: # set 'gpu:id' or 'cpu' | ||
switch_ir_optim: True | ||
glog_info: False # True -> print glog | ||
summary: True # False -> do not show predictor config | ||
|
||
# voc (vocoder) choices=['pwgan_csmsc', 'mb_melgan_csmsc','hifigan_csmsc'] | ||
voc: 'mb_melgan_csmsc' | ||
voc_model: # the pdmodel file of your vocoder static model (XX.pdmodel) | ||
voc_params: # the pdiparams file of your vocoder static model (XX.pdipparams) | ||
voc_sample_rate: 24000 | ||
|
||
voc_predictor_conf: | ||
device: # set 'gpu:id' or 'cpu' | ||
switch_ir_optim: True | ||
glog_info: False # True -> print glog | ||
summary: True # False -> do not show predictor config | ||
|
||
# others | ||
lang: 'zh' | ||
|
||
|
||
################################### CLS ######################################### | ||
################### speech task: cls; engine_type: python ####################### | ||
cls_python: | ||
# model choices=['panns_cnn14', 'panns_cnn10', 'panns_cnn6'] | ||
model: 'panns_cnn14' | ||
cfg_path: # [optional] Config of cls task. | ||
ckpt_path: # [optional] Checkpoint file of model. | ||
label_file: # [optional] Label file of cls task. | ||
device: # set 'gpu:id' or 'cpu' | ||
|
||
|
||
################### speech task: cls; engine_type: inference ####################### | ||
cls_inference: | ||
# model_type choices=['panns_cnn14', 'panns_cnn10', 'panns_cnn6'] | ||
model_type: 'panns_cnn14' | ||
cfg_path: | ||
model_path: # the pdmodel file of am static model [optional] | ||
params_path: # the pdiparams file of am static model [optional] | ||
label_file: # [optional] Label file of cls task. | ||
|
||
predictor_conf: | ||
device: # set 'gpu:id' or 'cpu' | ||
switch_ir_optim: True | ||
glog_info: False # True -> print glog | ||
summary: True # False -> do not show predictor config | ||
|
||
|
||
################################### Text ######################################### | ||
################### text task: punc; engine_type: python ####################### | ||
text_python: | ||
task: punc | ||
model_type: 'ernie_linear_p3_wudao' | ||
lang: 'zh' | ||
sample_rate: 16000 | ||
cfg_path: # [optional] | ||
ckpt_path: # [optional] | ||
vocab_file: # [optional] | ||
device: # set 'gpu:id' or 'cpu' | ||
|
||
|
||
################################### Vector ###################################### | ||
################### Vector task: spk; engine_type: python ####################### | ||
vector_python: | ||
task: spk | ||
model_type: 'ecapatdnn_voxceleb12' | ||
sample_rate: 16000 | ||
cfg_path: # [optional] | ||
ckpt_path: # [optional] | ||
device: # set 'gpu:id' or 'cpu' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,13 +67,19 @@ def init(self, config: dict) -> bool: | |
logger.error(e) | ||
return False | ||
|
||
cs = False | ||
|
||
if 'codeswitch' in self.config: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 通过模型名字判断是否是codeswitch的模型,而不是配置文件名。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 意思是单纯的判断名称,然后传递设置?而非 读取配置? |
||
cs=self.config.codeswitch | ||
|
||
self.executor._init_from_path( | ||
model_type=self.config.model, | ||
lang=self.config.lang, | ||
sample_rate=self.config.sample_rate, | ||
cfg_path=self.config.cfg_path, | ||
decode_method=self.config.decode_method, | ||
ckpt_path=self.config.ckpt_path) | ||
ckpt_path=self.config.ckpt_path, | ||
codeswitch=cs ) | ||
|
||
logger.info("Initialize ASR server engine successfully on device: %s." % | ||
(self.device)) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要指定对应的配置文件。