Add train metrics in Lightning Pipeline output#16
Merged
JeremieGince merged 1 commit intodevfrom Feb 9, 2026
Merged
Conversation
Introduce run_train_validation to validate on the training dataloader (tries ckpt_path='best' then falls back to 'last'), measure train_validation_time, prefix returned metrics with 'train_', and save them to the checkpoint folder. Update run() to call run_train_validation, record overall training_time, save train metrics, then run and merge validation metrics. Also ensure run_validation saves validation metrics. Update tests to assert presence of train/val/test metrics accordingly.
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request updates the training and validation metrics handling in the
lightning_pipeline.pypipeline, ensuring both train and validation metrics are saved and returned, and adds corresponding test assertions. The changes improve clarity and completeness of reported metrics after running the pipeline.Pipeline metrics handling improvements:
runmethod inlightning_pipeline.pyto separately compute and save both train and validation metrics, and return a merged dictionary containing both sets of metrics.run_train_validationmethod to evaluate metrics on the training set, save them, and ensure metric keys are renamed fromval_totrain_for clarity.run_validationmethod to save validation metrics to the checkpoint folder after computation.Testing improvements:
test_run_and_run_testtest to assert that the output ofrun()includes bothval_lossandtrain_loss, and thattest_lossis only present after callingrun_test().Checklist
Please complete the following checklist when submitting a PR. The PR will not be reviewed until all items are checked.
Make sure that the tests passed and the coverage is
sufficient by running
pytest tests --cov=src --cov-report=term-missing.You can do this by running
black src tests.You can do this by running
isort src tests.You can do this by running
mypy src tests.