armory icon indicating copy to clipboard operation
armory copied to clipboard

use Hydra and Hydra-zen for configuration management and loading

Open davidslater opened this issue 2 years ago • 3 comments

https://hydra.cc/

Hydra-zen adds python things to it (pure python) https://github.com/mit-ll-responsible-ai/hydra-zen

davidslater avatar Sep 22 '22 20:09 davidslater

I think it could really simplify a lot of our command line, config parsing, python object loading, and config verification.

davidslater avatar Sep 22 '22 20:09 davidslater

Hydra-zen does offer some things that we have wanted for Armory.

It allows hierarchical dataclass-like initializing from declared defaults: an Experiment (config.json) can be composed of a Dataset, Attack, etc. You can also "subclass" with configuration overrides, for example, a carla_obj_det_dpatch_defended can be described as a carla_obj_det_dpatch_undefended plus a specific Defense override to what is null in the base case. Similarly, a performer could define a new Experiment as taking a dpatch_undefended base configuration and overriding just the parameters relevant to their defense.

Hydra-zen also creates detailed, datetime separated logs of how it was invoked and where parameter variants came from. This could naturally output to .armory/output_dir enriching the data output.json we currently put there.

The documentation is complete, but the learning curve is longer than I'd like because there seems to be a confusing amount of library specific boilerplate. If we use this though, it will be mostly set-and-forget, it seems.

mwartell avatar Oct 24 '22 16:10 mwartell

Related to #1698

mwartell avatar Oct 24 '22 16:10 mwartell