-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Learning Rate Scheduler to neurallamConfig #107
base: main
Are you sure you want to change the base?
Conversation
From a quick glance this is looking really great! Thanks for doing this @matschreiner! Since this is looking quite close to complete and is quite an isolated feature, do you want to propose this for the next release ( It looks like the linting is complaining right now. We use Maybe if you fit the linting issues and then I can give this a proper testing and review? |
…tached. Otherwise return the lr in the configuration
This is really nice to have! A couple of thoughts:
|
Thanks for having a look at my code :)
|
Also I can't pass the tests because of timeout errors. Maybe it could be fixed by merging in Leifs PR. |
Yea the way these things are handled in pytorch and lightning really is not optimal (from a software design standpoint). I'm not sure if I have any idea for a good solution. Just wanted to add that I don't think it is suitable to think of the config file as a model config, as the model architecture is mainly defined through command line arguments. I think of it more as a config of how the model should read and weight data at the moment, but maybe that is something that should actually change (what the config is for). |
Describe your changes
< Summary of the changes.>
I have added an optimization field to the
TrainingConfig
inneural_lam/config.py
. This field takes alr
,lr_scheduler
andlr_scheduler_kwargs
.The
lr_scheduler
is checked against available schedulers inpytorch
after the field is initialized. If the scheduler doesn't exist it will throw anInvalidConfigError
.The optimization config is added as a member to the
ARModel class
, so we can access it inconfigure_optimizers
.I think it would have been better to add the entire config, but maybe its a conscious choice that the config is not an attribute of the model.
I have included tests to check if the configuration instantiation fails with an invalid scheduler and a valid scheduler.
I also test if the learning rate is decreasing as expected on the optimizer when calling the learning_rate scheduler.
It is a breaking change because I have removed the
--lr
option in the arguments parser and moved it to the configuration file.If for example we wanted to add a
CosineAnnealingLR
withT_max 1000
andeta_min =
we would add the following to the config yaml.Also update some tests to use a fixture for model_args
< Please also include relevant motivation and context. >
I was tasked with exploring different schedulers and learning rates and thought it would be nice to log these things in the configuration files.
< List any dependencies that are required for this change. >
None
Issue Link
#97
Type of change
Checklist before requesting a review
pull
with--rebase
option 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