This page describes some common concepts in Hydra, most of which are covered in greater details throughout the documentation. Examples of many of the following concepts are in the Examples section.
Config files are form of input configs in YAML format. They can exist in the file system or in a Python module.
name: James Bond
This term has two common meanings:
- A class decorated with @dataclass or @attr.s, or an instance of such a class which is intended to be used as config.
- A Config object initialized from a class or object as defined in 1. Structured Configs provide additional type information that enables static and runtime type checking.
The two primary patterns for using Structured Configs are:
- As an Input Config.
- As a schema validating Config Files and command line arguments.
Overrides can be used in the command line and in the Compose API.
In the examples below,
key=value is an override:
$ python my_app.py key=value
cfg = compose(config_name,
A list in an Input Config that instructs Hydra how compose the config.
- db: mysql # An overridable defaults list entry
- schema/school # A non-overridable defaults list entry
A Config Group is directory in the Config Search Path that contains Input Configs. Config Groups can be nested, and in that case the path elements are separated by a forward slash ('/') regardless of the operating system.
Config Group Option
An Input Config in a Config Group. When used in a Defaults List, a Config Group Option can be a single Input Config, or a list of Input Configs from the same Config Group.
A Package is the path to node in a config. By default, the Package of a Config Group Option is derived from the Config Group. e.g: Configs in mi6/agent will have the package mi6.agent by default.
Example of Core Concepts
- mi6/agent: james_bond
# @package bond.james
- Input Configs: config.yaml, mi6/agent/james_bond.yaml
- Config Group: mi6/agent
- Config Group Option: james_bond
- Packages: <empty>, mi6, mi6.agent, mi6.agent.codename
- Package directive: # @package bond.james, overriding the default Package for the containing Input Config
Config Search Path
Plugins extend Hydra's capabilities. Hydra has several plugin types, for examples Launcher and Sweeper.