[CLI]replace logger.info with logger.debug in cli, change default log leve… by yt605155624 · Pull Request #2111 · PaddlePaddle/PaddleSpeech (original) (raw)
from paddlespeech.cli.vector import VectorExecutor from paddlespeech.cli.asr import ASRExecutor from paddlespeech.cli.tts import TTSExecutor from paddlespeech.cli.kws import KWSExecutor from paddlespeech.cli.text import TextExecutor
def test(): vector_executor=VectorExecutor() audio_emb = vector_executor( model='ecapatdnn_voxceleb12', sample_rate=16000, config=None, ckpt_path=None, audio_file='./output_16k.wav', device=paddle.get_device()) print("===============================")
asr_executor = ASRExecutor()
text = asr_executor(
model='conformer_wenetspeech',
lang='zh',
sample_rate=16000,
config=None, # Set `config` and `ckpt_path` to None to use pretrained model.
ckpt_path=None,
audio_file='./output_16k.wav',
force_yes=False,
device=paddle.get_device())
print('ASR Result: \n{}'.format(text))
print("===============================")
tts_executor = TTSExecutor()
wav_file = tts_executor(
text='今天的天气不错啊',
output='output.wav',
am='fastspeech2_csmsc',
am_config=None,
am_ckpt=None,
am_stat=None,
spk_id=0,
phones_dict=None,
tones_dict=None,
speaker_dict=None,
voc='pwgan_csmsc',
voc_config=None,
voc_ckpt=None,
voc_stat=None,
lang='zh',
device=paddle.get_device())
print('Wave file has been generated: {}'.format(wav_file))
print("===============================")
kws_executor = KWSExecutor()
result = kws_executor(
audio_file='./hey_snips.wav',
threshold=0.8,
model='mdtc_heysnips',
config=None,
ckpt_path=None,
device=paddle.get_device())
print('KWS Result: \n{}'.format(result))
print("===============================")
text_executor = TextExecutor()
result = text_executor(
text='今天的天气真不错啊你下午有空吗我想约你一起去吃饭',
task='punc',
model='ernie_linear_p7_wudao',
lang='zh',
config=None,
ckpt_path=None,
punc_vocab=None,
device=paddle.get_device())
print('Text Result: \n{}'.format(result))
print("===============================")import paddle paddle.set_device('gpu') test()
2022-07-01 08:26:47.763 | INFO | paddlespeech.s2t.modules.ctc:<module>:45 - paddlespeech_ctcdecoders not installed!
2022-07-01 08:26:47.950 | INFO | paddlespeech.s2t.modules.embedding:__init__:153 - max len: 5000
ASR Result:
我相信你也会跟我一样回忆起童年那时的我们没有那么多作业要写没有那么多人的情绪要照顾没有那么多的烦心事要处理也没有那么多痛苦要焦虑这是董玉辉在介绍一款玉米
===============================
/home/xxx/yt_py37/lib/python3.7/site-packages/paddle/fluid/framework.py:3680: DeprecationWarning: Op `norm` is executed through `append_op` under the dynamic mode, the corresponding API implementation needs to be upgraded to using `_C_ops` method.
"using `_C_ops` method." % type, DeprecationWarning)
Building prefix dict from the default dictionary ...
Loading model from cache /tmp/jieba.cache
Loading model cost 0.919 seconds.
Prefix dict has been built successfully.
/home/xxx/yt_py37/lib/python3.7/site-packages/paddle/fluid/framework.py:3680: DeprecationWarning: Op `slice` is executed through `append_op` under the dynamic mode, the corresponding API implementation needs to be upgraded to using `_C_ops` method.
"using `_C_ops` method." % type, DeprecationWarning)
Wave file has been generated: /home/xxx/PaddleSpeech_newest/output.wav
===============================
/home/xxx/yt_py37/lib/python3.7/site-packages/paddle/fluid/framework.py:3680: DeprecationWarning: Op `pad` is executed through `append_op` under the dynamic mode, the corresponding API implementation needs to be upgraded to using `_C_ops` method.
"using `_C_ops` method." % type, DeprecationWarning)
KWS Result:
Score: 1.000, Threshold: 0.8, Is keyword: True
===============================
[2022-07-01 08:27:25,982] [ INFO] - Already cached /home/xxx/.paddlenlp/models/ernie-1.0/vocab.txt
Text Result:
今天的天气真不错啊!你下午有空吗?我想约你一起去吃饭。
===============================