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] Composing multiple default packages into a list #2335

Closed
albertfgu opened this issue Aug 10, 2022 · 2 comments
Closed

[Feature Request] Composing multiple default packages into a list #2335

albertfgu opened this issue Aug 10, 2022 · 2 comments
Labels

Comments

@albertfgu
Copy link

🚀 Feature Request

Motivation

Is your feature request related to a problem? Please describe.
I apologize if this feature exists or has been asked before, but I couldn't find a solution.

I have a Python class that accepts a list of configs. Imagine a number of configs for individual classes that can be instantiated:

configs/model/linear.yaml:

_target_: torch.nn.Linear
in_features: 10
out_features: 10

configs/model/relu.yaml:

_target_: torch.nn.ReLU

Now imagine wanting to create something like nn.Sequential flexibly from command line. In particular, I'd like to flexibly be able to create configs such as

configs/model/model1.yaml:

- _target_: torch.nn.Linear
  in_features: 10
  out_features: 10
- _target_: torch.nn.ReLU

configs/model/model2.yaml:

- _target_: torch.nn.Linear
  in_features: 10
  out_features: 10
- _target_: torch.nn.Linear
  in_features: 10
  out_features: 20

However, I don't want to create a config for every possible combination. An ideal interface would be something like
configs/model/model1.yaml:

defaults:
  - linear
  - relu

However, this clearly doesn't work and I'm not sure what other interface could make sense. Maybe an alternative interface could be
configs/model/model1.yaml:

defaults:
  - linear@0
  - relu@1

Any ideas for how to implement something like this?

@albertfgu albertfgu added the enhancement Enhanvement request label Aug 10, 2022
@Jasha10
Copy link
Collaborator

Jasha10 commented Aug 10, 2022

See #1939, as well as the other issues tagged with the "list composition" tag. I'm going to close this issue in favor of #1939.

For a relatively cumbersome workaround, see my comments here and here.

@Jasha10 Jasha10 closed this as completed Aug 10, 2022
@albertfgu
Copy link
Author

Thanks for the reference!

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

No branches or pull requests

2 participants