Skip to content

Integrate OneLogger across NeMo Speech training - #16255

Merged
pzelasko merged 23 commits into
mainfrom
codex/onelogger-speech-integration
Nov 13, 2026
Merged

pzelasko merged 23 commits into
mainfrom
codex/onelogger-speech-integration

Conversation

@pzelasko

@pzelasko pzelasko commented Sep 14, 2026 •

Copy link
Copy Markdown
Collaborator

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 ?

Integrates opt-in OneLogger lifecycle and dynamic, modality-aware throughput telemetry across NeMo Speech without imposing LLM-specific batch or sequence assumptions.

Collection: ASR, TTS, SpeechLM2, Audio, Core/Lightning

Changelog

  • Attach the shared OneLogger callback through exp_manager for ModelPT and plain LightningModule workflows when NEMO_ONE_LOGGER_ENABLED=true.
  • Instrument model construction, eager/deferred dataloader creation, optimizer setup, checkpoint loading/saving, and overall training/validation timing.
  • Trace concrete Lightning strategy checkpoint loaders, including SpeechLM2 Automodel DCP restores. Preserve bound signatures, arguments, exceptions, and spawn serialization; close load spans on failure and leave disabled strategies unchanged.
  • Use reusable context and class decorators so nested operations are paired by identity and lifecycle spans close on exceptions.
  • Emit checkpoint success only after synchronous completion or asynchronous finalization; report scheduling failures explicitly.
  • Export only after explicit opt-in and only from rank zero.
  • Remove the unused standalone Lightning integration dependency; core API bindings support the standard Lightning trainer and preserve checkpoint policies including None.
  • Keep OneLogger an optional runtime dependency: disabled mode never imports it, and missing packages degrade to an empty no-op callback registry without affecting training.
  • Report the application as nemo-speech.
  • Move throughput policies into the ASR, TTS, Audio, and SpeechLM2 collection trunks.
  • Register policies on semantic mixins, base classes, or concrete models with a shared decorator; normal inheritance carries a policy to compatible subclasses.
  • Document the extension contract and a complete future-model example in the shared speech_throughput module.
  • Report actual rank-local work: ASR audio seconds and target text tokens; TTS input text tokens and output audio seconds; codec, diarization, and audio-model input seconds; DuplexSTT text and audio; speech-to-speech input/output audio at their distinct rates; and SALM post-insertion multimodal_tokens for every SALM variant.
  • Support dynamic batches and packed SALM sequences through observed length tensors and SALM's exact post-insertion multimodal-token counter.
  • Report exact rank-local example totals and rates, plus effective mean_batch_size over optimizer steps so gradient accumulation is included.
  • Report every available work unit both per second and per optimizer step; intentionally emit no _per_example metrics.
  • Align normal reporting windows to optimizer-step boundaries; lifecycle-forced partial windows retain totals and rates but omit misleading per-step means.
  • Never report global batch size, micro batch size, or a static sequence length; modalities remain separate units.
  • Avoid per-batch host scalar materialization, distributed collectives, and Megatron dependencies. GPU totals and timing are resolved asynchronously with at most one bounded pending window.
  • Skip models and measurements whose semantics cannot be determined safely.
  • Contain provider, policy, timing, and exporter failures so telemetry cannot interrupt training.
  • Add public documentation for opt-in setup, reporting cadence, lifecycle events, and model-specific metrics.

Usage

Set NEMO_ONE_LOGGER_ENABLED=true before starting training. Entry points that call exp_manager() then attach the integration automatically, and rank zero exports telemetry.

Throughput uses a minimum interval of 100 training batches by default, or a larger trainer.log_every_n_steps value. Set NEMO_ONE_LOGGER_THROUGHPUT_INTERVAL to a positive batch count to override that minimum. With gradient accumulation, normal windows close at the next optimizer-step boundary.

Validation

  • CUDA_VISIBLE_DEVICES='' OMP_NUM_THREADS=2 python -m pytest tests/lightning/test_speech_throughput.py tests/lightning/test_one_logger_callback.py --cpu -q --timeout=120 on the pinned Lightning 2.4 environment: 73 passed.
  • Prior combined qualification on Lightning/PyTorch Lightning 2.6.6 and Hydra 1.3.8: CUDA_VISIBLE_DEVICES='' OMP_NUM_THREADS=2 python -m pytest tests/core/test_dependency_compatibility.py tests/core/test_exp_manager.py tests/core/test_save_restore.py tests/core/test_serialization.py tests/lightning/test_one_logger_callback.py tests/lightning/test_speech_throughput.py tests/collections/asr/test_asr_ctcencdec_model.py tests/collections/asr/test_asr_ctc_encoder_model_bpe.py tests/collections/tts/models/test_magpietts_dataloader_config.py tests/core/test_optimizers_schedulers.py --cpu -q -m 'not pleasefixme' --timeout=180 — 223 passed, 11 skipped, 2 deselected.
  • Fresh-process enabled/disabled checks use real OneLogger core bindings, block standalone integration imports, and verify checkpoint lifecycle reporting; checkpoint tests cover False, True, and None forwarding.
  • Released ASR checkpoint restore/save/restore in that qualification checkout: 1 passed.
  • pre-commit run --from-ref origin/main --to-ref HEAD, git diff --check, and lock consistency checks passed.
  • Strict Sphinx HTML build on the combined branch passed without warnings.
  • DCO sign-offs verified against author identities.
  • Full collection suites and real TTS inference were not run. SpeechLM2 GPU/distributed qualification is recorded below.

GitHub Actions CI

Trusted PRs run automatically through copy-pr-bot.

Before your PR is "Ready for review"

Pre checks:

  • Read and followed the contributor guidelines
  • Added focused tests for the changed behavior
  • Existing OneLogger dependencies and import behavior were verified

PR Type:

  • New Feature
  • Bugfix
  • Documentation

Additional Information

Current main integration on Lightning/PyTorch Lightning 2.6.6 and Hydra 1.3.8:

  • Merged current main without rewriting existing OneLogger commits. Restored opt-in registration and retained concrete checkpoint-load tracing, main's checkpoint configuration snapshots, and checkpoint scheduling/default behavior. Removed the obsolete legacy integration test-skip guard; all OneLogger tests execute on Lightning 2.6.6.
  • CUDA_VISIBLE_DEVICES='' OMP_NUM_THREADS=2 python -m pytest tests/lightning --cpu -q -m 'not pleasefixme' --timeout=180: 93 passed.
  • CUDA_VISIBLE_DEVICES='' OMP_NUM_THREADS=2 TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD=1 python -m pytest tests/core tests/core_ptl tests/lightning tests/utils/test_lightning_callback_defaults.py --cpu -q -m 'not pleasefixme' --timeout=180: 569 passed, 8 skipped, 2 deselected.
  • PYTHONPATH=/tmp/speech-onelogger-compat CUDA_VISIBLE_DEVICES='' python -m sphinx -b html -W --keep-going -E docs/source /tmp/nov9-onelogger-docs: passed.
  • uv lock --check --python /tmp/speech-lightning26-env/bin/python, Pylint 4.1.3 and flake8 with the speech/other configurations on all changed sources, full-branch pre-commit, and diff checks: passed.
  • All published branch commits have exact author/sign-off identity matches. No workflow changes or new dependencies were added by the resolution. GPU/distributed workloads were not rerun for this merge; prior probe results remain documented below. Skips cover existing device/download cases; existing marked tests remain excluded.

Earlier validation:

No public API removals or incompatible configuration changes.

Review follow-up validation

Correct callback ordering and completed-batch accounting around checkpoint and validation boundaries. Require both window boundaries to align before reporting per-step means. Use codec output sample rates, count valid multiturn text tokens, and support MPI rank/world-size metadata. Update the telemetry documentation.

  • CUDA_VISIBLE_DEVICES='' OMP_NUM_THREADS=2 python -m pytest tests/lightning/test_one_logger_windows.py tests/lightning/test_speech_throughput.py tests/lightning/test_one_logger_callback.py --cpu -q --timeout=120: 86 passed. Includes a real Trainer/checkpoint integration and deferred-event cases.

  • PYTHONPATH=/tmp/speech-onelogger-compat CUDA_VISIBLE_DEVICES='' python -m sphinx -b html -W --keep-going docs/source /tmp/onelogger-review-docs: passed without warnings.

  • Local merge-order qualification with Update training dependency compatibility #16504 and Lightning/PyTorch Lightning 2.6.6: CUDA_VISIBLE_DEVICES='' OMP_NUM_THREADS=2 python -m pytest tests/lightning/test_one_logger_windows.py tests/lightning/test_speech_throughput.py tests/lightning/test_one_logger_callback.py tests/core/test_exp_manager.py tests/collections/tts/data/test_audio_codec_dataset_lhotse.py tests/core/test_dependency_compatibility.py --cpu -q -m 'not pleasefixme' --timeout=180: 145 passed, 1 skipped, 1 deselected. In the temporary combined tree, callback registration and callback tests use this PR's versions to restore telemetry after Update training dependency compatibility #16504.

  • Standalone broader validation with legacy Lightning: 124 passed, 1 failed, 1 skipped, 1 deselected. The existing TestExpManager.test_last_checkpoint_saved direct-load failure was reproduced unchanged on the previous published head; Update training dependency compatibility #16504 supplies the configuration registration it needs. The combined qualification above passes that test. Update training dependency compatibility #16504 is now merged into main; the current integration validation below covers both implementations together.

  • Full collection suites were not run. SpeechLM2 GPU/distributed qualification is recorded below.

  • pre-commit run --from-ref origin/main --to-ref HEAD, git diff --check, and exact author/sign-off verification: passed.

The final follow-up also simplifies test imports for static analysis; the same 86-test focused command and complete-branch formatting/DCO checks pass after that cleanup.

CI follow-up: include tests/lightning in the existing CPU core test script so lifecycle and throughput regressions contribute to coverage. Workflow configuration and coverage thresholds are unchanged. CUDA_VISIBLE_DEVICES='' OMP_NUM_THREADS=2 TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD=1 python -m pytest tests/core tests/core_ptl tests/lightning --cpu -q -m 'not pleasefixme' --timeout=180: 446 passed, 9 skipped, 2 deselected. The OneLogger directory alone passes 86 tests. A local coverage run over those 86 tests covers 590/647 (91.19%) changed executable lines within the patch gate's included paths, compared with the reported CI result of 38.37%; the published CI measurement must confirm the result. The temporary local coverage configuration removed only the /tmp/* omission because the checkout is under /tmp; the repository coverage configuration was not changed. bash -n tests/functional_tests/L0_Unit_Tests_CPU_Core.sh, full-branch pre-commit, diff checks, and remote author/sign-off verification passed. No production behavior or user documentation changed.

SpeechLM2 GPU qualification (2026-11-05)

Checkpoint-load tracing is fixed in 7fcea46060. Six new regression checks fail on the previous head and pass after the fix; disabled-mode behavior stays unchanged.

  • 93 focused tests passed both locally and on the production container with Lightning 2.4.0 / PyTorch 2.11.0+cu129. The container's Lightning version was verified from the saved checkpoint metadata. Complete-branch pre-commit, diff checks, and exact published-author/DCO matching passed.
  • One node / 8 H100s, actual Nemotron Transcribe SALMAutomodel: 10 training steps, then 5 steps with a restored dataloader, all successful with finite losses. Full blend, batch_tokens=max_tokens=32768, four workers/rank, and optimized TE/GMM/DeepEP + MTP retained.
  • 80/80 input batches match the prior qualification; 40/40 restored input batches match the uninterrupted continuation, including all tensors and ordered conversation IDs.
  • Real AutomodelParallelStrategy DCP save/restore, eight ranks and a small FSDP2 model: saved model/optimizer at step 2, resumed through step 4. Exactly one completed nemo_speech.checkpoint_load span: 3600 ms. A real plain-Lightning checkpoint resume also emits exactly one completed load span: 1 ms. These checkpoint probes preserve existing checkpoint policies and use the real OneLogger SDK/FileExporter.
  • Only rank zero initializes the provider and exports. Model/data/optimizer initialization, training, validation, checkpoint save/load spans, and checkpoint-save-success events were observed. Every throughput counter, rate, and optimizer-step mean was independently checked against the batches; token/example totals are exact and audio duration differs only by float32 rounding.

Representative actual full-model throughput event (policy=salm, scope=rank, rank=0, global step 10):

Measurement Value
Window batches / optimizer steps 2 / 2
Window seconds 8.9572
Examples / examples per second 288 / 32.1529
Mean examples per optimizer step 144
Input audio seconds / audio seconds per second 3208.6868 / 358.2243
Input audio seconds per optimizer step 1604.3434
Multimodal tokens / tokens per second 65536 / 7316.5720
Multimodal tokens per optimizer step 32768

The ten-step rank-zero trace reports 327,680 multimodal tokens in five windows. Median steady step time was 4.31 s; these short checks are not a statistical overhead benchmark. Full 33B model/optimizer checkpoint resume, recognition quality, other speechlm2 architectures, and multi-node scaling were not qualified; the small distributed probe exercises the exact Automodel DCP loader, while production-model training and dataloader restoration were checked separately.

The first in-allocation unit-test invocation inherited the smoke reporting interval of two batches, causing three tests that assume default windows to fail. Rerunning with NEMO_ONE_LOGGER_THROUGHPUT_INTERVAL unset passed all 93 tests, without further production changes.

@copy-pr-bot

copy-pr-bot Bot commented Sep 14, 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 core Changes to NeMo Core label Sep 14, 2026
@github-actions github-actions Bot added the TTS label Sep 15, 2026
Comment thread nemo/core/classes/modelPT.py Dismissed
Comment thread nemo/core/classes/modelPT.py Dismissed
Comment thread nemo/core/classes/modelPT.py Resolved
@pzelasko
pzelasko force-pushed the codex/onelogger-speech-integration branch from 743652e to 5aed0ae Compare September 15, 2026 14:29
transcribe_with_whisper_from_filepaths,
)
from nemo.lightning.callback_group import CallbackGroup
from nemo.lightning.callback_group import with_callback_context

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do you know what these changes do?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It adds a PTL callback that collects metrics and events+timing to report to OneLogger on relevant events (model/dataloader/optimizer init, training step begin/end, etc). I agree these names are way too vague, will improve.

blisc
blisc previously approved these changes Sep 16, 2026

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The OneLogger integration has no eligible blockers in this follow-up. I recommend approval within the follow-up scope.

Compared with the latest reviewed head, the only change is adding tests/lightning to the CPU core test command. Production code, telemetry tests, dependencies, and documentation are unchanged. I traced the added test collection through the CI workflow, container dependencies, CPU settings, and coverage collection and found no qualifying introduced regression.

The previously verified fixes remain present: callback ordering and window accounting, codec sample rates and multiturn token counts, and MPI rank selection.

I inspected all changed files for coverage. Discovery remained limited to the follow-up changes, with new findings required to exceed the historical moderate-impact ceiling. I covered the collection-policy assignment directly because its delegated report wasn't available.

This was static source review. I didn't execute tests, build the container or documentation, measure coverage, run GPU/distributed workloads, or independently verify commit-author/sign-off matching.

Review generated by codex. This was a findings-only review. Request a full review with /review reset=true.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

[🤖]: Hi @pzelasko 👋,

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.

@pzelasko pzelasko removed the r3.1.0 Auto-cherrypick to release branch. Apply before merge; cherrypick happens after merge. label Nov 5, 2026
@pzelasko

pzelasko commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

/ok to test 7fcea46

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

[🤖]: Hi @pzelasko 👋,

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.

chtruong814
chtruong814 previously approved these changes Nov 6, 2026
@pzelasko

pzelasko commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator Author

/ok to test f30c7e8

@pzelasko

pzelasko commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator Author

/review

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This adds opt-in OneLogger lifecycle and modality-aware throughput telemetry. I found no eligible blockers and recommend approval within the follow-up scope.

I checked the changes since the latest reviewed head:

I inspected all 44 changed files for coverage and traced the directly affected contracts. Discovery remained limited to changes after the clean baseline review; new findings had to exceed the historical moderate-impact ceiling.

This was static source review. I didn't execute tests, build documentation or containers, run GPU/distributed workloads, or independently verify commit-author/sign-off matching. Reported validation results weren't reproduced.

Review generated by codex. This was a findings-only review. Request a full review with /review reset=true.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

[🤖]: Hi @pzelasko 👋,

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.

@pzelasko
pzelasko merged commit a039a6c into main Nov 13, 2026
166 checks passed
@pzelasko
pzelasko deleted the codex/onelogger-speech-integration branch November 13, 2026 15:11

This branch was previously deployed

2 inactive deployments
public — f30c7e8d Deployed Nov 9, 2026 by copy-pr-bot[bot] via release / finalize / publish-docs #1998
test — f30c7e8d Deployed Nov 9, 2026 by copy-pr-bot[bot] via cicd-wait-in-queue #21646
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ASR audio core Changes to NeMo Core TTS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants