NeMo icon indicating copy to clipboard operation
NeMo copied to clipboard

add CTC batched beam search

Open lilithgrigoryan opened this issue 8 months ago • 1 comments

What does this PR do ?

Batched beam search for CTC with NGPU-LM (n-gram LM on GPU).

Results for nvidia/parakeet-ctc-1.1b on SLURP (out-of-domain):

Decoding Method Beam Size Beam Beta LM Weight* SLURP Test WER (%) ↓ RTFx ↑
greedy 19.93 491
beam_batch 12 1.0 0.7 16.15 456

*LM weight - optimal on SLURP dev set with step 0.1

Batch size 32, high fp32 matmul precision, sorted manifest, A5000 GPU. 6-gram LM is built on SLURP train texts.

Collection: [ASR]

Changelog

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

Usage

Usage without LM

python examples/asr/speech_to_text_eval.py \
   pretrained_name="nvidia/parakeet-ctc-1.1b" \
   dataset_manifest=<dataset_manifest>  \
   batch_size=32 \
   output_filename=decoded.jsonl \
   ctc_decoding.strategy="beam_batch" \
   ctc_decoding.beam.beam_size=12 \
   ctc_decoding.beam.beam_beta=0.3

Usage with LM

Step 1: Build LM for ASR Model (tokenizer-dependent) on domain texts

python nemo/scripts/asr_language_modeling/ngram_lm/train_kenlm.py \
      nemo_model_file="nvidia/parakeet-ctc-1.1b" \
      train_paths=["<train_manifest>"] \
      kenlm_bin_path=$KENLM_BIN_PATH \
      kenlm_model_file=parakeet-ctc-1.1b_lm-o6.arpa \
      ngram_length=6 \
      preserve_arpa=true \
      save_nemo=true

Step 2: Run Decoding with LM

python examples/asr/speech_to_text_eval.py \
   pretrained_name="nvidia/parakeet-ctc-1.1b" \
   dataset_manifest=<dataset_manifest>  \
   batch_size=32 \
   output_filename=decoded.jsonl \
   ctc_decoding.strategy="beam_batch" \
   ctc_decoding.beam.ngram_lm_model="parakeet-ctc-1.1b_lm-o6.arpa.nemo" \
   ctc_decoding.beam.ngram_lm_alpha=0.4 \
   ctc_decoding.beam.beam_beta=0.4 \
   ctc_decoding.beam.beam_size=12

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:

  • [x] Make sure you read and followed Contributor guidelines
  • [x] 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:

  • [x] New Feature
  • [ ] Bugfix
  • [ ] Documentation

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

  • Related to # (issue)

lilithgrigoryan avatar Apr 29 '25 21:04 lilithgrigoryan

There’s a known error, let me know if you want to proceed with merging this PR

ko3n1g avatar May 03 '25 13:05 ko3n1g

[🤖]: Hi @lilithgrigoryan 👋,

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.

//cc @chtruong814 @ko3n1g @pablo-garay @thomasdhc

github-actions[bot] avatar May 20 '25 09:05 github-actions[bot]

[🤖]: Hi @lilithgrigoryan 👋,

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.

//cc @chtruong814 @ko3n1g @pablo-garay @thomasdhc

github-actions[bot] avatar Jun 01 '25 03:06 github-actions[bot]

[🤖]: Hi @lilithgrigoryan 👋,

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.

//cc @chtruong814 @ko3n1g @pablo-garay @thomasdhc

github-actions[bot] avatar Jun 09 '25 11:06 github-actions[bot]

[🤖]: Hi @lilithgrigoryan 👋,

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.

//cc @chtruong814 @ko3n1g @pablo-garay @thomasdhc

github-actions[bot] avatar Jun 09 '25 14:06 github-actions[bot]

[🤖]: Hi @lilithgrigoryan 👋,

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.

//cc @chtruong814 @ko3n1g @pablo-garay @thomasdhc

github-actions[bot] avatar Jun 10 '25 07:06 github-actions[bot]