Skip to content

Commit 201276a

Browse files
remove the context correctly (#58)
1 parent 7578992 commit 201276a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ctc_forced_aligner/alignment_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,13 @@ def generate_emissions(
144144
emissions_ = model(input_batch).logits
145145
emissions_arr.append(emissions_)
146146

147-
emissions = torch.cat(emissions_arr, dim=0).flatten(0, 1)
147+
emissions = torch.cat(emissions_arr, dim=0)
148148
if context > 0:
149149
emissions = emissions[
150+
:,
150151
time_to_frame(context_length) : -time_to_frame(context_length) + 1,
151152
] # removing the context
153+
emissions = emissions.flatten(0, 1)
152154

153155
if time_to_frame(extension / SAMPLING_FREQ) > 0:
154156
emissions = emissions[: -time_to_frame(extension / SAMPLING_FREQ)]

0 commit comments

Comments
 (0)