Questions tagged [omegaconf]

Questions about OmegaConf

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

54 questions
1
vote
1 answer

Handling high number of configuration parameters in python

In my Machine Learning project I have a high number of parameters that are loaded from a configuration file, e.g. a YAML file. I wonder, is there any best practice on how to integrate them in the codebase other than a number of 'setup_by_cfg'…
Haydnspass
  • 67
  • 6
1
vote
1 answer

OmegaConf get interpolation node as string literal (eithout evaluating it)

With OmegaConf, is it possible to "turn off" node interpolation, so that when you access an interpolation node it just returns the literal string, i.e. "${resolver:value}" instead of evaluating the interpolation? I have a program that uses…
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

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…
1
vote
2 answers

Custom resolver to select a field from a DictConfig

nodes: node1: 1 node2: 2 node3: 3 selected_node: ${subfield:${nodes},node1} Can I make a subfield resolver that returns nodes["node1"] and stores it in selected_node? My attempts so far result in this…
Michael Litvin
  • 3,976
  • 1
  • 34
  • 40
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
1
vote
1 answer

read variables resolved with `oc.env` as integer in hydra

In my project, I'm setting an environment variables using python-dotenv. I then reference it in my YAML using the co.env OmegaConf resolver. # config.yaml var1: 42 var2: ${oc.env:PROJECT_NUMBER} # .env PROJECT_NUMBER=99 Once I run my script,…
miccio
  • 133
  • 1
  • 10
1
vote
1 answer

Hydra instantiation of tuple resolved from OmegaConf custom resolver fails for nested config files

OmegaConf allows you to register a custom resolver. Here is an example of resolving a tuple. def resolve_tuple(*args): return tuple(args) OmegaConf.register_new_resolver("tuple", resolve_tuple) This can be used to resolve a value in a config…
Grr
  • 15,553
  • 7
  • 65
  • 85
1
vote
3 answers

arithmetic manipulations in YAML configuration file with omegaconf

Currently, I have this configuration file which I'm using as an input to hydra/omegaconf db: range: - -10 - 10 Since the values in the range field are related by simple algebra, I'm looking for a way to encode this into the…
itamar kanter
  • 1,170
  • 3
  • 10
  • 25
1
vote
1 answer

Interpolation using the selected config group option in Hydra

I am using hydra composition with the following structure: ├── configs │   ├── config.yaml │   ├── data │   │   ├── dataset_01.yaml │   │   └── dataset_02.yaml │   └── model │   ├── bert.yaml │   └──…
Celso França
  • 653
  • 8
  • 31
1
vote
2 answers

How to escape the . when using dot notation commandline arguments

I want to pass in a config like: foo blah.bar: blah.bar another.thing: some.thing And I want to do this on the commmandline, osmething like: python my_script.py foo.blah.bar=blah.bar foo.another.thing=some.thing Obviously, this would give…
Hugh Perkins
  • 7,975
  • 7
  • 63
  • 71
0
votes
0 answers

Conditional composition in Hydra

I'm new to Hydra, so sorry for the nooby question. Update: Thanks, Omry Yadan for pointing out an example would be helpful. Indeed while putting it together I realize that I was not providing enough information. My question revolves around the use…
Mathew
  • 307
  • 1
  • 11
0
votes
1 answer

Encountering the issue in running the script!!! Issue: "omegaconf.errors.ConfigAttributeError: Key 'io' is not in struct"

By configuring the setup mentioned in (https://github.com/Sachini/niloc), i am facing issue in running the script (test/train). It gives me the following error File…
Omer
  • 1