Getting started
#
IntroductionHydra is an open-source Python framework that simplifies the development of research and other complex applications. The key feature is the ability to dynamically create a hierarchical configuration by composition and override it through config files and the command line. The name Hydra comes from its ability to run multiple similar jobs - much like a Hydra with multiple heads.
#
Key features:- Hierarchical configuration composable from multiple sources
- Configuration can be specified or overridden from the command line
- Dynamic command line tab completion
- Run your application locally or launch it to run remotely
- Run multiple jobs with different arguments with a single command
#
VersionsHydra supports Linux, Mac and Windows.
Version | Docs | Release notes | Python Version | |
---|---|---|---|---|
1.0 (Stable) | Switch to 1.0 Docs | Release notes | 3.6+ | |
โบ | 0.11 | 0.11 Doc | Release notes | 2.7, 3.5+ |
#
Quick start guideThis guide will show you some of the most important features of Hydra. Read the tutorial to gain a deeper understanding.
#
InstallationInstall Hydra 0.11 with pip install hydra-core --upgrade
.
#
Basic exampleConfiguration file: config.yaml
Python file: my_app.py
You can learn more about OmegaConf here later.
config.yaml
is loaded automatically when you run your application
You can override values in the loaded config from the command line:
#
Composition exampleYou may want to alternate between two different databases. To support this create a config group
named db,
and place one config file for each alternative inside:
The directory structure of our application now looks like:
Here is the new config.yaml
defaults
is a special directive telling Hydra to use db/mysql.yaml when composing the configuration object.
The resulting cfg object is a composition of configs from defaults with configs specified in your config.yaml
.
You can now choose which database configuration to use from the and override values from the command line:
You can have as many config groups as you need.
#
MultirunYou can run your function multiple times with different configuration easily with the --multirun|-m
flag.
There is a whole lot more to Hydra. Read the tutorial to learn more.
#
Other stuff#
CommunityAsk questions in the chat or StackOverflow (Use the tag #fb-hydra):
Follow Hydra on Twitter and Facebook:
#
Citing HydraIf you use Hydra in your research please use the following BibTeX entry: