Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] allow repeating elements in list #2267

Open
AsaphLightricks opened this issue Jun 20, 2022 · 1 comment
Open

[Feature Request] allow repeating elements in list #2267

AsaphLightricks opened this issue Jun 20, 2022 · 1 comment
Labels
enhancement Enhanvement request

Comments

@AsaphLightricks
Copy link

AsaphLightricks commented Jun 20, 2022

I tried finding someone with a solution to my problem but i couldn't find any issue similar to this. So this is a question / feature request:

🚀 Feature Request

allow repeating an element in a config, for example, for this directory tree:

config
   |-- lights
          |--  point.yaml
          |-- directional.yaml

and this config:

lights: 
  - point
  - point
  - directional

should result in:
{'lights': {'point': ..., 'point': ..., 'directional': ...}}

but currently i'm getting: (hydra v1.2.0)
{'lights': {'point': ..., 'directional': ...}}
missing one of the point lights.

Motivation

as in my example, i would like to indicate that i want to have 2 point lights, and 1 directional light.

Is there a syntax for that that i'm missing?

@AsaphLightricks AsaphLightricks added the enhancement Enhanvement request label Jun 20, 2022
@Jasha10
Copy link
Collaborator

Jasha10 commented Jun 21, 2022

Note that Python dictionaries only allow each key to appear once:

>>> {"point": 1, "point": 2}
{'point': 2}

See #1939, particularly my comment here, for some tips on how to compose a ListConfig (rather than a DictConfig) using Hydra's defaults list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhanvement request
Projects
None yet
Development

No branches or pull requests

2 participants