fix(asr): keep all subsegments in get_subsegment_dict (diarization dataset gen)#15889
Open
harjothkhara wants to merge 1 commit into
Open
fix(asr): keep all subsegments in get_subsegment_dict (diarization dataset gen)#15889harjothkhara wants to merge 1 commit into
harjothkhara wants to merge 1 commit into
Conversation
In get_subsegment_dict the two `.append(...)` calls that record a subsegment's timestamp and json entry were indented at the same level as the enclosing `for subsegment in subsegments` loop, i.e. outside it. As a result they ran once per manifest line instead of once per subsegment, and `start, dur` held only the last subsegment -- every earlier subsegment was silently dropped. This corrupts speaker-diarization training-dataset generation (create_segment_manifest -> write_truncated_subsegments, and scripts/speaker_tasks/create_diarization_train_dataset.py): most subsegments per segment were discarded with no error. Indent the two appends into the loop so every subsegment is recorded. Adds a GPU-free unit test that drives get_subsegment_dict with a synthetic manifest and asserts one entry per subsegment. Signed-off-by: harjoth <harjoth.khara@gmail.com>
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.
What does this PR do ?
Fixes a silent data-loss bug in
get_subsegment_dict: all but the last subsegment of each manifest line are dropped, which silently shrinks speaker-diarization training datasets.Collection: ASR / speaker tasks (
nemo/collections/asr/parts/utils/manifest_utils.py)Changelog
In
get_subsegment_dict, the two.append(...)calls that record a subsegment's timestamp ('ts') and json entry ('json_dic') were indented at the same level as the enclosingfor subsegment in subsegments:loop — i.e. outside it:So they ran once per manifest line instead of once per subsegment, and
start, durheld only the last subsegment — every earlier subsegment was silently discarded. (Theforloop was otherwise pointless, which confirms the appends were meant to live inside it.)Fix: indent the two appends into the loop so every subsegment is recorded.
Usage
With
window=1.5, shift=0.75, deci=3on a 5.0s segment,get_subsegments_scriptableyields 6 subsegments:Before your PR is "Ready for review"
Pre checks:
tests/collections/asr/utils/test_manifest_utils.pyPR Type:
Additional Information
create_segment_manifest->write_truncated_subsegmentsandscripts/speaker_tasks/create_diarization_train_dataset.pybuild diarization training data; the bug silently dropped most subsegments per segment (e.g. 5 of every 6 above) with no error.get_subsegment_dictwith a synthetic in-memory manifest and asserts one entry per subsegment (fails on old code, passes on the fix). I don't have a CUDA machine, so pass/fail was confirmed with a standalone replica of the loop; the in-repo test runs as a normal CPU unit test in CI.