Skip to content

Commit 211cf2a

Browse files
authored
Fix alignment (copy PR m-bain#1081 from main repo)
1 parent b343241 commit 211cf2a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

whisperx/alignment.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,8 @@ def get_wildcard_emission(frame_emission, tokens, blank_id):
416416
tensor: Maximum probability score for each token position
417417
"""
418418
assert 0 <= blank_id < len(frame_emission)
419+
if len(tokens) == 0:
420+
return torch.tensor([])
419421

420422
# Convert tokens to a tensor if they are not already
421423
tokens = torch.tensor(tokens) if not isinstance(tokens, torch.Tensor) else tokens

0 commit comments

Comments
 (0)