-
Notifications
You must be signed in to change notification settings - Fork 50
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
Override inference parameters (model architecture, num bands, num classes) from checkpoint #298
Conversation
…handling for checkpoints from different gdl versions fixes NRCan#183
…handling for checkpoints from different gdl versions fixes NRCan#183
…to 183-inference-model-override # Conflicts: # inference_segmentation.py
# Conflicts: # config/model/smp_unet.yaml # inference_segmentation.py # models/model_choice.py # train_segmentation.py
GDL.py
Outdated
@@ -32,6 +36,11 @@ def run_gdl(cfg: DictConfig) -> None: | |||
""" | |||
cfg = OmegaConf.create(cfg) | |||
|
|||
# Couldn't find a better way to do this. Ideally a return_hydra_config could be set in @hydra.main decorator... |
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.
they are already in the yaml under general.config_name and general.config_path
|
||
if model_ckpt != params.model or classes_ckpt != classes or modalities_ckpt != modalities: | ||
logging.warning(f"\nParameters from checkpoint will override inputted parameters." | ||
f"\n\t\t\t Inputted | Overriden" |
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.
If a parameter read from the hydra config is overridden on the commandline, that will still be overridden by the checkpoint right ?
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.
yep!
…sses) from checkpoint (NRCan#298) * fixes NRCan#293 NRCan#246 add tests for optimizer instantiation in test_optimizers.py adapt our unet models (models/unet.py) to expect same parameter names as smp models * minor typo fixes * implement overriding model params from checkpoint with minimal error handling for checkpoints from different gdl versions fixes NRCan#183 * name model yamls as close as possible to upcoming naming convention * fix model name * implement overriding model params from checkpoint with minimal error handling for checkpoints from different gdl versions fixes NRCan#183 * small bugfix for pointing to parameters inside checkpoint * model_choice.py: add update checkpoint utility * fixes NRCan#293 NRCan#246 add tests for optimizer instantiation in test_optimizers.py adapt our unet models (models/unet.py) to expect same parameter names as smp models * minor typo fixes * name model yamls as close as possible to upcoming naming convention * small bugfix for pointing to parameters inside checkpoint * remove deeplabv3 dualhead warning and add link for deeplabv3_dualhead.py * fixes NRCan#293 NRCan#246 add tests for optimizer instantiation in test_optimizers.py adapt our unet models (models/unet.py) to expect same parameter names as smp models * name model yamls as close as possible to upcoming naming convention * minor typo fixes * update to PR 295 * GDL.py: restore to previous commit based on cauthier's comment
fixes #183
This feature will make it possible once again to launch an inference from 2 simple arguments:
path/url to image
path/url to model checkpoint