Align tiny Gemma2 config with google/gemma-2-2b-it - #7228
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
6ee0de4 to
d097f63
Compare
|
The CI model has been regenerated and the corresponding Hub PR is open. It needs to be merged once this PR is approved: |
why not aligning them then? |
|
Tested with The suite is green. |
d097f63 to
9ba41bb
Compare
|
Merging this as part of the approved series. The rows left un-aligned here ( |
This PR aligns the
tiny-Gemma2ForCausalLMgenerator config with its reference model,google/gemma-2-2b-it.Part of #7137. Depends on #7227, which fixes the
head_dimscale-down; this PR is branched off it and only the last commit belongs here.Motivation
The script builds
Gemma2Configfrom architecture arguments only, soeos_token_idfalls back to the class default of1, a scalar, where the reference ships the list[1, 107]. This is the case #7137 opens with: generation stops on a single id in the tiny model, while every user of the real model stops on either, so the multi-id stopping path has no coverage.Solution
Mirror the reference values:
eos_token_id=[1, 107](reference value; class default is the scalar1)vocab_size=256000, matchinglen(tokenizer.vocab)today and pinned so the config no longer depends on the tokenizer files at generation timecache_implementationandhidden_actstay as differences: the reference repo carries both, butGemma2Configmodels neither, the same situation asrope_scalingin #7217,use_mropein #7135 anduse_mambapyin #7139.Before, with the head_dim reduction already applied by #7227
After
Every remaining row is the deliberate size reduction, apart from
cache_implementationandhidden_act. Produced withprint_config_diffattransformers==4.56.2, the versioncheck_transformers_version()pins. The Hub repo needs regenerating for this to take effect.Changes
vocab_sizeto the reference's 256000eos_token_idfrom the reference configNote
Low Risk
Only changes the tiny-model generation script and published test artifact config; no runtime library or production inference paths.
Overview
Updates the tiny Gemma2 generator so its
Gemma2Configmatchesgoogle/gemma-2-2b-iton fields that affect generation semantics, not just shrunk architecture.eos_token_idis set to[1, 107]instead of the class default scalar1, so the tiny Hub model exercises the same multi-EOS stopping behavior as the reference.vocab_sizeis pinned to256000rather thanlen(tokenizer.vocab), decoupling config generation from tokenizer files while staying aligned with the reference today.Remaining
print_config_diffgaps vs the full model are intentional mini dimensions and known unsupported fields (cache_implementation,hidden_act). The Hub tiny repo must be regenerated for the change to land in published artifacts.Reviewed by Cursor Bugbot for commit 9ba41bb. Bugbot is set up for automated code reviews on this repo. Configure here.