Skip to content

fix(audio-postprocessing): accept diarizer segment shapes; make TimestampMapperStage agent-ready - #2334

Open
shubhamNvidia wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
shubhamNvidia:agent/postprocessing
Open

fix(audio-postprocessing): accept diarizer segment shapes; make TimestampMapperStage agent-ready#2334
shubhamNvidia wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
shubhamNvidia:agent/postprocessing

Conversation

@shubhamNvidia

Copy link
Copy Markdown
Contributor

Contracts: describe() + *_key params on TimestampMapperStage (maps split-clip timestamps back to the original file).

Bug fix — diarize → timestamp-map pipelines crashed.
Two producers emit two different segment shapes: VAD and speaker-separation emit [start, end] pairs, while the diarizers emit {start, end, speaker} dicts. The stage only read pairs, so a real diarizer's output raised KeyError: 0 and killed the pipeline. It now accepts both shapes, and echoes back the shape it was given — rewriting a diarizer's dict as a bare pair would have thrown away the speaker label, which is the whole point of running diarization. A single malformed segment is now skipped instead of taking down the batch.

Depends on the agent-ready foundation, #2332 — that must merge first (this branch imports nemo_curator/stages/audio/_agent/, so CI here stays red until it lands).

Adds a describe() contract so a planner can tell what the stage reads and writes before running it.

Depends on the agent-ready foundation (nemo_curator/stages/audio/_agent/), which must merge first.

Signed-off-by: Shubham Bhawsar <shbhawsar@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Aug 25, 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.

@shubhamNvidia
shubhamNvidia marked this pull request as ready for review August 25, 2026 11:19
@shubhamNvidia
shubhamNvidia requested a review from a team as a code owner August 25, 2026 11:19
@shubhamNvidia
shubhamNvidia requested review from oyilmaz-nvidia and removed request for a team August 25, 2026 11:19
@greptile-apps

greptile-apps Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR makes TimestampMapperStage agent-ready and adds configurable field names while extending diarization handling to preserve both pair and speaker-labeled dictionary segment shapes.

  • Adds stage contract metadata, configurable input/output keys, and agent readiness.
  • Maps diarization-only timing through concatenation metadata and prioritizes precise start_ms/end_ms ranges when available.
  • Preserves speaker labels, skips unreadable segment shapes, and adds regression coverage for the supported pipelines.

Confidence Score: 4/5

The malformed-bound handling should be fixed before merging because a single non-finite diarization timestamp can still terminate processing despite the new skip-on-malformed contract.

The new parser accepts every float-convertible bound, allowing non-finite values to reach integer timestamp conversion and reversed intervals to produce negative duration data.

Files Needing Attention: nemo_curator/stages/audio/postprocessing/timestamp_mapper.py

Important Files Changed

Filename Overview
nemo_curator/stages/audio/postprocessing/timestamp_mapper.py Adds agent contracts, configurable keys, and dual-shape diarization support, but malformed numeric bounds can still crash processing or emit invalid durations.
tests/stages/audio/postprocessing/test_timestamp_mapper.py Adds focused regressions for dictionary and pair segments, speaker-label preservation, overlap handling, sanitization, and precise multispeaker mapping.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[AudioTask] --> B{segment mappings?}
  B -->|Yes| C{start/end present?}
  C -->|Yes| D[Translate precise range]
  C -->|No| E[Translate diarization segments]
  B -->|No| F[Derive timing from start/end, diarization, or duration]
  D --> G[Allowlisted output]
  E --> G
  F --> G
Loading

Reviews (1): Last reviewed commit: "feat(audio-postprocessing): make Timesta..." | Re-trigger Greptile

Comment on lines +78 to +80
try:
return float(start), float(end)
except (TypeError, ValueError):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Malformed numeric bounds remain readable

When a diarization segment contains NaN, infinity, or an end timestamp earlier than its start, _segment_bounds accepts it as readable, causing integer timestamp conversion to raise or negative duration fields to be emitted instead of skipping the malformed segment.

@shubhamNvidia
shubhamNvidia requested review from ayushdg, mohammadaaftabv and sarahyurick and removed request for oyilmaz-nvidia August 25, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant