notebooks
notebooks copied to clipboard
Refactor SegformerFinetuner to Use on_validation_epoch_end Hook
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_endmethod, necessitating this update. - This update ensures that validation metrics are computed and logged correctly using the new
on_validation_epoch_endhook.
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
SegformerFinetunerclass 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.
Check out this pull request on ![]()
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.
Hi @SRDdev 👋
A bit late, but thank you for the contribution! I did a minor cleanup, and it's ready to merge.
Thanks!