-
-
Notifications
You must be signed in to change notification settings - Fork 639
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
[Bug] Unable to delete an item from ListConfig #2477
Comments
Thanks for the report @jbaczek. This reminds me of the open omegaconf issue omry/omegaconf#864
When |
After thinking about this some more, I'm not sure it make sense to support deleting items from ListConfig via the CLI. Consider the following example:
Does the above delete items In python, if you execute I think that it would be nice if the mutations described by the command line overrides were applied to the ListConfig object in the same order that they are enumerated at the command line. I'm not sure if Hydra currently enforces such order dependence. |
I think the deletion logic in Hydra never considered lists. |
Because you enter a command only a single time, then I think that all deletions should be parsed at the same time. Meaning that elements
would result in deleting items
would result in deleting items |
Btw one workaround is to use config:
x: ${oc.dict.values:x_data}
x_data:
a: elem_1
b: elem_2
|
🐛 Bug
Description
I'm unable to delete an item from a ListConfig using the command line. Ex. using the list indexing syntax
config.list.0
a list index is parsed as a string which raises a TypeError in omegaconf's ListConfig.The bug is caused by lines 367-368 in
hydra/_internal/config_loader_impl.py
file.key
is a string indexing path within a config. In my case it ends with0
because i want to delete 0th element of the list. The node retrieved is of type ListConfig which accepts ints and slices as indices. But key[last_dot + 1 :] is clearly a string.Checklist
To reproduce
Assemble a config that contains a list inside. Ex:
python my_app.py -c job ~config.x.0
** Stack trace/error message **
Expected Behavior
I should be able to remove element from a list using
~config.list.<index>
syntaxSystem information
The text was updated successfully, but these errors were encountered: