-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lhotse] Support for NeMo tarred manifests with offset field #10035
Conversation
Signed-off-by: Piotr Żelasko <[email protected]>
Signed-off-by: Piotr Żelasko <[email protected]>
Signed-off-by: Piotr Żelasko <[email protected]>
Signed-off-by: zhehuaichen <[email protected]>
Signed-off-by: Piotr Żelasko <[email protected]>
a72e988
to
60dae9f
Compare
Signed-off-by: Piotr Żelasko <[email protected]>
@@ -21,10 +21,11 @@ | |||
import numpy as np | |||
import pytest | |||
import torch | |||
from lhotse import CutSet, MonoCut, NumpyFilesWriter, Recording | |||
from lhotse import CutSet, MonoCut, NumpyFilesWriter, Recording, SupervisionSegment, compute_num_samples |
Check notice
Code scanning / CodeQL
Unused import Note test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me . @KunalDhawan or @tango4j can either of you guys also take a look?
I will do a test with this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you Piotr!
Signed-off-by: zhehuaichen <[email protected]>
@pzelasko I checked, caching def taropen_build(tar_path):
import tarfile
tar = tarfile.open(tar_path)
tarinfo_index = {tarinfo.name : tarinfo for tarinfo in tar.getmembers()}
return lambda member_path, mode: tar.extractfile(tarinfo_index[member_path]) if mode == 'rb' else None
# instead for uncompressed tars (which makes sense for audio files) can do without caching the TarInfo structure and just cache two ints per string file name, this makes it more amenable to sharing between DataLoader threads and easier to sync in tensors
#import io
#tarinfo_index = {tarinfo.name : (tarinfo.offset_data, tarinfo.size) for tarinfo in tar.getmembers()}
#return lambda member_path, mode: [io.BytesIO(f.seek(e[0]) and f.read(e[1])) for f in [open(tar_path, mode)] for e in [tarinfo_index[member_path]]][0] if mode == 'rb' else None
if __name__ == '__main__':
taropen = taropen_build('myfile.tar')
print(taropen('mymember.txt', 'rb').read()) Supporting |
We already support tars with wav/opus. Linear scan is not feasible for URL data sources (cloud storage, AIStore). |
…10035) * [lhotse] Support for NeMo tarred manifests with offset field Signed-off-by: Piotr Żelasko <[email protected]> * typo fix Signed-off-by: Piotr Żelasko <[email protected]> * fix basename Signed-off-by: Piotr Żelasko <[email protected]> * relieve heavy CPU memory usage for super-long tarred recordings Signed-off-by: Piotr Żelasko <[email protected]> * Tests and fixes Signed-off-by: Piotr Żelasko <[email protected]> --------- Signed-off-by: Piotr Żelasko <[email protected]> Signed-off-by: adityavavre <[email protected]>
* [lhotse] Support for NeMo tarred manifests with offset field Signed-off-by: Piotr Żelasko <[email protected]> * typo fix Signed-off-by: Piotr Żelasko <[email protected]> * fix basename Signed-off-by: Piotr Żelasko <[email protected]> * relieve heavy CPU memory usage for super-long tarred recordings Signed-off-by: Piotr Żelasko <[email protected]> * Tests and fixes Signed-off-by: Piotr Żelasko <[email protected]> --------- Signed-off-by: Piotr Żelasko <[email protected]>
…10035) * [lhotse] Support for NeMo tarred manifests with offset field Signed-off-by: Piotr Żelasko <[email protected]> * typo fix Signed-off-by: Piotr Żelasko <[email protected]> * fix basename Signed-off-by: Piotr Żelasko <[email protected]> * relieve heavy CPU memory usage for super-long tarred recordings Signed-off-by: Piotr Żelasko <[email protected]> * Tests and fixes Signed-off-by: Piotr Żelasko <[email protected]> --------- Signed-off-by: Piotr Żelasko <[email protected]> Signed-off-by: Hainan Xu <[email protected]>
…10035) * [lhotse] Support for NeMo tarred manifests with offset field Signed-off-by: Piotr Żelasko <[email protected]> * typo fix Signed-off-by: Piotr Żelasko <[email protected]> * fix basename Signed-off-by: Piotr Żelasko <[email protected]> * relieve heavy CPU memory usage for super-long tarred recordings Signed-off-by: Piotr Żelasko <[email protected]> * Tests and fixes Signed-off-by: Piotr Żelasko <[email protected]> --------- Signed-off-by: Piotr Żelasko <[email protected]>
What does this PR do ?
Support for NeMo tarred manifests with offset field in lhotse dataloading.
Collection: ASR
Changelog
Usage
# Add a code snippet demonstrating how to use this
GitHub Actions CI
The Jenkins CI system has been replaced by GitHub Actions self-hosted runners.
The GitHub Actions CI will run automatically when the "Run CICD" label is added to the PR.
To re-run CI remove and add the label again.
To run CI on an untrusted fork, a NeMo user with write access must first click "Approve and run".
Before your PR is "Ready for review"
Pre checks:
PR Type:
If you haven't finished some of the above items you can still open "Draft" PR.
Who can review?
Anyone in the community is free to review the PR once the checks have passed.
Contributor guidelines contains specific people who can review PRs to various areas.
Additional Information