From 2b5bc6df390dfe2eb07fb1d380688c55b062d89c Mon Sep 17 00:00:00 2001 From: huangyuxin Date: Thu, 9 Jun 2022 05:25:28 +0000 Subject: [PATCH] fix cli, test=doc --- paddlespeech/cli/asr/infer.py | 5 +++-- paddlespeech/server/engine/asr/online/asr_engine.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/paddlespeech/cli/asr/infer.py b/paddlespeech/cli/asr/infer.py index 76fd34e8..00cad150 100644 --- a/paddlespeech/cli/asr/infer.py +++ b/paddlespeech/cli/asr/infer.py @@ -136,7 +136,6 @@ class ASRExecutor(BaseExecutor): logger.info("start to init the model") # default max_len: unit:second self.max_len = 50 - assert num_decoding_left_chunks == -1 or num_decoding_left_chunks >= 0 if hasattr(self, 'model'): logger.info('Model had been initialized.') return @@ -187,7 +186,9 @@ class ASRExecutor(BaseExecutor): elif "conformer" in model_type or "transformer" in model_type: self.config.decode.decoding_method = decode_method - self.config.num_decoding_left_chunks = num_decoding_left_chunks + if num_decoding_left_chunks: + assert num_decoding_left_chunks == -1 or num_decoding_left_chunks >= 0, f"num_decoding_left_chunks should be -1 or >=0" + self.config.num_decoding_left_chunks = num_decoding_left_chunks else: raise Exception("wrong type") diff --git a/paddlespeech/server/engine/asr/online/asr_engine.py b/paddlespeech/server/engine/asr/online/asr_engine.py index 3eefa9d7..a1285e4e 100644 --- a/paddlespeech/server/engine/asr/online/asr_engine.py +++ b/paddlespeech/server/engine/asr/online/asr_engine.py @@ -791,8 +791,8 @@ class ASRServerExecutor(ASRExecutor): self.config.decode.decoding_method = decode_method # update num_decoding_left_chunks if num_decoding_left_chunks: + assert num_decoding_left_chunks == -1 or num_decoding_left_chunks >= 0, f"num_decoding_left_chunks should be -1 or >=0" self.config.decode.num_decoding_left_chunks = num_decoding_left_chunks - assert self.config.decode.num_decoding_left_chunks == -1 or self.config.decode.num_decoding_left_chunks >= 0, f"num_decoding_left_chunks should be -1 or >=0" # we only support ctc_prefix_beam_search and attention_rescoring dedoding method # Generally we set the decoding_method to attention_rescoring if self.config.decode.decoding_method not in [