Fixed Gemma example using Gemma2 models#4830
Merged
Merged
Conversation
vfdev-5
commented
Jul 22, 2025
| def __call__(self, x: Array) -> Array: | ||
| var = jnp.mean(jnp.square(x), axis=-1, keepdims=True) | ||
| normed_inputs = jnp.asarray(x * jnp.reciprocal(jnp.sqrt(var + 1e-06))) | ||
| normed_inputs = jnp.asarray(x * jax.lax.rsqrt(var + 1e-06)) |
Collaborator
Author
There was a problem hiding this comment.
This what also MaxText is doing: https://github.com/AI-Hypercomputer/maxtext/blob/33339821e96327d25613ace9d28c7a8789698586/MaxText/layers/normalizations.py#L60
vfdev-5
commented
Jul 22, 2025
| {"url": "google/gemma-2/flax/gemma2-2b"}, | ||
| {"url": "google/gemma-3/flax/gemma3-1b"}, | ||
| ) | ||
| def test_models_from_kaggle(self, url): |
Collaborator
Author
There was a problem hiding this comment.
@cgarciae I added this test to make sure that real models can work. By default this test is skipped and it can run locally if kagglehub is installed and env vars have creds.
Let me know if we want / do not want to keep this.
cgarciae
approved these changes
Jul 22, 2025
Collaborator
905198a to
7ec08cf
Compare
gemma2-2b config added, others rationalised Removed debugging prints...
7ec08cf to
90a5d16
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR is based on #4587 (thanks to @mdda!) and adds more tests and fixes remaining incosistencies with the latest codebase.
Fixes #4567
Closes #4587
Checklist
checks if that's the case).
discussion (please add a
link).
documentation guidelines.
(No quality testing = no merge!)