Skip to content

Extract shared segment_wav into tts_dataset_utils.py - #16209

Open
StarsExpress wants to merge 2 commits into
NVIDIA-NeMo:mainfrom
StarsExpress:refactor-ssl-tts
Open

StarsExpress wants to merge 2 commits into
NVIDIA-NeMo:mainfrom
StarsExpress:refactor-ssl-tts

Conversation

@StarsExpress

@StarsExpress StarsExpress commented Sep 2, 2026

Copy link
Copy Markdown

What does this PR do ?

  • Extracted segment_wav into nemo/collections/tts/parts/utils/tts_dataset_utils.py.

  • Added docstring to explain details of how segment_wav splits a waveform into fixed-length, zero-padded segments using a sliding window.

Why?

Inside scripts/ssl_tts, both make_supdata.py and ssl_tts_vc.py duplicate the same segment_wav function for splitting a waveform into PyTorch Tensor segments.

By moving this segment_wav into tts_dataset_utils.py, now these two files can import their shared segment_wav without risks of drifting from each other.

Tests

segment_wav now lives in tts_dataset_utils.py, so tests/.../test_tts_dataset_utils.py::TestTTSDatasetUtils gains two new test functions:

  • test_segment_wav_pads_short_input — for shorter input that just needs padding.
  • test_segment_wav_sliding_window — for longer input that triggers sliding window.

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines.
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?
  • Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
  • Reviewer: Does the PR have correct import guards for all optional libraries?

PR Type:

  • Refactor

Who can review?

@blisc

@copy-pr-bot

copy-pr-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the TTS label Sep 2, 2026
@StarsExpress
StarsExpress marked this pull request as ready for review September 2, 2026 19:21
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Sep 4, 2026
@StarsExpress StarsExpress changed the title Extract shared segment_wav into tts_dataset_utils.py. Extract shared segment_wav into tts_dataset_utils.py. Sep 5, 2026
@pzelasko
pzelasko requested a review from blisc September 14, 2026 14:54
@pzelasko

Copy link
Copy Markdown
Collaborator

/ok to test fcf4746

Signed-off-by: Jack Yao <105488074+StarsExpress@users.noreply.github.com>
@StarsExpress
StarsExpress marked this pull request as ready for review September 14, 2026 17:39
@StarsExpress

StarsExpress commented Sep 14, 2026

Copy link
Copy Markdown
Author

@pzelasko thanks for your review~

Inside ade92bc, I have:

  • Rearranged imports by uv run isort . command.
  • Updated to the latest main branch commit.

Please help me re-trigger /ok to test ade92bc. Thank you~

Signed-off-by: Jack Yao <105488074+StarsExpress@users.noreply.github.com>
@StarsExpress StarsExpress changed the title Extract shared segment_wav into tts_dataset_utils.py. Extract shared segment_wav into tts_dataset_utils.py Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants