Questions about Hydra, an open source Python framework by Facebook
Questions tagged [fb-hydra]
182 questions
1
vote
2 answers
Attribute Converter in attr.s-based hydra Structured Configs
Is it possible to use converters in attr.s-based hydra-structured configs.
I tried it with this minimal example:
import hydra
from hydra.core.config_store import ConfigStore
import attr
@attr.s
class Times10Config:
num: int =…

talz
- 1,004
- 9
- 22
1
vote
1 answer
Hydra access config filename from group
I want to access in my python code the name of the Hydra config file that I have choosen from the command line.
Let's consider this basic project architecture from the Hydra documentation:
├── conf
│ ├── config.yaml
│ ├── db
│ │ ├──…

Quentin BLAMPEY
- 138
- 8
1
vote
1 answer
How do I make Hydra's multirun sweeper test multiple repetitions of each condition?
Hydra enables sweeping combinations of parameters, for example:
python my_app.py --multirun db=mysql,postgresql schema=warehouse,support,school
will test six different conditions.
Is there a principled way of conducting multiple runs of each…

Trisoloriansunscreen
- 1,543
- 1
- 15
- 27
1
vote
1 answer
Store user attributes in Optuna Sweeper plugin for Hydra
How can I store additional information in an optuna trial when using it via the Hydra sweep plugin?
My use case is as follows:
I want to optimize a bunch of hyperparameters. I am storing all reproducibility information of all experiments (i.e.,…

Michel Kok
- 354
- 1
- 10
1
vote
1 answer
Hydra yaml files being interpreted in an unexpected manner (string interpolation)
Consider the following Hydra config file:
gap: "0_1"
target:
params : "/bestpars_${gap}.json"
It seems that when I use this as a command line override as in
python foo.py gap="2_5"
the variable target.params is set to /bestpars_25.json What…

Igor Rivin
- 4,632
- 2
- 23
- 35
1
vote
1 answer
How to reference other .yaml files of hydra conf folder?
My conf directory looks like:
conf
- hydra
- run
- dir
- job_timestamp.yaml
main.yaml
in main.yaml I am trying to overwrite the hydra output directory with a custom structure as defined in job_timestamp.yaml:
dir:…

Steven Zhang
- 11
- 3
1
vote
1 answer
Hydra combine lists in config
Say I have the following hydra config test.yaml:
list1 : [0]
list2 : [1,2,3]
is it possible to merge list1 and list2 into a new list that contains [0,1,2,3], perhaps using variable interpolation?
Here is the hydra code:
import hydra
from omegaconf…

BenedictWilkins
- 1,173
- 8
- 25
1
vote
1 answer
hydra - structured config group/package override via yaml
I'm not very successfully trying to figure out how to achieve an override of a group/package with and via a yaml file. Trying to explain my problem using the example (files and folder structre) from the hydra documentation…

Jana
- 11
- 2
1
vote
1 answer
Selecting multiple configs from a Config Group in Hydra without using an explicit nesting level inside each of the configs
The documentation in https://hydra.cc/docs/patterns/select_multiple_configs_from_config_group/ shows how to pick multiple configs from a Config Group and place them in a dictionary-like structure.
However, as mentioned in the very last paragraph…

miccio
- 133
- 1
- 10
1
vote
1 answer
override complete config for submodule with hydra
So, I have a hydra model config (autoencoder.yaml) defined as:
_target_: student.models.AutoEncoder
defaults:
- dataloader: msa
- encoder: default_encoder
- decoder: vae_decoder
- scheduler: null
- optimizer: adam
- preprocessing:…

Luca
- 10,458
- 24
- 107
- 234
1
vote
1 answer
Documentation of Hydra Config
Hydra provides a way to dynamically create a hierarchical configuration by composition and override it through config files and the command line, leveraging OmegaConf. I look for a recommended way to document the parameters but I could not find (a…

Lorenz Walthert
- 4,414
- 1
- 18
- 24
1
vote
1 answer
Using multiple configs in the same group to interpolate values in a yaml file
In Hydra I have the following configuration:
├── conf
│ ├── config.yaml
│ ├── callbacks
│ │ ├── callback_01.yaml
│ │ └── callback_02.yaml
│ └── trainer
│ ├── default.yaml
The callbacks have a…

SimoneMarretta
- 13
- 2
1
vote
1 answer
How to reload hydra config with enumerations
Is there a better way to reload a hydra config from an experiment with enumerations? Right now I reload it like so:
initialize_config_dir(config_dir=exp_dir, ".hydra"), job_name=config_name)
cfg = compose(config_name,…

jlcv
- 1,688
- 5
- 21
- 50
1
vote
1 answer
Is it possible to have a config key be the result of a variable interpolation in Hydra?
Assuming the following config structure:
config.yaml
|-model
| |--default.yaml
|
|-data
|--default.yaml
config.yaml :
defaults:
- model: default
- data: default
model/default.yaml :
...
x_label: some_label
...
The following doesn't…

colobas
- 11
- 1
1
vote
1 answer
use data types or other library-specific variables as arguments in hydra
I would like to use python datatypes - both built-in and imported from libraries such as numpy, tensorflow, etc - as arguments in my hydra configuration.
Something like:
# config.yaml
arg1: np.float32
arg2: tf.float16
I'm currently doing this…

miccio
- 133
- 1
- 10