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

Clean up and add our gemma conversion script #1493

Merged
merged 4 commits into from
Mar 11, 2024

Conversation

mattdangerw
Copy link
Member

From flax -> keras. Useful to have as reference.

@mattdangerw mattdangerw requested a review from grasskin March 6, 2024 22:00
@github-actions github-actions bot added the Gemma Gemma model specific issues label Mar 6, 2024
@mattdangerw
Copy link
Member Author

This is still WIP. Need to finish up the numerics checking part.

From flax -> keras. Useful to have as reference.
@mattdangerw mattdangerw force-pushed the gemma-conversion-script branch from 1c62063 to 2f617e3 Compare March 7, 2024 01:13
@mattdangerw
Copy link
Member Author

Ok ready! Would still be good to add some numerics checking here, but can do that as a follow up.

🏃 Coverting gemma_2b_en
✅ Flax model downloaded from kaggle
✅ Flax model loaded
✅ Keras model loaded
✅ Weights converted
🔶 KerasNLP output: What is Keras?

Keras is a high-level neural network API that provides a flexible and efficient interface for building and training neural networks. It is
🔶 Flax output: What is Keras?

Keras is a high-level neural network API that provides a flexible and efficient interface for building and training neural networks. It is
✅ Output validated
🏁 Preset saved to ./gemma_2b_en

@mattdangerw mattdangerw marked this pull request as ready for review March 7, 2024 01:14
@mattdangerw mattdangerw force-pushed the gemma-conversion-script branch from e4214f9 to 9bad97a Compare March 8, 2024 01:17
Copy link
Member

@grasskin grasskin left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you Matt

Convert Gemma flax checkpoints to the Keras format.

Setup:
pip install requirements.txt
Copy link
Member

Choose a reason for hiding this comment

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

pip install -r

@mattdangerw mattdangerw merged commit bfc4d8e into keras-team:master Mar 11, 2024
9 of 10 checks passed
abuelnasr0 pushed a commit to abuelnasr0/keras-nlp that referenced this pull request Apr 2, 2024
* Clean up and add our gemma conversion script

From flax -> keras. Useful to have as reference.

* Fix comments

* Convert to bfloat16 weights

* Review comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Gemma Gemma model specific issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants