Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔧 Fix unpacking None value in alignment #369

Merged
merged 1 commit into from
Oct 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Comment on lines +266 to +267
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a comment why/how this can happen?

Copy link
Member Author

@phlmn phlmn Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is quite a quick and dirty fix for now. I started refactoring the code, but actually I think we should completely redo the alignment instead


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

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