소스 검색

abort find_alignment on empty input (#1090)

Jong Wook Kim 2 년 전
부모
커밋
79c43e4859
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      whisper/timing.py

+ 3 - 0
whisper/timing.py

@@ -170,6 +170,9 @@ def find_alignment(
     medfilt_width: int = 7,
     qk_scale: float = 1.0,
 ) -> List[WordTiming]:
+    if len(text_tokens) == 0:
+        return []
+
     tokens = torch.tensor(
         [
             *tokenizer.sot_sequence,