Skip to content
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

Add support for Time Stamp calculation using transcribe_speech.py #5568

Merged
merged 2 commits into from
Dec 7, 2022

Conversation

titu1994
Copy link
Collaborator

@titu1994 titu1994 commented Dec 7, 2022

Signed-off-by: smajumdar titu1994@gmail.com

What does this PR do ?

Adds flag to compute word and char level timestamp using the transcribe speech script.

Collection: [ASR]

Changelog

  • Add specific line by line info of high level changes in this PR.

Usage

python transcribe_speech.py \
    model_path=null \
    pretrained_name=null \
    audio_dir="<remove or path to folder of audio files>" \
    dataset_manifest="<remove or path to manifest>" \
    output_filename="<remove or specify output filename>" \
    batch_size=32 \
    compute_timestamps=True \
    compute_langs=False \
    cuda=0 \
    amp=True

(Optionally)
    ctc_decoding.ctc_timestamp_type="all"  # (default all, can be [all, char, word])
    rnnt_decoding.rnnt_timestamp_type="all"  # (default all, can be [all, char, word])

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?
  • Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
    • Reviewer: Does the PR have correct import guards for all optional libraries?

PR Type:

  • New Feature
  • Bugfix
  • Documentation

If you haven't finished some of the above items you can still open "Draft" PR.

Who can review?

Signed-off-by: smajumdar <titu1994@gmail.com>
@github-actions github-actions bot added the ASR label Dec 7, 2022
compute_langs: Bool to request language ID information (if the model supports it)

(Optionally: You can limit the type of timestamp computations using below overrides)
ctc_decoding.ctc_timestamp_type="all" # (default all, can be [all, char, word])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may not related to this PR, but can we make the name of the param for both ctc and rnnt the same, something like timestamp_type?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible. I wanted it to be explicit cause technically hybrid models might overwrite each other value but it turns out it's not the case

if compute_timestamps:
timestamps = transcriptions[idx].timestep
if timestamps is not None and isinstance(timestamps, dict):
timestamps.pop(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is poping done to save cpu or gpu memory?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The item there is a torch tensor with just integer IDs corresponding to location in audio stream where some text token was emitted. Very low utilities and is just a building block for the char and word based dicts

@titu1994 titu1994 merged commit 4c72952 into NVIDIA:main Dec 7, 2022
@titu1994 titu1994 deleted the improve_transcribe branch December 7, 2022 19:16
andrusenkoau pushed a commit to andrusenkoau/NeMo that referenced this pull request Jan 5, 2023
Signed-off-by: smajumdar <titu1994@gmail.com>

Signed-off-by: smajumdar <titu1994@gmail.com>
Co-authored-by: Vahid Noroozi <VahidooX@users.noreply.github.com>
Signed-off-by: andrusenkoau <andrusenkoau@gmail.com>
titu1994 added a commit to titu1994/NeMo that referenced this pull request Mar 24, 2023
Signed-off-by: smajumdar <titu1994@gmail.com>

Signed-off-by: smajumdar <titu1994@gmail.com>
Co-authored-by: Vahid Noroozi <VahidooX@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants