Trainer - #135
Closed
matschreiner wants to merge 37 commits into
Closed
Conversation
matschreiner
commented
Mar 7, 2025
| default=1, | ||
| help="Number of future time steps to use as input for forcing data", | ||
| ) | ||
| parser.add_argument( |
Author
There was a problem hiding this comment.
These arguments are actually not functional yet and serve as placeholders.
In reality the configurations needs to be dictionaries, eg
optimizer_config = {
"optimizer": "Adam",
"kwargs": {"lr": 0.01},
}
which I imagine should come from the NeuralLamConfig file
joeloskarsson
marked this pull request as draft
December 31, 2025 14:21
Collaborator
|
Trying to organize a bit among PRs, so marking this as a draft for now. If those involved want to pick this back up and review this to get it merged please switch it back to ready for review. |
Collaborator
|
Closing this one. Author noted the args were placeholders rather than functional, and there were no takers for picking up the Trainer factory design. The post-#208 architecture restructured training in a different direction. Thanks @matschreiner. |
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.
This PR introduces a new
Trainerclass that contains all aspects of configuring the training algorithm within the trainer object. The new trainer inherits frompl.Trainerand implements a factory for the configure_optimizers method, assigning this callback to the model when needed.Previously, if we wanted to change the batch size due to a new learning rate or optimizer, we had to modify the learning rate on the model object while changing the batch size on the trainer object. With this update, both adjustments are handled within the trainer, isolating the configuration of the training algorithm to the Trainer class.
At this point, scheduler and optimizer configuration is limited to:
python neural_lam.train_model.py --scheduler_config ExponentialLR --optimizer_config ...which will be using the default values for each class. The infrastructure for feeding configurations in a YAML file or similar is not implemented here in order to limit the scope of the PR.
But it would allow for configuring training like
Type of change
Checklist before requesting a review
pullwith--rebaseoption if possible).Checklist for reviewers
Each PR comes with its own improvements and flaws. The reviewer should check the following:
Author checklist after completed review
reflecting type of change (add section where missing):
Checklist for assignee