Skip to content

Update training dependency compatibility - #16504

Merged
pzelasko merged 10 commits into
mainfrom
codex/update-training-dependency-compatibility
Nov 9, 2026
Merged

pzelasko merged 10 commits into
mainfrom
codex/update-training-dependency-compatibility

Conversation

@pzelasko

@pzelasko pzelasko commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Stack and merge order: #16504 → #16410. This PR targets main; #16410 targets this branch and adds only EMA tests and documentation.

What does this PR do ?

Update Hydra and Lightning compatibility while preserving checkpoint resume and model round trips across the supported speech collections.

Collection: Core, ASR, TTS, Audio, SpeechLM2.

Changelog

  • Require Hydra >=1.3.8,<1.4, OmegaConf >=2.3,<2.4, and Lightning/PyTorch Lightning >=2.6.6,<2.7; retain locked Hydra 1.3.8 and both Lightning distributions at 2.6.6.
  • Include the new Trainer configuration options using upstream defaults.
  • Preserve the previous TQDM/plain-summary defaults through NeMo's Lightning integration for direct Trainer construction in both namespaces. Explicit callbacks, Rich selections, disable flags, barebones mode and upstream validation remain supported.
  • Refresh save_last=True checkpoints at eligible validation/epoch boundaries when the monitored metric plateaus. Update async scheduling state immediately while retaining completion markers and notifications until finalization.
  • Forward the loader policy through SpeechLM2 strategy, S3 I/O, and resume-connector overrides. Remove the unused distributed checkpoint backend and its obsolete compatibility test; retain the shared async checkpoint interface.
  • Normalize configuration metadata only in the checkpoint save hook, preserving live cfg/hparams schemas and supported enum/path values. Keep source-defined legacy decoding/adapter schemas and path values loadable, and cover application-defined schemas without registering their types for new checkpoints.
  • Restore EMA optimizer state only for fit, with scoped configuration loading. Evaluation no longer requires an EMA sidecar.
  • Reject unsupported Neptune logging during configuration validation, update affected logger/checkpoint documentation.
  • Temporarily detach default OneLogger registration while retaining custom callback registration and dispatch.

Usage

Use the existing installation and training interfaces. Automatic OneLogger registration remains disabled here; its restoration is handled separately in #16255. Keep create_neptune_logger: false and use another supported logger.

Older checkpoints containing application-defined structured schemas can use explicit source-schema registration as documented in the Experiment Manager guide. New checkpoints store configuration values without those schema types.

GitHub Actions CI

This PR targets main independently of #16255 and is intended to merge first. CI and review are requested for the current published head.

Before your PR is "Ready for review"

Pre checks:

  • Followed contributor guidelines and verified every published author's matching DCO sign-off.
  • Added regression tests and reproduced compatibility failures before the fixes.
  • Updated affected checkpoint/logging documentation and API docstrings.
  • Reviewed optional dependencies; S3 coverage skips when its SDK is unavailable.

PR Type:

  • Bugfix

Additional Information

Validation with Python 3.13, Hydra 1.3.8, and Lightning/PyTorch Lightning 2.6.6:

  • CUDA_VISIBLE_DEVICES='' OMP_NUM_THREADS=2 python -m pytest tests/core tests/utils/test_lightning_callback_defaults.py tests/utils/test_trainer_utils.py tests/collections/speechlm2/test_parallel.py tests/collections/common/test_ema.py --cpu -q -m 'not pleasefixme' --timeout=180: 449 passed, 21 skipped, 2 deselected.
  • CUDA_VISIBLE_DEVICES='' OMP_NUM_THREADS=2 NEMO_CACHE_DIR=/tmp/nemo-checkpoint-compat python -m pytest tests/core/test_save_restore.py::TestSaveRestore::test_EncDecCTCModelBPE_v2 --cpu --with_downloads -q --timeout=180: 1 passed, exercising a released ASR checkpoint round trip. One attempt ran out of local disk space; the retry passed after removing obsolete generated HTML.
  • PYTHONPATH=/tmp/speech-dependency-compat CUDA_VISIBLE_DEVICES='' python -m sphinx -b html -W --keep-going docs/source /tmp/lightning-review-docs: passed without warnings.
  • Compared Trainer constructor defaults in Lightning 2.4.0 and 2.6.6: all pre-existing defaults match. The two new fields default to no registry and enabled hparams logging, preserving the prior effective behavior.
  • Independent CPU mid-epoch resume probes on 2.4.0 and 2.6.6, with gradient accumulation 1 and 2, matched exactly for sample order, step counters, LR schedule, validation cadence and final weights. Reference traces are captured in the resume regression tests. The default non-stateful dataloader restarts its iterator in both versions.
  • CI-configured Pylint 4.1.3 and flake8 passed on all changed sources in both domains: uv run --isolated --no-project --with pylint==4.1.3 pylint --rcfile .pylintrc.<domain> <changed-files> and flake8 --config .flake8.<domain> <changed-files>.
  • Follow-up checkpoint regression tests: python -m pytest tests/core/test_lightning_checkpoint_compatibility.py --cpu -q -m 'not pleasefixme' --timeout=180: 22 passed. Both compatibility hooks include brief comments identifying the Lightning 2.6.0 change. No documentation update is needed for removing an unused backend with no documented Speech workflow.
  • uv lock --check --python python, pre-commit run --from-ref origin/main --to-ref HEAD, git diff --check, and published author/sign-off verification: passed.

Coverage includes real Trainer save hooks, AED/adapter model constructors and round trips, live configuration schema preservation, enum/path values, both Lightning namespaces, callback selection with Rich installed, explicit callbacks and disable/barebones flags, synchronous and deferred checkpoint scheduling, resume connectors, and loader-policy forwarding. The callback shim is installed once through NeMo's existing Lightning integration so direct Trainer construction and configuration-helper paths agree.

GPU/distributed runs and live S3 transfers were not run. Deferred I/O, S3 downloads and sharded backend operations use test doubles. Skips include device-, download- and optional-dependency cases; existing marked tests remain excluded. Neptune remains unsupported upstream, OneLogger remains temporarily detached as described above, and explicit restricted-load requests are not silently relaxed.

CI follow-up: make the draft device fallback regression compare against the target device rather than assuming CPU. Cover CPU and meta device moves locally. CUDA_VISIBLE_DEVICES='' OMP_NUM_THREADS=2 PYTHONPATH=/tmp/nov5-pinned-automodel python -m pytest tests/collections/speechlm2/test_salm_dflash.py --cpu -q -m 'not pleasefixme' --timeout=180: 91 passed, 4 skipped, using Automodel revision 309a10098e3ea3d9b79d4b96fa397db40908b751 pinned by CI. The old assertion fails for the meta-device regression. An initial full-file run against an older local Automodel checkout had five API-mismatch failures; rerunning with the pinned revision passed. Branch-wide pre-commit and diff checks passed. No production behavior or documentation changed.

Review follow-up: make the summary callback return explicit and replace the unused initialization import with the helper exercised by the idempotence test. This PR owns the shared serialization and EMA implementation. #16410 is stacked directly on this branch and contains only its unique EMA tests and documentation; the duplicate implementation has been removed from the child diff.

  • CUDA_VISIBLE_DEVICES='' OMP_NUM_THREADS=2 python -m pytest tests/utils/test_lightning_callback_defaults.py tests/core/test_lightning_checkpoint_compatibility.py tests/core/test_dependency_compatibility.py --cpu -q -m 'not pleasefixme' --timeout=180: 70 passed on Lightning 2.6.6.
  • A temporary checkout combining both heads passes 90 tests, 14 skipped, using the same command plus tests/collections/common/test_ema_checkpoint_security.py tests/collections/common/test_ema.py. This includes multitask SGD/Adam companion resume and rejection coverage.
  • Both git merge-tree and an actual no-commit merge completed cleanly; the integrated source has exactly one registration call per CTC/RNNT/multitask module.
  • Pylint 4.1.3, flake8, full-branch pre-commit and diff checks passed. No additional user-facing behavior or documentation changed in this follow-up. GPU/distributed validation remains with CI.

@pzelasko
pzelasko requested a review from a team as a code owner November 2, 2026 19:11
@copy-pr-bot

copy-pr-bot Bot commented Nov 2, 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.

@pzelasko

pzelasko commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

/ok to test b61f739

@pzelasko

pzelasko commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

/review

@github-actions github-actions Bot added the core Changes to NeMo Core label Nov 2, 2026
@pzelasko
pzelasko force-pushed the codex/update-training-dependency-compatibility branch from b61f739 to ebb666e Compare November 2, 2026 19:20
@pzelasko
pzelasko changed the base branch from main to codex/onelogger-speech-integration November 2, 2026 19:20
@pzelasko

pzelasko commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

/ok to test ebb666e

@pzelasko

pzelasko commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

/review

@pzelasko
pzelasko changed the base branch from codex/onelogger-speech-integration to main November 2, 2026 19:30
@pzelasko
pzelasko force-pushed the codex/update-training-dependency-compatibility branch from ebb666e to f61055c Compare November 2, 2026 19:30
@pzelasko

pzelasko commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

/ok to test f61055c

@pzelasko

pzelasko commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

/review

@pzelasko
pzelasko requested a review from chtruong814 November 3, 2026 15:24

@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 compatibility update is ready within this follow-up review’s scope. I found no unresolved prior finding or newly introduced regression eligible above the historical moderate-impact ceiling.

Since the previous reviewed head, the changes remove the distributed checkpoint backend and its dedicated test while retaining the shared async interfaces. The inspected Experiment Manager and SpeechLM2 paths don’t depend on the removed class. The checkpoint hook edits add comments only. The retained plateau regression still checks synchronous and deferred saves at validation and epoch boundaries, latest versus best checkpoint steps, and scheduling state after finalization. That remains appropriate focused coverage.

The earlier structured-CTC fix remains intact, including the regression that saves the live structured default before normalization. The affected documentation is unchanged and remains consistent with the inspected paths.

I inspected all 27 changed files across three review topics and compared relevant source with the previous reviewed tree. Previously reviewed, unchanged code remained context rather than fresh discovery. This was static review: I didn’t execute tests or independently verify the reported validation. GPU/distributed execution, actual Megatron behavior, and live S3 transfers remain unverified. Sign-off trailers are present, but commit-author identities weren’t supplied for exact DCO comparison.

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

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

pzelasko commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

/ok to test 3ac3ca0

@pzelasko

pzelasko commented Nov 5, 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.

The compatibility update is ready within this follow-up review’s scope. I found no unresolved prior finding or newly introduced regression eligible above the historical moderate-impact ceiling.

Since the previous reviewed head, the only change is the draft-device regression test. It now covers CPU and meta devices, explicitly moves the enclosing module, and compares its device with the target parameters instead of assuming CPU. I traced it through the constructor and device fallback. The test retains the unset-draft assertion, and the meta case distinguishes the fallback from a hardcoded CPU result. This is appropriate focused coverage for a test-only correction; no documentation change is needed.

The other 27 changed files match the previous reviewed tree. The earlier structured-CTC fix remains intact, including the regression that saves the live structured default before normalization.

I inspected all 28 changed files across three review topics. One delegated report wasn’t returned, so I covered its assigned configuration paths directly. Previously reviewed, unchanged code remained context rather than fresh discovery. This was static review: I didn’t execute tests or independently verify the reported Automodel validation. GPU/distributed execution and live S3 transfers remain unverified. Sign-off trailers are present, but commit-author identities weren’t supplied for exact DCO comparison.

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 mentioned this pull request Nov 6, 2026
6 tasks done
@pzelasko

pzelasko commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

/ok to test 86bb59f

@pzelasko

pzelasko commented Nov 6, 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.

The Hydra/Lightning compatibility update is ready within this follow-up review’s scope. I found no unresolved prior finding or newly introduced regression eligible above the historical moderate-impact ceiling.

Since the previous reviewed head, only two files changed. The summary callback now returns None explicitly, which preserves the previous return value and callback selection. The test imports the helper directly; importing that submodule still initializes nemo.utils and installs the callback adapter. The idempotence assertion and both-namespace callback cases remain intact. Existing tests provide appropriate coverage for this behavior-preserving cleanup, and it needs no documentation change.

The earlier structured-CTC fix remains intact: schema registration follows the definitions, and the regression saves the live structured default before normalization, then checks restricted loading, configuration values, and restored tensors.

I inspected all 28 changed files across three review topics. Whole-file digest comparisons confirm that the other 26 files match the previous reviewed tree. Previously reviewed code remained preservation context rather than fresh discovery. This was static review: I didn’t execute tests, reproduce the combined-PR merge checks, or independently verify the reported validation. GPU/distributed behavior and live S3 transfers remain unverified. Sign-off trailers are present, but commit-author identities weren’t supplied for exact DCO comparison.

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

This branch was previously deployed

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

Labels

ASR common core Changes to NeMo Core r3.1.0 Auto-cherrypick to release branch. Apply before merge; cherrypick happens after merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants