Search code examples
pythonzshfb-hydra

how can I specify a list on the command line


I have the following configuration with hydra:

data_files: null
theta: 0.2
use_weights: true

I can override this as:

python -m apps.test_hydra data.data_files=x 

However, when I try to specify a list as:

python -m apps.test_hydra data.data_files=[x,y] 

Then I get the following error:

zsh: no matches found: data.data_files=[x,y]

I am not sure if this is some issue with the zsh shell or hydra issue


Solution

  • Wrap the string in quotes to avoid [ being interpreted as a glob expression.

    python -m apps.test_hydra 'data.data_files=[x,y]' 
    

    On a hydra github issue, they use the following syntax. You might have to do something similar.

    $ python -m apps.test_hydra 'data@data_files=[x, y]'