Audio: add local duration-aware ASR batching - #2346
Conversation
Signed-off-by: aaftaabv@gmail.com <aaftaabv@gmail.com>
Signed-off-by: aaftaabv@gmail.com <aaftaabv@gmail.com>
ed2cd89 to
a082cf4
Compare
Signed-off-by: aaftaabv@gmail.com <aaftaabv@gmail.com>
Signed-off-by: aaftaabv@gmail.com <aaftaabv@gmail.com>
Signed-off-by: aaftaabv@gmail.com <aaftaabv@gmail.com>
Greptile SummaryAdds local duration-aware ASR batching, fixed-duration model-input segmentation, ordered result scattering, and parent transcript stitching, together with configuration documentation and tests.
Confidence Score: 4/5The fixed context-free segmentation should be corrected before merging because it can corrupt transcripts around chunk boundaries; the segmented diagnostics schema should also be stabilized. Long inputs are cut at arbitrary sample positions and independently decoded without overlap before plain text concatenation, while multi-segment adapter diagnostics are emitted under a different schema than single-segment results. Files Needing Attention: nemo_curator/stages/audio/inference/asr/stage.py, nemo_curator/stages/audio/model_input_segmentation.py Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Parent audio rows] --> B[Load and resample]
B --> C[Fixed-duration segments]
C --> D[Duration buckets]
D --> E[Audio and item caps]
E --> F[Adapter calls]
F --> G[Scatter to segment order]
G --> H[Stitch parent transcripts]
H --> I[Original parent-row order]
Reviews (1): Last reviewed commit: "docs(audio): document local duration buc..." | Re-trigger Greptile |
| segments = plan_audio_segments( | ||
| num_samples=int(waveform.shape[0]), | ||
| sample_rate=self.target_sample_rate, | ||
| max_duration_s=self.max_inference_duration_s, | ||
| owner="ASRStage", | ||
| ) |
There was a problem hiding this comment.
When speech crosses max_inference_duration_s, the waveform is cut at a fixed sample offset and each side is decoded independently without overlap before their text is joined, causing words around the boundary to be omitted, duplicated, or mistranscribed.
Knowledge Base Used: Audio curation stages
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| chunk_extras = [dict(result.extras) for result in results] | ||
| extras = {"chunks": chunk_extras} if any(chunk_extras) else {} | ||
| return ASRResult( | ||
| text=" ".join(texts), | ||
| skipped=all_skipped, | ||
| skip_reason=skip_reason if all_skipped else None, | ||
| unsupported_language=unsupported_language, | ||
| extras=extras, |
There was a problem hiding this comment.
Segmenting changes diagnostics schema
For a segmented parent with adapter extras, this replaces the documented adapter-specific dictionary with {"chunks": [...]}, so consumers must handle a second duration-dependent schema instead of reading established keys such as detected_language at their normal location.
Knowledge Base Used: Model integrations and inference
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
mainmodel.transcribebatch mappingValidation
256 passed, 7 deselectedacross audio inference, ASR adapters, and segmentationgit diff --checkpassnithinraok/Curator:nkoluguri/integration-test[1, 2]; policy-off and reference calls:[3]This PR intentionally remains a draft.