瀏覽代碼

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,