Questions tagged [fb-hydra]

Questions about Hydra, an open source Python framework by Facebook

182 questions
4
votes
1 answer

MLFlow and Hydra causing crash when used together

I'm trying to utilize Hydra with MLFlow, so I wrote the bare minimum script to see if they worked together (importing etc.). Both work fine on their own, but when put together I get a weird outcome. I have the script below: import hydra from…
Ilknur Mustafa
  • 301
  • 2
  • 11
3
votes
2 answers

Hydra: How to express None in config files?

I have a very simple Python script: import hydra from omegaconf import DictConfig, OmegaConf @hydra.main(version_base="1.3", config_path=".", config_name="config") def main(cfg: DictConfig) -> None: if cfg.benchmarking.seed_number is None: …
Hermi
  • 350
  • 2
  • 5
  • 16
3
votes
1 answer

Hydra install on python 3.10 fails due to VS build tools

I'm trying to install Hydra 2.5 on a Windows 10 system. I have Visual Studio Build Tools 2022 installed with the desktop C++ development option. When I use pip I get the error attached below. I've tried it with both python 3.10 and 3.9. I've tried a…
3
votes
1 answer

command line args with `hydra`

The standard mantra to pass a configuration to hydra is to decorate with @hydra.main then to define your main(cfg), and then in the main block call main with no arguments. But suppose I want to also accept non-hydra command line args, so want to…
Igor Rivin
  • 4,632
  • 2
  • 23
  • 35
3
votes
1 answer

Hydra: Referring to a config group option in the parent directory

I can't find a way to load config group options from parent directories in hydra. E.g. here I want to load the config group option from datamodule/wikipedia1m.yaml from variant/default.yaml but it does not give what I expected. Here are my hydra…
Louis M
  • 4,036
  • 4
  • 21
  • 25
3
votes
1 answer

Referring to Hydra's `conf` directory from a Python sub/sub-sub-directory module

Suppose that we have a Python project with this structure: hydra_config ├── conf │ ├── api_key │ │ ├── non_prod.yaml │ │ └── prod.yaml │ └── db │ ├── mysql.yaml │ └── postgresql.yaml ├── modules │ └── module.py └──…
blue2609
  • 841
  • 2
  • 10
  • 25
3
votes
1 answer

Using Typer and Hydra together

I have a simple Typer application: import typer app = typer.Typer() @app.command() def say_hi(): print("Hi") @app.callback() def main(): pass if __name__ == "__main__": app() I would like to use Hydra for the configuration…
Gabio
  • 9,126
  • 3
  • 12
  • 32
3
votes
2 answers

How to pass dictionary elements from hydra config file

I am trying to instantiate objects with hydra, I have a class torchio.transforms.RemapLabels that I am using in my config file: _target_: torchio.transforms.RemapLabels The problem is that torchio.transforms.RemapLabels takes dictionary elements as…
pete2213
  • 69
  • 2
  • 7
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
3 answers

How to gather config files in a list with Hydra-fb?

Say I have an abstract class db in my code and classes db1, db1, ... db1 that inherit from db. My project uses hydra and has this structure: ├── my_app.py ├── conf.yaml └── db ├── db1.yaml ├── db2.yaml └── db3.yaml I need a list of db…
dallonsi
  • 1,299
  • 1
  • 8
  • 29
3
votes
1 answer

How to pass a Hydra config via command line

There's already a related question, however the proposed Compose API no longer supports passing a config as an argument by Hydra 0.11.3. I'm wondering if there is a way to pass the config via command line or whether this functionality is disabled in…
Casey
  • 43
  • 1
  • 4
3
votes
1 answer

How can I use OmegaConf custom interpolation with Hydra

How can I use OmegaConf custom interpolation with Hydra? Some background: One can define a custom interpolation for square root: from omegaconf import OmegaConf import math OmegaConf.register_resolver("sqrt", lambda x: math.sqrt(float(x))) And use…
anthonytec2
  • 49
  • 1
  • 2
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
2 answers

Is there any way to log 'git hash' in hydra?

I want to control version of experiment configuration files with hydra and dvc without uploading original config files to git. Hydra does control config, and dvc controls version. But Hydra does not specify which 'code version' is needed to…
이준혁
  • 267
  • 4
  • 14
1
2
3
12 13