-
Notifications
You must be signed in to change notification settings - Fork 112
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] Array Element Overrides from dotlist via getitem syntax #179
Comments
Blocked on #445 |
If I am not mistaken, this issue is resolved: >>> training_parameters = OmegaConf.create({"lr_steps": [1000,800,100,75]})
>>> training_parameters
{'lr_steps': [1000, 800, 100, 75]}
>>> training_parameters.lr_steps[1]
800
>>> training_parameters.lr_steps[1] = 500
>>> training_parameters
{'lr_steps': [1000, 500, 100, 75]} |
No, that's because the way it's phrased can be misleading. |
In [3]: cfg = OmegaConf.create({"a" : {"b": [1,2,3]}})
In [4]: cfg
Out[4]: {'a': {'b': [1, 2, 3]}}
In [5]: OmegaConf.select(cfg, "")
Out[5]: {'a': {'b': [1, 2, 3]}}
In [6]: OmegaConf.select(cfg, "a")
Out[6]: {'b': [1, 2, 3]}
In [7]: OmegaConf.select(cfg, "a.b")
Out[7]: [1, 2, 3]
In [8]: OmegaConf.select(cfg, "a.b.0")
Out[8]: 1 What would be good is to support: OmegaConf.select(cfg, "a.b[0]") In fact, we can support it for regular dict access as well: OmegaConf.select(cfg, "[a][b][0]") |
This should probably cover the interpolation syntax as well, so it can be too much for 2.1: list:
- a
- b
item0: ${list.0} # a, current syntax
item1: ${list[1]} # b, new syntax |
Support for getitem notation Fixes #179
Hi, I found this issue when trying to figure out how to do just that. Can you point me to documentation I missed or, can I request documentation of this feature? |
Hi @dasturge, Take a look at the docs on Config node interpolation. Also, there are usage examples in the |
Currently, OmegaConf supports overriding as
training_parameters.lr_steps.1=500
for overriding a specific element of an array. This is not intuitive and we should support proper getitem syntax for array element overrides.training_parameters.lr_steps[1]=500
should be supported.The text was updated successfully, but these errors were encountered: