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

Re-support kwargs at run time #928

Closed
kwen2501 opened this issue Jan 17, 2024 · 0 comments
Closed

Re-support kwargs at run time #928

kwen2501 opened this issue Jan 17, 2024 · 0 comments

Comments

@kwen2501
Copy link
Contributor

kwen2501 commented Jan 17, 2024

People would like to pass kwargs to model as in non-pipeline runs, instead of converting it to args tuple first.
See: huggingface/accelerate#2345

args = (
    example_inputs["input_ids"].to("cuda:0"),
    example_inputs["decoder_input_ids"].to("cuda:0")
)
with torch.no_grad():
    output = model(*args)

PiPPy used to support kwargs before tracer migration. We'd need to add it back.

kwen2501 added a commit that referenced this issue Jan 19, 2024
## Description

Implements #928 

Users want the first pipeline stage to accept kwargs if the original
program does.
This is controlled by the `_codegen` field of the graph as @angelayi
suggests, so we make a copy from the traced program to submod0.


## Feature/Issue validation/testing

Added kwargs in test_fwd.py.
Also changed a few HF examples to directly kwargs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant