From 02374357a18d0d435792a55b615ff4a37a638164 Mon Sep 17 00:00:00 2001 From: Philipp Mandler Date: Thu, 28 Sep 2023 11:59:12 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Fix=20unpacking=20None=20value?= =?UTF-8?q?=20in=20alignment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes #352 --- worker/transcribee_worker/torchaudio_align.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/worker/transcribee_worker/torchaudio_align.py b/worker/transcribee_worker/torchaudio_align.py index 4d37b87a..fd07589e 100644 --- a/worker/transcribee_worker/torchaudio_align.py +++ b/worker/transcribee_worker/torchaudio_align.py @@ -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: @@ -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: