notebooks icon indicating copy to clipboard operation
notebooks copied to clipboard

Refactor SegformerFinetuner to Use on_validation_epoch_end Hook

Open SRDdev opened this issue 1 year ago • 1 comments

Description

This PR refactors the SegformerFinetuner class to ensure compatibility with PyTorch Lightning v2.0.0 by replacing the deprecated validation_epoch_end method with the on_validation_epoch_end hook. This change addresses the issue of maintaining compatibility with the latest PyTorch Lightning API.

Motivation:

  • PyTorch Lightning v2.0.0 has deprecated the validation_epoch_end method, necessitating this update.
  • This update ensures that validation metrics are computed and logged correctly using the new on_validation_epoch_end hook.

Relevant Links:

Dependencies:

  • None

Type of change

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] This change requires a documentation update

How has this change been tested, please provide a testcase or example of how you tested the change?

  • Unit Testing: Ensured that all existing unit tests for the SegformerFinetuner class pass with the new implementation.
  • Integration Testing: Conducted end-to-end tests to verify that the validation metrics are correctly computed and logged at the end of each epoch.
  • Validation Outputs: Confirmed that validation outputs are properly cleared after each epoch to prevent data leakage.

Any specific deployment considerations

  • No specific deployment considerations are required for this change. The updates are backward-compatible and do not introduce breaking changes.

Docs

  • [ ] Docs updated? What were the changes:
    • No documentation updates were necessary as the changes are internal to the class implementation and do not affect the public API.

SRDdev avatar May 31 '24 06:05 SRDdev

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jul 12 '24 14:07 CLAassistant

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Updated to PytorchLightning v2, verified that training works. Removed the training output text, amounting to 41k lines. Pinned library versions.

LinasKo avatar Nov 27 '24 17:11 LinasKo

Hi @SRDdev 👋

A bit late, but thank you for the contribution! I did a minor cleanup, and it's ready to merge.

LinasKo avatar Nov 27 '24 17:11 LinasKo

Thanks!

SRDdev avatar Dec 23 '24 04:12 SRDdev