You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking forward to getting to grips with nnx, I went about implementing the apparently missing gemma2_2b model.
After coming up with a suitable TransformerConfig, I was surprised that I couldn't get a forward pass to run : So I added 'Grouped-Query Attention' (mirroring what can be seen in the GDM gemma library).
Still no dice, since (although I checked all the params were getting set correctly), garbage logits were being returned. So I labouriously went through each layer, checking for numerical differences, only to find that in modules.Block, the ordering of the sub-modules is clearly in the wrong order (look at the pre_ffw_norm and the post_attn_norm, and the residual paths, for instance):
After fixing this up, the model's final logits come out pretty close to the GDM gemma ones (small errors seem to creep in along the way due to bfloat16/float16). This is good news - though it is slightly worrying that this example has been unusable over the whole period, since its actual functionality as an implementation of gemma models does not appear to have been tested...
Please let me know if you'd like a PR to cover (at minimum) adding a working gemma2_2b
The text was updated successfully, but these errors were encountered:
mdda
linked a pull request
Feb 28, 2025
that will
close
this issue
Looking forward to getting to grips with
nnx
, I went about implementing the apparently missinggemma2_2b
model.After coming up with a suitable
TransformerConfig
, I was surprised that I couldn't get a forward pass to run : So I added 'Grouped-Query Attention' (mirroring what can be seen in the GDMgemma
library).Still no dice, since (although I checked all the params were getting set correctly), garbage logits were being returned. So I labouriously went through each layer, checking for numerical differences, only to find that in
modules.Block
, the ordering of the sub-modules is clearly in the wrong order (look at thepre_ffw_norm
and thepost_attn_norm
, and the residual paths, for instance):After fixing this up, the model's final
logits
come out pretty close to the GDMgemma
ones (small errors seem to creep in along the way due to bfloat16/float16). This is good news - though it is slightly worrying that this example has been unusable over the whole period, since its actual functionality as an implementation of gemma models does not appear to have been tested...Please let me know if you'd like a PR to cover (at minimum) adding a working
gemma2_2b
The text was updated successfully, but these errors were encountered: