fix(audio-postprocessing): accept diarizer segment shapes; make TimestampMapperStage agent-ready - #2334
Conversation
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>
Greptile SummaryThe PR makes
Confidence Score: 4/5The 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
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
Reviews (1): Last reviewed commit: "feat(audio-postprocessing): make Timesta..." | Re-trigger Greptile |
| try: | ||
| return float(start), float(end) | ||
| except (TypeError, ValueError): |
There was a problem hiding this comment.
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.
Contracts:
describe()+*_keyparams onTimestampMapperStage(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 raisedKeyError: 0and 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).