Open
Conversation
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.
Disclaimer
Description
Note
tldr:
Adds unit tests for the
loggerfield onTrainingConfigandNGTrainingConfig, and also tests for TensorBoard and WandB logger initialisation inCAREamistV2.Background - why do we need this PR?
WandB and TensorBoard logging in CAREamics currently lacks tests. The existing
tests/utils/test_wandb.pywas outdated and commented out, having not been updated for the Lightning-based API. As a result, there's no verification for the logging.Overview - what changed?
loggeron bothTrainingConfig(old CAREamist) andNGTrainingConfig(CAREamistV2).2.New tests added to the existing
tests/test_careamist_v2_train.py, checking that each logger backend is correctly set up through to the Lightning Trainer and that training completes successfully with each.I also added
interoperabilitypytest mark in the pyproject.toml.Implementation - how did you implement the changes?
For
tests/config/test_training_config.py: Pydantic'sLiteral["wandb", "tensorboard"] | Noneenforces valid values at assignment time; tests exercise this directly via ValidationError assertionsFor
tests/test_careamist_v2_train.py:careamist.trainer.loggersWANDB_MODE=disabledso the test runs without a WandB account, making it safe to run in any environmentWANDB_API_KEYis not set; when credentials are present, it verifies that metrics are actually logged to a real WandB run, using a dedicated test projectChanges Made
New features or files
tests/config/test_training_config.py: 19 tests for the logger field on TrainingConfig and NGTrainingConfigModified features or files
tests/test_careamist_v2_train.py: 4 tests for TensorBoard and WandB logger initialisation and trainingpyproject.toml: interoperability mark added to[tool.pytest.ini_options]Removed features or files
tests/utils/test_wandb.pyHow has this been tested?
All tests ran locally and passed.
Related Issues
Closes #537
Breaking changes
None
Additional Notes and Examples
Please ensure your PR meets the following requirements: