Skip to content

Conversation

@maximpavliv
Copy link
Contributor

@maximpavliv maximpavliv commented Feb 3, 2025

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 previous update_config(). With update_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. With update_config_by_dotpath(), you target nested arguments by using a single-level dictionary with dot-notation path access. For example to update the gpus list in the runner section, you pass {"runner.gpus": [0,1]} (instead of dict(runner=dict(gpus=[0,1])))
  • Pass updates to the pytorch configuration with the pytorch_cfg_updates: dict argument instead of using the kwargs in train_network().
  • Make explicit all the other arguments that can be passed to train_network() (that were passed through the kwargs before) for more transparency, and remove the kwargs argument from train_network().
  • Implement a test for the new update_config_by_dotpath() method, update integration tests.

Copy link
Contributor

@n-poulsen n-poulsen left a comment

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!

@maximpavliv maximpavliv force-pushed the maxim/update_config_by_dotpath branch from d05dff7 to 7ef9964 Compare February 4, 2025 09:43
@maximpavliv maximpavliv requested a review from n-poulsen February 4, 2025 09:43
Copy link
Contributor

@n-poulsen n-poulsen left a comment

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

@maximpavliv maximpavliv force-pushed the maxim/update_config_by_dotpath branch from 7ef9964 to b0229af Compare February 4, 2025 13:13
@maximpavliv maximpavliv requested a review from n-poulsen February 4, 2025 13:14
@maximpavliv
Copy link
Contributor Author

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

You're right, now I solved this!

Copy link
Contributor

@n-poulsen n-poulsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thanks @maximpavliv!

@n-poulsen n-poulsen merged commit 45d4d3d into pytorch_dlc Feb 5, 2025
1 check passed
@n-poulsen n-poulsen deleted the maxim/update_config_by_dotpath branch February 5, 2025 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants