From 40b2bd109f3e18a6fb9577d9586fd46be7122f05 Mon Sep 17 00:00:00 2001 From: zxcd <228587199@qq.com> Date: Fri, 29 Aug 2025 19:29:46 +0800 Subject: [PATCH] fix bug --- paddlespeech/s2t/models/whisper/whisper.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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()