Skip to content

Commit

Permalink
🔧 Fix unpacking None value in alignment
Browse files Browse the repository at this point in the history
fixes #352
  • Loading branch information
phlmn committed Oct 2, 2023
1 parent 075c761 commit 0237435
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions worker/transcribee_worker/torchaudio_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,12 @@ def work(queue, audio):
# Atoms).
# We might want to consider not counting the word separator to the timing of a atom.

atom_index_to_timing_index = []
atom_index_to_timing_index: list[
tuple[
tuple[int | None, int] | None,
tuple[int | None, int] | None,
]
] = []
tokens = []

for atom in atoms:
Expand Down Expand Up @@ -257,7 +262,11 @@ def work(queue, audio):
waveform_segment.size(1) / (trellis.size(0) - 1)
) / settings.SAMPLE_RATE
for i, atom in enumerate(atoms):
(start, last_end), (end, next_start) = atom_index_to_timing_index[i]
start_info, end_info = atom_index_to_timing_index[i]
if start_info is None or end_info is None:
continue

(start, last_end), (end, next_start) = start_info, end_info

if start is None:
if last_end < 0:
Expand Down

0 comments on commit 0237435

Please sign in to comment.