Skip to content
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

[CLI]replace logger.info with logger.debug in cli, change default log leve… #2111

Merged
merged 2 commits into from
Jul 1, 2022

Conversation

yt605155624
Copy link
Collaborator

input:

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()

output:

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:
今天的天气真不错啊!你下午有空吗?我想约你一起去吃饭。
===============================

@yt605155624 yt605155624 self-assigned this Jul 1, 2022
@yt605155624 yt605155624 added this to the r1.1.0 milestone Jul 1, 2022
@mergify mergify bot added S2T asr/st CLI labels Jul 1, 2022
Copy link
Collaborator

@zh794390558 zh794390558 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如何查看debug信息?

Jackwaterveg
Jackwaterveg previously approved these changes Jul 1, 2022
Copy link
Contributor

@Jackwaterveg Jackwaterveg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yt605155624 yt605155624 merged commit e4a8e15 into PaddlePaddle:develop Jul 1, 2022
@yt605155624 yt605155624 deleted the rm_more_log branch September 8, 2022 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants