diff --git a/paddlespeech/cli/asr/infer.py b/paddlespeech/cli/asr/infer.py index 863a933f2a7446b920228fe2f5fa6e0294b50d5d..8b10b6b652c984d9d0083c6f90b324f6d40d5951 100644 --- a/paddlespeech/cli/asr/infer.py +++ b/paddlespeech/cli/asr/infer.py @@ -135,6 +135,8 @@ class ASRExecutor(BaseExecutor): Init model and other resources from a specific path. """ logger.info("start to init the model") + # default max_len: unit:second + self.max_len = 50 if hasattr(self, 'model'): logger.info('Model had been initialized.') return @@ -479,11 +481,11 @@ class ASRExecutor(BaseExecutor): Python API to call an executor. """ audio_file = os.path.abspath(audio_file) - if not self._check(audio_file, sample_rate, force_yes): - sys.exit(-1) paddle.set_device(device) self._init_from_path(model, lang, sample_rate, config, decode_method, ckpt_path) + if not self._check(audio_file, sample_rate, force_yes): + sys.exit(-1) if rtf: k = self.__class__.__name__ CLI_TIMER[k]['start'].append(time.time())