Repository navigation
Fix LazyNeMoIterator for non-tarred S3 audio data - #15732
Merged
Merged
Conversation
melllinia
force-pushed
the
fix/get-full-path-datastore-uri
branch
from
May 27, 2026 15:06
77ba4ed to
b8ea0fa
Compare
Two issues prevent LazyNeMoIterator from reading manifests that
reference audio files on object stores (s3://, ais://) when using
non-tarred (type: nemo) format:
1. get_full_path joins S3 URIs with manifest directory
`os.path.isabs("s3://bucket/file.opus")` returns False, so
get_full_path treats the S3 URI as a relative path and joins it
with the manifest directory, producing invalid paths like:
"s3:/manifest_dir/s3:/bucket/file.opus"
Fix: check `is_datastore_path(audio_file)` before any relative-path
logic and return the URI directly.
2. LazyNeMoIterator only pops "sampling_rate", ignoring "sample_rate"
Many datasets (e.g. ssl_yt_harvested) use "sample_rate" in their
manifests. When the field is missing, NeMo falls back to
`Recording.from_file()` which cannot read S3 URIs via soundfile.
Fix: fall back to `data.pop("sample_rate", None)` when
"sampling_rate" is not present.
Reproducer:
# Manifest on S3 with entries like:
# {"audio_filepath": "s3://bucket/audios/file.opus", "duration": 100, "sample_rate": 48000}
from lhotse import CutSet
from nemo.collections.common.data.lhotse.nemo_adapters import LazyNeMoIterator
cutset = CutSet(LazyNeMoIterator("path/to/manifest.jsonl"))
for cut in cutset: # Fails without fix
audio = cut.load_audio()
Signed-off-by: Meline Mkrtchyan <mmkrtchyan@nvidia.com>
melllinia
force-pushed
the
fix/get-full-path-datastore-uri
branch
from
May 27, 2026 15:07
b8ea0fa to
1b21c6f
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes LazyNeMoIterator and manifest path resolution so NeMo JSON manifests can reference non-tarred audio stored on object stores (e.g., s3://, ais://) without breaking path handling or triggering local-only audio metadata probing.
Changes:
- Update
get_full_path()to treat datastore URIs as absolute and return them unchanged (or cached), instead of joining them with the manifest directory. - Update
LazyNeMoIteratorto acceptsample_rateas an alias/fallback forsampling_ratewhen creating Lhotse recordings.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
nemo/collections/common/parts/preprocessing/manifest.py |
Prevents object-store URIs from being incorrectly treated as relative paths during full-path resolution. |
nemo/collections/common/data/lhotse/nemo_adapters.py |
Adds sample_rate fallback when extracting sampling rate from NeMo manifest entries to avoid failing SR inference on remote URIs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
pzelasko
previously approved these changes
May 27, 2026
Collaborator
|
/ok to test eec9e20 |
melllinia
force-pushed
the
fix/get-full-path-datastore-uri
branch
from
May 28, 2026 05:31
4273e13 to
0ad27f6
Compare
- Replace `or` operator with explicit `is None` check to avoid incorrect fallthrough when sampling_rate is 0 (falsy) - Add test_get_full_path_datastore_uri_passthrough: verifies S3/AIS URIs are returned unchanged by get_full_path - Add test_lazy_nemo_iterator_sample_rate_fallback: verifies LazyNeMoIterator uses sample_rate when sampling_rate is absent Signed-off-by: Meline Mkrtchyan <mmkrtchyan@nvidia.com>
melllinia
force-pushed
the
fix/get-full-path-datastore-uri
branch
from
May 28, 2026 05:43
0ad27f6 to
6f89b91
Compare
Member
Author
|
/ok to test 6f89b91 |
Contributor
|
[🤖]: Hi @melllinia 👋, We wanted to let you know that a CICD pipeline for this PR just finished successfully. So it might be time to merge this PR or get some approvals. |
This branch was previously deployed
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.
Summary
Fixes two issues that prevent
LazyNeMoIteratorfrom reading NeMo manifests referencing audio on object stores (s3://, ais://) in non-tarred format.Issue 1:
get_full_pathjoins S3 URIs with manifest directoryos.path.isabs("s3://bucket/file.opus")returnsFalse, causingget_full_pathto treat S3 URIs as relative paths and join with the manifest directory:Fix: Check
is_datastore_path(audio_file)at the top ofget_full_pathbefore any relative-path logic.Issue 2:
LazyNeMoIteratoronly pops"sampling_rate", ignoring"sample_rate"Many datasets use
"sample_rate"(e.g., ssl_yt_harvested). When the field is missing, NeMo falls back toRecording.from_file()which callssoundfile.info()on an S3 URI — which fails.Fix:
data.pop("sampling_rate", None) or data.pop("sample_rate", None)How to reproduce
When does this happen?
type: nemo) with S3/AIS audio pathstype: nemo_tarred) is unaffected becauseLazyNeMoTarredIteratorreads audio bytes directly from tarFiles changed
nemo/collections/common/parts/preprocessing/manifest.py— early return for datastore URIsnemo/collections/common/data/lhotse/nemo_adapters.py— sample_rate fallbackTest plan
get_full_pathreturns S3 URIs unchangeds3://audio-riva-originalsviaLazyNeMoIterator