Skip to content

Fix ProgressPrinter test phase counter and add regression test#15181

Open
gmartini2019 wants to merge 1 commit intoNVIDIA-NeMo:mainfrom
gmartini2019:fix-progress-printer-test-steps
Open

Fix ProgressPrinter test phase counter and add regression test#15181
gmartini2019 wants to merge 1 commit intoNVIDIA-NeMo:mainfrom
gmartini2019:fix-progress-printer-test-steps

Conversation

@gmartini2019
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 ?

Fixes a bug in the ProgressPrinter callback where validation-specific state was incorrectly referenced during the test phase, causing trainer.test() to crash when no validation loop had run.

Collection: Lightning / PyTorch callbacks

Changelog

  • Fix incorrect usage of self.total_validation_steps during the test phase.
  • Replace validation-specific counter with self.total_test_steps in on_test_batch_end.
  • Add a CPU-only regression test to ensure trainer.test() does not crash when using ProgressPrinter.
  • Mock Megatron microbatch logic in the test to avoid reliance on Megatron runtime initialization.

Usage

No changes are required from the user side. The fix is internal and ensures that the ProgressPrinter callback works correctly during trainer.test().

from nemo.lightning.pytorch.callbacks import ProgressPrinter
from lightning.pytorch import Trainer

trainer = Trainer(
    callbacks=[ProgressPrinter()],
)

trainer.test(model)

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:

  • 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?

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)

Signed-off-by: gmartini2019 <gmartini2019@my.fit.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant