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] Append to a list from command line #1547

Open
KeAWang opened this issue Apr 9, 2021 · 8 comments
Open

[Feature Request] Append to a list from command line #1547

KeAWang opened this issue Apr 9, 2021 · 8 comments
Labels
enhancement Enhanvement request internal list composition wishlist Low priority feature requests
Milestone

Comments

@KeAWang
Copy link

KeAWang commented Apr 9, 2021

🚀 Feature Request

I don't think there's a way to do this currently, but it would be great if we could append to a list from the command line. For example say my config.yaml has

extras:
    tags: [experiment, trial_1]

It would be great if we could do something like: extras.tags+="[another_tag, yet_another_tag]" in the command line interface instead of having to retype the old entries in the list: extras.tags="[experiment, trial_1, another_tag, yet_another_tag]"

@KeAWang KeAWang added the enhancement Enhanvement request label Apr 9, 2021
@omry omry added the wishlist Low priority feature requests label Apr 10, 2021
@omry
Copy link
Collaborator

omry commented Apr 10, 2021

Thanks for the feature request.
This is not currently supported and is something we can consider for a future version.
There are some upcoming enhancements to OmegaConf that will offer an alternative approach for this (which will be available in Hydra 1.1), so we may end up sticking to those.

As a side note: adding support for += operator is a pretty big deal.
We do have generic functions support which we might leverage instead.

e.g:

"extras.tags=append([another_tag, yet_another_tag])"

It's a bit odd but will not introduce a change to something very fundamental.

@yunfanjiang
Copy link

any updates on this?

@Jasha10
Copy link
Collaborator

Jasha10 commented Dec 14, 2021

Thanks for the ping @yunfanjiang. No updates yet.

@ashleve
Copy link

ashleve commented Jun 9, 2022

Thumbs up for this feature

Something like tags+="[another_tag]" would be very useful!

@KuSi833
Copy link

KuSi833 commented Sep 2, 2022

The feature requests this for the command line, but that's not possible through configuration files either right? The use case I'm looking for is tags very much like @ashleve mentioned.

@Jasha10
Copy link
Collaborator

Jasha10 commented Sep 2, 2022

but that's not possible through configuration files either right?

Currently there is no elegant solution. There are some clunky solutions, usually involving OmegaConf's oc.dict.values resolver. The standard approach is to create a "tags dict" instead of a "tags list". The values of the tag dict can then be converted into a list.

See the comments here and here for an example of how to apply such a recipe using the defaults list.

@MaxWolf-01
Copy link

Would be a cool feature to have e.g. if you conduct a test run and want to tag them to just be able to logger.tags+="[test_tag]" rather than having to specify all the other tags as well (which change if I want to train with different config presets).

@EdwardYGLi
Copy link

up on this !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhanvement request internal list composition wishlist Low priority feature requests
Projects
None yet
Development

No branches or pull requests

9 participants