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

Change Phi3 _supports_sdpa to True #32457

Merged
merged 2 commits into from
Aug 8, 2024

Conversation

pocca2048
Copy link
Contributor

@pocca2048 pocca2048 commented Aug 6, 2024

What does this PR do?

Change Phi3 model's sdpa support from False to True.

Fixes #31863

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

@ArthurZucker

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There might be a styling error, let’s get this green!

@pocca2048
Copy link
Contributor Author

@ArthurZucker I think it is all green now~!

@ArthurZucker
Copy link
Collaborator

Thanks!

@ArthurZucker ArthurZucker merged commit e28784f into huggingface:main Aug 8, 2024
18 checks passed
@pocca2048 pocca2048 deleted the phi3-sdpa-support-to-True branch August 9, 2024 07:56
yundai424 pushed a commit to linkedin/Liger-Kernel that referenced this pull request Aug 27, 2024
## Summary
Add a new monkeypatch function to support patching Huggingface's Phi3
implementation with Liger Kernels.

Phi3 has its own MLP implementation (`Phi3MLP`) so a
`LigerPhi3SwiGLUMLP` implementation that leverages
`LigerSiLUMulFunction` is provided as well.


## Testing Done
- [x] run `make test` to ensure correctness
- [x] run `make checkstyle` to ensure code style
- [x] run `make test-convergence` to ensure convergence

Convergence test added (and passing on my 4090) for a minimodel based on
Phi3 patched with liger kernels.
All tests passing.

## Questions for Discussion
Apparently Phi3 was only added in [transformers
v4.41](https://github.com/huggingface/transformers/releases/tag/v4.41.0),
but the lowest supported version of transformers in Liger-Kernel is
4.40.1. Additionally, only more recently has [`sdpa` been supported in
HF Phi3](huggingface/transformers#32457).
Thoughts? Should I leave the transformers dependency version as-is?
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

Successfully merging this pull request may close these issues.

Implementation of SDPA for Microsoft Phi-3 Mini
2 participants