Pin layer_types so the tiny Gemma3 and Olmo3 models cover both attention types - #6962
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. |
|
I created the corresponding PRs on the Hub for both tiny models:
And I tested them by pinning both revisions through https://github.com/huggingface/trl/actions/runs/33168783898/job/98840532231 Both Hub PRs need to be merged once approved: this PR's own CI still reads the tiny models from their |
|
Merging this PR as a simple fix of the CI and as already empirically verified by GH run: https://github.com/huggingface/trl/actions/runs/33168783898/job/98840532231 |
This PR pins
layer_typesin the tiny Gemma3 and Olmo3 generation scripts so that each model has one layer of each attention type.Fix #6961.
Motivation
Both tiny models have 2 layers, and their sliding-window periods (6 for Gemma3, 4 for Olmo3) make the derived pattern yield two sliding layers and no full-attention layer. Two consequences:
_compute_linear_scaling_rope_parameters(Gemma3) and_compute_yarn_parameters(Olmo3) are dead code in our fixtures, even though both configs still carry the reference's global rope settings.transformerslogsUnrecognized keys in rope_parameters for 'rope_type'='default': {'full_attention', 'sliding_attention'}on every config load, up to 104 times per CI job, because it classifies the nested per-layer rope dict against the layer types the model actually instantiates. Reported upstream as Nested per-layerrope_parametersis misparsed whenlayer_typesomits one of its keys transformers#48392.Solution
Pin
layer_typesexplicitly, as the Gemma4 and DiffusionGemma scripts already do, and as the Nemotron 3 scripts do for block types ("one of each block type").With 2 layers the reference ratios (5:1 for Gemma3, 3:1 for Olmo3) cannot be represented at all, so the choice is not between a faithful and an unfaithful pattern, but between covering one attention type and covering both.
The Hub models have been regenerated. Verified in this CI run: the log line drops from 104 to 0 in every job, no other
transformerslog line changes, and the test totals are unchanged (2369 passed, 149 skipped, 7 xfailed).Changes
layer_typesto["sliding_attention", "full_attention"]in the tiny Gemma3 generation script, replacing the previousNonethat derived the pattern fromnum_hidden_layerslayer_typesin the tiny Olmo3 generation scriptNote
Low Risk
Only affects tiny test fixture generation scripts and regenerated Hub weights; no runtime TRL or production model behavior changes.
Overview
Pins
layer_typesto["sliding_attention", "full_attention"]in the tiny Gemma3 and Olmo3 Hub generation scripts so each 2-layer fixture includes one sliding and one full-attention block.With only two layers, the auto-derived pattern from production ratios would use sliding attention everywhere, so global RoPE paths never ran in tests and
transformersspammed unrecognizedrope_parameterswarnings on config load. This matches how other tiny generators (e.g. Gemma4, DiffusionGemma) already pin one of each attention type.Reviewed by Cursor Bugbot for commit f229067. Bugbot is set up for automated code reviews on this repo. Configure here.