-
Notifications
You must be signed in to change notification settings - Fork 28.8k
Gemma3 is Torch Exportable #37728
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
Gemma3 is Torch Exportable #37728
Conversation
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. The CI will be paused while the PR is in draft mode. When it is ready for review, please click the |
41ccd3d
to
e120479
Compare
e120479
to
c3a03f9
Compare
CC: @tugsbayasgalan for review as well |
c3a03f9
to
c126d47
Compare
removed unused buffer |
c126d47
to
98df630
Compare
Fixed in the ExportableModule to make gemma3 lowerable to ExecuTorch |
13dbffd
to
6ec580f
Compare
I've ran |
6ec580f
to
6f389db
Compare
6f389db
to
bff3c2f
Compare
Hey @guangy10! Thanks for the PR! The changes LGTM, however the gemma3 change should be reflected in |
It's the source of the issue in |
cc @gante as well for viz! |
Done. Could you take another look? |
0729eff
to
ae84d3f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks a lot! Great work, super clean 🤗
Merging
* Gemma3 is Torch Exportable * Expand the support to other mdoels using HybridCache --------- Co-authored-by: Guang Yang <guangyang@fb.com>
What does this PR do?
Initial effort to add
torch.expport
support for the Gemma3 model!Gemma3 provides a 1b variant that is suitable for
ExecuTorch
to bring it for on-device use-case. This PR is focusing on creating the export recipe and validate the exported model can produce same output as eager.Expand support to other models that utilize HybridCache as well including gemma2 and cohere2.
End2end Test Validation with Exported Graph
RUN_SLOW=1 pytest tests/models/gemma3/test_modeling_gemma3.py -s -v -k test_export_text_only_with_hybrid_cache
Ene2end Validation in Optimum-ExecuTorch
Before submitting
Pull Request section?
to it if that's the case. Gemma3 is ExecuTorch compatible #37727
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
@ArthurZucker @gante @qubvel