-
Notifications
You must be signed in to change notification settings - Fork 308
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
Refactor train.py #1237
Refactor train.py #1237
Conversation
a18c87a
to
9b2138c
Compare
We talked about this in the meeting today, but we're probably going to try to combine pretrain/train/evaluate/predict into a single main.py that can handle all of the above, and store things like datamodule and trainer classes in the YAML config file. |
Actually, we could name it |
I guess we can get rid of evaluate now that we have testing in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like our existing code, there are a ton of discrepancies as to whether we should call a LightningModule a module, model, task, or trainer. I won't comment on those since we never came to a conclusion on #996.
Config files look amazing! Now just need to decide how closely we can align our training script to LightningCLI.
I think everything looks good to me. Just want to further minimize the hydra version to the lowest version that gets our tests to pass. |
Pausing a bit to think here. Just so I understand correctly -- the reason we're bringing in hydra as a dependency is for Expanding a bit, this just turns each yaml config file into a piece of code that does:
which then get used in Note: if so, I'm okay with this (I'm a fan of https://github.com/ashleve/lightning-hydra-template), but this just seems like a good place to think about what we're doing here. |
Correct. This also lets users create their own datamodule and/or trainer and use it with |
Okay cool! I don't see why |
It relates to #228, just provides an easy way for people to |
Just to mention, Pytorch Lightning CLI is possibly solving the same thing. python main.py fit --config /config.yaml
--model MyModel
--data MyGeoDataModule
--any_class_param_to_override where fit can be replaced with |
Yep, I'm planning on integrating this and adding a torchgeo command in the next release. |
This PR refactors
train.py
to usehydra.utils.instantiate
to define the trainer and datamodule inside the config file without having to do any config file magic. This allows a user to define a config like below: