{{ message }}
Repository navigation
fix(speechlm2): preserve relocated EOS token during early interruption augmentation - #16268
Open
ManoharPaturi wants to merge 1 commit into
Open
ManoharPaturi wants to merge 1 commit into
ManoharPaturi wants to merge 1 commit into
Conversation
…n augmentation Fixes NVIDIA-NeMo#16247. In DuplexSTTDataset._apply_early_interruption_augmentation, target_tokens places eos_id at new_eos_pos before shifting the tail and padding the vacated end. When original_eos_pos sits close enough to the end of the sequence that no tail-shift runs (cont_start_pos >= seq_len - 1), the padding slice [-frames_to_remove:] starts at or before new_eos_pos, immediately overwriting the newly placed EOS token. This change calculates pad_start as new_eos_pos + 1 + max(0, tail_length) and places eos_id at new_eos_pos, guaranteeing that the relocated EOS token is never clobbered by pad_id. Added unit regression test. Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #16247.
Problem
In
DuplexSTTDataset._apply_early_interruption_augmentation(nemo/collections/speechlm2/data/duplex_stt_dataset.py), early interruption is simulated by placingeos_idatnew_eos_pos, shifting the tail if applicable, and then overwriting trailing frames withpad_id:When
original_eos_possits near the end of the sequence such thatcont_start_pos >= seq_len - 1(no tail-shift runs),frames_to_remove = original_eos_pos - cutoff. Becausenew_eos_pos = cutoff, the pad-fill range[-frames_to_remove:]starts at or beforenew_eos_pos, immediately overwriting the relocatedeos_idwithpad_id. The augmented turn ends up with no EOS token at all.Fix
Calculate the pad start boundary as
pad_start = new_eos_pos + 1 + max(0, tail_length)and settarget_tokens[batch_idx, pad_start:] = pad_id, and ensuretarget_tokens[batch_idx, new_eos_pos] = eos_idis placed so that the relocated EOS token is strictly preserved.Testing
tests/collections/speechlm2/test_duplex_early_interruption_eos.pyexercising the boundary condition (seq_len=25,original_eos_pos=24,overlap_tokens=5) and asserting that the relocated EOS token is preserved.