Skip to content

Fix Lhotse training limits for prompt ASR models - #16019

Open
SiavashShams wants to merge 2 commits into
NVIDIA-NeMo:mainfrom
SiavashShams:oss/nemo-speech-16004-lhotse-limit-train-batch-20260803-peech16004
Open

Fix Lhotse training limits for prompt ASR models#16019
SiavashShams wants to merge 2 commits into
NVIDIA-NeMo:mainfrom
SiavashShams:oss/nemo-speech-16004-lhotse-limit-train-batch-20260803-peech16004

Conversation

@SiavashShams

@SiavashShams SiavashShams commented Aug 4, 2026

Copy link
Copy Markdown

Important

The Update branch button must only be pressed in very rare occassions.
An outdated branch is never blocking the merge of a PR.
Please reach out to the automation team before pressing that button.

What does this PR do ?

Prevent prompt-conditioned RNNT and hybrid ASR models from treating Lhotse or unsized Hugging Face streaming loaders as native tarred iterable datasets when normalizing limit_train_batches.

Collection: ASR

Changelog

  • Leave floating limit_train_batches values unchanged for Lhotse prompt training loaders.
  • Leave them unchanged for non-tarred streaming datasets that do not define a length.
  • Preserve batch-count conversion for native sized tarred IterableDataset loaders.
  • Add focused regression coverage for both prompt model variants and all three loader paths.

Usage

trainer.limit_train_batches=1.0 can be used with finite prompt-conditioned Lhotse training manifests without overriding the dataset configuration.

trainer:
  limit_train_batches: 1.0

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".

Local validation:

  • pytest -p no:cacheprovider -m unit -v tests/collections/asr/test_asr_rnnt_encoder_model_bpe_prompt.py tests/collections/asr/test_asr_hybrid_rnnt_ctc_model_bpe_prompt.py -k "setup_training_data and limit_train_batches" — 6 passed.
  • pytest -p no:cacheprovider -m unit -v tests/collections/asr/test_asr_rnnt_encoder_model_bpe_prompt.py tests/collections/asr/test_asr_hybrid_rnnt_ctc_model_bpe_prompt.py — 33 passed.
  • Changed-file isort, Black, and setup.py style checks passed.
  • pytest -p no:cacheprovider tests/collections/asr -m "not pleasefixme" --cpu -v was stopped after 140.75 seconds with 212 passed and 18 skipped; unrelated failures required unavailable model data, a writable external model cache, or matplotlib.

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? No documentation change is needed for this internal loader guard.
  • 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?

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

Signed-off-by: SiavashShams <siavashshams.ac@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the ASR label Aug 4, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6d41e2e90e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +272 to +273
and hasattr(self._train_dl, 'dataset')
and isinstance(self._train_dl.dataset, torch.utils.data.IterableDataset)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Exclude unsized streaming datasets from batch-limit conversion

When either prompt model uses a non-Lhotse Hugging Face streaming dataset (streaming: true with hf_data_cfg), the dataset factory returns HFIterableAudioToBPEDataset, whose __len__ explicitly raises NotImplementedError (hf_audio_to_text.py:483-487). This broadened IterableDataset condition therefore reaches len(self._train_dl.dataset) during setup and prevents training from starting; the previous is_tarred guard skipped this supported path. Restrict the conversion to sized/tarred iterable datasets, and apply the same correction to the mirrored hybrid implementation.

Useful? React with 👍 / 👎.

Signed-off-by: SiavashShams <siavashshams.ac@gmail.com>
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ASR community-request waiting-on-maintainers Waiting on maintainers to respond

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants