Questions tagged [omegaconf]

Questions about OmegaConf

OmegaConf is a flexible Python configuration library. Use this tag to ask questions about it.

54 questions
13
votes
2 answers

Convert hydra/omegaconf config to python nested dict/list?

I'd like to convert a OmegaConf/Hydra config to a nested dictionary/list. How can I do this?
Rylan Schaeffer
  • 1,945
  • 2
  • 28
  • 50
5
votes
1 answer

Hydra: access name of config file from code

I have a config tree such as: config.yaml model/ model_a.yaml model_b.yaml model_c.yaml Where config.yaml contains: # @package _global_ defaults: - _self_ - model: model_a.yaml some_var: 42 I would like to access the name of the model…
miccio
  • 133
  • 1
  • 10
4
votes
2 answers

How to do file over-rides in hydra?

I have a main config file, let's say config.yaml: num_layers: 4 embedding_size: 512 learning_rate: 0.2 max_steps: 200000 I'd like to be able to override this, on the command-line, with another file, like say big_model.yaml, which I'd use…
Hugh Perkins
  • 7,975
  • 7
  • 63
  • 71
3
votes
1 answer

Interpolation in Hydra's defaults list cause and error

This is the files directory: |-configs |----data_conf |--------csv_images.csv |--------tf_ds.csv |----example.yaml and example.yaml is: data: csv_images defaults: - data_conf: "${data}" and csv_images.yaml: # @package _group_ a: test_a b:…
Alex Goft
  • 360
  • 3
  • 12
3
votes
2 answers

Disable file output of hydra

I'm using hydra to log hyperparameters of experiments. @hydra.main(config_name="config", config_path="../conf") def evaluate_experiment(cfg: DictConfig) -> None: print(OmegaConf.to_yaml(cfg)) ... Sometimes I want to do a dry run to check…
kielnino
  • 160
  • 1
  • 7
3
votes
1 answer

OmegaConf can I influence how lists are merged

Is there any option to influence how lists are merged in OmegaConf. Ideally, this could be controlled in the config file, but if there is come switch I can use in the code I'm also interested. Example: from omegaconf import OmegaConf conf1 =…
Lesiak
  • 22,088
  • 2
  • 41
  • 65
2
votes
1 answer

Unsupported Interpolation Type using env variables in Hydra

What I'm trying to do: use environment variables in a Hydra config. I worked from the following links: OmegaConf: Environment variable interpolation and Hydra: Job Configuration. This is my config.yaml: hydra: job: env_copy: - EXPNAME #…
KSHMR
  • 741
  • 1
  • 9
  • 24
2
votes
0 answers

Hydra: disable permutation of few hyperparameters

I am trying to do a basic hyperparameter tuning. By default Hydra creates a permutation of each hyperparameter. hydra: mode: MULTIRUN sweeper: params: +n: 5,10,15 +a_lower: 0.5, 0.7, 0.9 Here it will run the same…
Wonder HD
  • 21
  • 2
2
votes
1 answer

How to dump a hydra config into yaml with `_target_` fields

I instantiate a hydra configuration from a python dataclass. For example from dataclasses import dataclass from typing import Any from hydra.utils import instantiate class Model(): def __init__(self, x=1): self.x = x @dataclass class…
Mike
  • 444
  • 1
  • 8
  • 19
2
votes
1 answer

Extend list in omegaconf from command line

I have a configuration similar to this from a yaml file training_variables: - var1 - var2 I want to extend the list using an additional variable, and I want to do it from the command line. How to do it? It seems not possible but I think it…
Ruggero Turra
  • 16,929
  • 16
  • 85
  • 141
2
votes
1 answer

fb-hydra: How to implement 2 nested structured configs?

I have 2 sub configs and one master(?) config that having those sub configs. I designed configs like below: from dataclasses import dataclass, field import hydra from hydra.core.config_store import ConfigStore from omegaconf import MISSING,…
user3595632
  • 5,380
  • 10
  • 55
  • 111
1
vote
2 answers

Default (nested) dataclass initialization in hydra when no arguments are provided

I have the following code, using the hydra framework # dummy_hydra.py from dataclasses import dataclass import hydra from hydra.core.config_store import ConfigStore from omegaconf import DictConfig, OmegaConf @dataclass class Foo: x: int =…
noamgot
  • 3,962
  • 4
  • 24
  • 44
1
vote
1 answer

How can I organize Hydra 1.3 configuration files and import them into each other?

I am trying to use Hydra 1.3 contrive a simple, but apparently not trivial, configuration that maps endpoints of a given API to their corresponding processing functions. So far, I came up with a config folder structure that looks like: $ tree…
Índio
  • 539
  • 5
  • 12
1
vote
0 answers

Is there a way to use Ray Tune in combination with ML Flow and Hydra in Python?

I want to do hyperparameter tuning for a neural net, created with keras. For this project I handle my config.yaml files with hydra, use mlflow to store the metrics and parameters from the optimization and use ray to parallelize the computation of…
Patrick
  • 11
  • 2
1
vote
1 answer

Conditional intializations of parameters in hydra

I'm pretty new to hydra and was wondering if the following thing is was possible: I have the parameter num_atom_feats in the model section which I would like to make dependent on the feat_type parameter in the data section. In particular, if I have…
James Arten
  • 523
  • 5
  • 16
1
2 3 4