armory
armory copied to clipboard
Referenced Parameters for Configs?
Often a single parameter needs be reused in multiple places; this requires modifying it consistently across a config file.
Is there a principled way of having a "@param(targeted)"
sort of field in the JSON that is replaced with values from some _params: {targeted = True, ...}
dict in the JSON?
This is the sort of hierarchical configuration that hydra (hydra-zen) affords. A simple use is shown at https://hydra.cc/docs/tutorials/basic/your_first_app/config_groups/ where the command line
python my_app.py +db=postgresql
creates a top-level db
member the body of which is filled in by reference from postegresql.yaml
yielding
db:
driver: postgresql
pass: drowssap
timeout: 10
user: postgres_user
Mapping to your request would be something like
$ cat targeted.yaml
_params:
targeted: true
thingy: art.thingy.method
with
armory run experiments/carla_mot.yaml +attack.foo=targeted +defense.foo=targeted
with similar sub-configurations in untargeted.yaml
What I am trying to prevent is the +attack.foo=targeted +defense.foo=targeted
sort of thing. I would rather be able to do
armory run experiments/carla_mot.yaml +targeted=false
This comes up, for instance, in what format data annotations are. (E.g., COCO format vs MOT format). This format type needs to be propagated to the dataset, metrics, model, and (sometimes) attack.
OmegaConf (which is what Hydra uses under the hood for configuration) accomplishes this via variable interpolation: https://omegaconf.readthedocs.io/en/2.2_branch/usage.html#variable-interpolation