-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Support dataloader as input to audio
for transcription
#9201
Conversation
Fyi @nithinraok - this should enable fastpath execution for HF too |
@galv @pzelasko actual change is just these 5 lines, everything else is just black formatter and a unittest at the bottom - https://github.com/NVIDIA/NeMo/pull/9201/files#diff-04e10f8fb8f7afddb360c7ea0ff9c831613c754085d2fd06961bb80a9f932a25R372-R376 |
audio2, sr = sf.read(audio_file2, dtype='float32') | ||
|
||
dataset = DummyDataset([audio, audio2]) | ||
collate_fn = lambda x: _speech_collate_fn(x, pad_id=0) |
Check notice
Code scanning / CodeQL
Returning tuples with varying lengths Note test
tuple of size 4
tuple of size 5
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.
@titu1994 @nithinraok @galv I'd like to point out that if you're going to use a TensorDataset, make it an IterableDataset that yields collated mini-batches, rather than relying on DataLoader's batch_size and collate_fn to do it for you. This way you'll amortize the overhead of collation as it will happen in the background process. This change will matter for super-high RTFx models.
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.
minor comments. For huggingface, we need to depend on Iterable dataset I believe.
@@ -403,7 +403,8 @@ def transcribe( | |||
""" | |||
Uses greedy decoding to transcribe audio files. Use this method for debugging and prototyping. | |||
Args: | |||
audio: (a list) of paths to audio files. \ | |||
audio: (a single or list) of paths to audio files or a np.ndarray audio array. | |||
Can also be a dataloader object that provides values that can be consumed by the model. |
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.
Add torch.dataloader to audio
types in the func signature.
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.
Done
@@ -364,7 +365,8 @@ def transcribe( | |||
Generate class labels for provided audio files. Use this method for debugging and prototyping. | |||
|
|||
Args: | |||
audio: (a single or list) of paths to audio files or a np.ndarray audio sample. \ | |||
audio: (a single or list) of paths to audio files or a np.ndarray audio array. |
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.
Add torch.dataloader
to audio
types in the func signature.
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.
Done
@nithinraok can you investigate to see whether this change will fix your performance degredation issues when using transcribe() within the huggingface open asr leaderboard RTFx measurements? |
@galv yeah, I am thinking to use iterable dataset (looks like streaming is the option for huggingface datasets to get iterable dataset) and run the HF evals. |
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: titu1994 <titu1994@users.noreply.github.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
4733f85
to
403c0ae
Compare
Signed-off-by: titu1994 <titu1994@users.noreply.github.com>
* Support dataloader as input to `audio` for transcription Signed-off-by: smajumdar <titu1994@gmail.com> * Apply isort and black reformatting Signed-off-by: titu1994 <titu1994@users.noreply.github.com> * Support dataloader as input to `audio` for transcription Signed-off-by: smajumdar <titu1994@gmail.com> * Update transcribe signatures Signed-off-by: smajumdar <titu1994@gmail.com> * Apply isort and black reformatting Signed-off-by: titu1994 <titu1994@users.noreply.github.com> --------- Signed-off-by: smajumdar <titu1994@gmail.com> Signed-off-by: titu1994 <titu1994@users.noreply.github.com> (cherry picked from commit 67401ed)
* Support dataloader as input to `audio` for transcription Signed-off-by: smajumdar <titu1994@gmail.com> * Apply isort and black reformatting Signed-off-by: titu1994 <titu1994@users.noreply.github.com> * Support dataloader as input to `audio` for transcription Signed-off-by: smajumdar <titu1994@gmail.com> * Update transcribe signatures Signed-off-by: smajumdar <titu1994@gmail.com> * Apply isort and black reformatting Signed-off-by: titu1994 <titu1994@users.noreply.github.com> --------- Signed-off-by: smajumdar <titu1994@gmail.com> Signed-off-by: titu1994 <titu1994@users.noreply.github.com> (cherry picked from commit 67401ed)
* Support dataloader as input to `audio` for transcription Signed-off-by: smajumdar <titu1994@gmail.com> * Apply isort and black reformatting Signed-off-by: titu1994 <titu1994@users.noreply.github.com> * Support dataloader as input to `audio` for transcription Signed-off-by: smajumdar <titu1994@gmail.com> * Update transcribe signatures Signed-off-by: smajumdar <titu1994@gmail.com> * Apply isort and black reformatting Signed-off-by: titu1994 <titu1994@users.noreply.github.com> --------- Signed-off-by: smajumdar <titu1994@gmail.com> Signed-off-by: titu1994 <titu1994@users.noreply.github.com> Signed-off-by: Boxiang Wang <boxiangw@nvidia.com>
* Support dataloader as input to `audio` for transcription Signed-off-by: smajumdar <titu1994@gmail.com> * Apply isort and black reformatting Signed-off-by: titu1994 <titu1994@users.noreply.github.com> * Support dataloader as input to `audio` for transcription Signed-off-by: smajumdar <titu1994@gmail.com> * Update transcribe signatures Signed-off-by: smajumdar <titu1994@gmail.com> * Apply isort and black reformatting Signed-off-by: titu1994 <titu1994@users.noreply.github.com> --------- Signed-off-by: smajumdar <titu1994@gmail.com> Signed-off-by: titu1994 <titu1994@users.noreply.github.com> Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
* Support dataloader as input to `audio` for transcription Signed-off-by: smajumdar <titu1994@gmail.com> * Apply isort and black reformatting Signed-off-by: titu1994 <titu1994@users.noreply.github.com> * Support dataloader as input to `audio` for transcription Signed-off-by: smajumdar <titu1994@gmail.com> * Update transcribe signatures Signed-off-by: smajumdar <titu1994@gmail.com> * Apply isort and black reformatting Signed-off-by: titu1994 <titu1994@users.noreply.github.com> --------- Signed-off-by: smajumdar <titu1994@gmail.com> Signed-off-by: titu1994 <titu1994@users.noreply.github.com>
What does this PR do ?
Enables the use of a pre-constructed data loader as input to the model.transcribe() function.
This allows for a fastpath to ignore all manifest and tensor handling to the user, only executing the model forward and later steps.
Collection: [ASR]
Changelog
Usage
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