Add Hydra tab completion for train.py to help users write commands more quickly, rather than needing to constantly check the config yaml files to remember the parameter names (eg. I kept forgetting if it was num_envs or numEnvs)
^ Example gif showing what the tab completion looks like
How To Use
To set up, run:
eval "$(python train.py -sc install=bash)"
Then simply type python train.py and then the tab completion will work. You can start typing a parameter name (eg. python train.py num_) and press tab to either autocomplete or show possible completions.
Low-Level Details About Changes
Needed to move many train.py imports into the function because these imports caused prints to terminal that made the tab completion setup not work correctly
Needed to explicitly add version_base 1.1 to avoid warning messages that made the tab completion not work as nicely (https://hydra.cc/docs/upgrades/version_base/). This matches the behavior from before (not setting the version base makes it default to 1.1, so this is just more explicit)
Goal
Add Hydra tab completion for
train.py
to help users write commands more quickly, rather than needing to constantly check the config yaml files to remember the parameter names (eg. I kept forgetting if it wasnum_envs
ornumEnvs
)^ Example gif showing what the tab completion looks like
How To Use
To set up, run:
Then simply type
python train.py
and then the tab completion will work. You can start typing a parameter name (eg.python train.py num_
) and press tab to either autocomplete or show possible completions.Low-Level Details About Changes
train.py
imports into the function because these imports caused prints to terminal that made the tab completion setup not work correctly_self_
at the end of the default list in hydra to avoid warning messages that made the tab completion not work as nicely (https://hydra.cc/docs/upgrades/1.0_to_1.1/default_composition_order/). This matches the behavior from before.override
in config file to avoid warning (https://hydra.cc/docs/1.2/upgrades/1.0_to_1.1/defaults_list_override/)Relevant Screenshots from Hydra Documentation
_self_
last