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

Keyword arguments for liger functional #368

Open
Tcc0403 opened this issue Nov 8, 2024 · 2 comments
Open

Keyword arguments for liger functional #368

Tcc0403 opened this issue Nov 8, 2024 · 2 comments
Assignees

Comments

@Tcc0403
Copy link
Collaborator

Tcc0403 commented Nov 8, 2024

🚀 The feature, motivation and pitch

Liger's functional doesn't support keyword arguments because it's implemented by replacing torchautograd.Function.apply.

kwargs support is necessary for LigerCrossEntropyLoss to patch transformers model after GA fix
https://github.com/huggingface/transformers/blob/a06a0d12636756352494b99b5b264ac9955bc735/src/transformers/models/llama/modeling_llama.py#L1224

Alternatives

No response

Additional context

No response

@ByronHsu
Copy link
Collaborator

CE is fixed by #375. But need to add functional wrapper for other modules

@hongpeng-guo
Copy link
Collaborator

I can take this one 😄

ByronHsu added a commit that referenced this issue Nov 21, 2024
## Summary
<!--- This is a required section; please describe the main purpose of
this proposed code change. --->

This PR enables the keyword arguments of liger functional #368. 

<!---
## Details
This is an optional section; is there anything specific that reviewers
should be aware of?
--->

1. Warp the Liger Operator Functions (`torch.autograd.Function`) with an
extra layer that can take key word arguments.
2. For each of the liger functions, updating its unit test function
`test_{operator_name}.py::test_correctness_functional` to reflect that
keyword args can be accepted.

## Testing Done
<!--- This is a required section; please describe how this change was
tested. --->

<!-- 
Replace BLANK with your device type. For example, A100-80G-PCIe

Complete the following tasks before sending your PR, and replace `[ ]`
with
`[x]` to indicate you have done them. 
-->

- Hardware Type:  A10G
- [x] run `make test` to ensure correctness
- [x] run `make checkstyle` to ensure code style
- [x] run `make test-convergence` to ensure convergence

---------

Signed-off-by: Hongpeng Guo <[email protected]>
Co-authored-by: Byron Hsu <[email protected]>
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

3 participants