Dynamic update of pytorch config with dot notation by maximpavliv · Pull Request #2859 · DeepLabCut/DeepLabCut
Conversation
In this Pull Request, in order to facilitate the dynamic update of pytorch_config.yaml (when calling deeplabcut.train_network()), I:
- Implement the
update_config_by_dotpath()method. This method is easier to use than the previousupdate_config(). Withupdate_config(), you needed to pass a nested dictionary as argument to target nested arguments in the pytorch_config.yaml, and it wasn't explicit how the nested dict was processed. Withupdate_config_by_dotpath(), you target nested arguments by using a single-level dictionary with dot-notation path access. For example to update thegpuslist in therunnersection, you pass{"runner.gpus": [0,1]}(instead ofdict(runner=dict(gpus=[0,1]))) - Pass updates to the pytorch configuration with the
pytorch_cfg_updates: dictargument instead of using thekwargsintrain_network(). - Make explicit all the other arguments that can be passed to
train_network()(that were passed through thekwargsbefore) for more transparency, and remove thekwargsargument fromtrain_network(). - Implement a test for the new
update_config_by_dotpath()method, update integration tests.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one minor change needed - otherwise looks good to me!
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The examples/utils.py file also needs to be updated; currently both the testscript_pytorch_single_animal.py and the testscript_pytorch_multi_animal.py fail
The
examples/utils.pyfile also needs to be updated; currently both thetestscript_pytorch_single_animal.pyand thetestscript_pytorch_multi_animal.pyfail
You're right, now I solved this!
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
n-poulsen
deleted the
maxim/update_config_by_dotpath
branch
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