From 6c1e6e7876c393cf4718edb0653484976eab629f Mon Sep 17 00:00:00 2001 From: KP <109694228@qq.com> Date: Wed, 8 Dec 2021 15:53:57 +0800 Subject: [PATCH] Update recommended model to cnn14 and argument name in __call__. --- paddlespeech/cli/cls/infer.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/paddlespeech/cli/cls/infer.py b/paddlespeech/cli/cls/infer.py index dc976cb4..0b4982d1 100644 --- a/paddlespeech/cli/cls/infer.py +++ b/paddlespeech/cli/cls/infer.py @@ -80,7 +80,7 @@ class CLSExecutor(BaseExecutor): self.parser.add_argument( '--model', type=str, - default='panns_cnn10', + default='panns_cnn14', help='Choose model type of cls task.') self.parser.add_argument( '--config', @@ -127,8 +127,8 @@ class CLSExecutor(BaseExecutor): def _init_from_path(self, model_type: str='panns_cnn14', cfg_path: Optional[os.PathLike]=None, - label_file: Optional[os.PathLike]=None, - ckpt_path: Optional[os.PathLike]=None): + ckpt_path: Optional[os.PathLike]=None, + label_file: Optional[os.PathLike]=None): """ Init model and other resources from a specific path. """ @@ -244,15 +244,15 @@ class CLSExecutor(BaseExecutor): logger.exception(e) return False - def __call__(self, model_type, cfg_path, label_file, ckpt_path, audio_file, - topk, device): + def __call__(self, model, config, ckpt_path, label_file, audio_file, topk, + device): """ Python API to call an executor. """ audio_file = os.path.abspath(audio_file) # self._check(audio_file, sample_rate) paddle.set_device(device) - self._init_from_path(model_type, cfg_path, label_file, ckpt_path) + self._init_from_path(model, config, ckpt_path, label_file) self.preprocess(audio_file) self.infer() res = self.postprocess(topk) # Retrieve result of cls.