diff --git a/paddlespeech/s2t/models/whisper/whisper.py b/paddlespeech/s2t/models/whisper/whisper.py index 9914d0dd8..54aef0956 100644 --- a/paddlespeech/s2t/models/whisper/whisper.py +++ b/paddlespeech/s2t/models/whisper/whisper.py @@ -700,7 +700,8 @@ def transcribe( consecutive = paddle.where(timestamp_tokens[:-1] & timestamp_tokens[ 1:])[0] - consecutive = paddle.add(consecutive, paddle.to_tensor(1)) + if consecutive.numel() != 0: + consecutive = paddle.add(consecutive, paddle.to_tensor(1)) if len(consecutive) > 0: # if the output contains two consecutive timestamp tokens slices = consecutive.tolist()