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] Build Sequential without specifying keys #1140

Open
vmoens opened this issue Dec 15, 2024 · 0 comments
Open

[Feature Request] Build Sequential without specifying keys #1140

vmoens opened this issue Dec 15, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@vmoens
Copy link
Contributor

vmoens commented Dec 15, 2024

Motivation

Long chains of modules can be confusing, and keeping track of all intermediate values can lead to some confusion.
It'd be nice to be able to build layers without specifying in/out_keys and have them bound to each other authomatically.
Keys that are not specified will be generated automatically and discarded after completion.

Solution

Example:

mod = Seq(
   Mod(lambda x: x+1, in_keys=["x"]), # we always need an in_keys at the beginning, out_keys is figured out automatically
   Mod(lambda x: 2*x), # in_keys and out_keys are lazily set - the previous output will be used as in_keys
   Mod(lambda x: (x, x.sqrt())), # This should also work: 2 out_keys will automatically be set
   Mod(lambda x, y, z: x + y + z), # This will raise an exception as we are waiting for 3 values but the previous module only had 2 outputs
)
@vmoens vmoens added the enhancement New feature or request label Dec 15, 2024
@vmoens vmoens self-assigned this Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant