Skip to content

fix(tts): restore Lightning-2.x on_validation_epoch_end signature in SSL models - #16217

Open
udsy19 wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
udsy19:fix/ssl-tts-on-validation-epoch-end-signature
Open

fix(tts): restore Lightning-2.x on_validation_epoch_end signature in SSL models#16217
udsy19 wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
udsy19:fix/ssl-tts-on-validation-epoch-end-signature

Conversation

@udsy19

@udsy19 udsy19 commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

What does this PR do ?

Fixes #16216. Restores the Lightning-2.x on_validation_epoch_end hook signature on
FastPitchModel_SSL and SSLDisentangler, which currently crash on the first validation
sanity check with TypeError: ... missing 1 required positional argument: 'outputs'.

Collection: tts

Changelog

  • fastpitch_ssl.py, ssl_tts.py: on_validation_epoch_end(self, outputs) -> on_validation_epoch_end(self),
    reading from self.validation_step_outputs (populated in validation_step, cleared at the end),
    matching the sibling FastPitchModel.on_validation_epoch_end pattern already used elsewhere in this file.
  • Added tests/collections/tts/models/test_ssl_models_validation_hook.py.

Negative control

The new test calls on_validation_epoch_end() with zero arguments, exactly how
lightning.pytorch.trainer.call._call_lightning_module_hook invokes it. Reverting only the two
production files (test unchanged) and re-running:

FAILED test_ssl_models_validation_hook.py::test_fastpitch_model_ssl_on_validation_epoch_end_accepts_no_arguments
FAILED test_ssl_models_validation_hook.py::test_ssl_disentangler_on_validation_epoch_end_accepts_no_arguments
2 failed in 16.57s

both fail with the exact TypeError above. With the fix restored, both pass.

git log -S'def on_validation_epoch_end(self, outputs)' shows one commit, #6433 (the PL 2.0
migration), which renamed the method in both files but is the same commit whose own message says
"Remove outputs arg from on_validation_epoch_end, on_test_epoch_end" for every other model it
touched -- an oversight on these two, not a decision.

Usage

No API change; validation runs instead of crashing.

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)

PR Type:

  • Bugfix

Additional Information

Signed-off-by: Udaya Tejas udayatejas2004@gmail.com

…SSL models

FastPitchModel_SSL and SSLDisentangler still define
on_validation_epoch_end(self, outputs), the pre-Lightning-2.0 signature.
The PL 2.0 migration (NVIDIA-NeMo#6433) intentionally removed the outputs
parameter everywhere else in this repo, renaming
validation_epoch_end(self, outputs) to on_validation_epoch_end(self)
and switching every other model to self.validation_step_outputs (e.g.
FastPitchModel.on_validation_epoch_end). It renamed these two methods
but left their outputs parameter in place.

Lightning's evaluation loop calls the hook with zero positional
arguments (_EvaluationLoop._on_evaluation_epoch_end ->
call._call_lightning_module_hook(trainer, "on_validation_epoch_end")),
so any real validation epoch on either model raises
"TypeError: ... on_validation_epoch_end() missing 1 required
positional argument: 'outputs'" before user code runs, aborting
training at the very first sanity-check validation pass -- reproduced
against a real lightning.pytorch.Trainer.fit() call. Both models ship
with a validation_ds and check_val_every_n_epoch configured in their
example configs (examples/tts/conf/fastpitch_ssl.yaml,
ssl_tts_22050.yaml), so this is on the default path, not a corner case.

Fixed by following the same self.validation_step_outputs pattern
already used by the sibling FastPitchModel: append each validation
batch's output in validation_step, read from
self.validation_step_outputs in on_validation_epoch_end, and clear it
afterward.

Added test_ssl_models_validation_hook.py, which calls
on_validation_epoch_end() the same way Lightning does (zero
arguments) and asserts it completes and logs the expected values.

Signed-off-by: Udaya Tejas <udayatejas2004@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Sep 5, 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 TTS label Sep 5, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FastPitchModel_SSL / SSLDisentangler crash on validation: on_validation_epoch_end() missing 1 required positional argument: 'outputs'

2 participants