Skip to content

Pin layer_types so the tiny Gemma3 and Olmo3 models cover both attention types - #6962

Merged
albertvillanova merged 2 commits into
mainfrom
fix-6961
Aug 31, 2026
Merged

Pin layer_types so the tiny Gemma3 and Olmo3 models cover both attention types#6962
albertvillanova merged 2 commits into
mainfrom
fix-6961

Conversation

@albertvillanova

@albertvillanova albertvillanova commented Aug 28, 2026

Copy link
Copy Markdown
Member

This PR pins layer_types in 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:

  • The global RoPE path is never built or executed, so _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.
  • transformers logs Unrecognized 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-layer rope_parameters is misparsed when layer_types omits one of its keys transformers#48392.

Solution

Pin layer_types explicitly, 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 transformers log line changes, and the test totals are unchanged (2369 passed, 149 skipped, 7 xfailed).

Changes

  • Pin layer_types to ["sliding_attention", "full_attention"] in the tiny Gemma3 generation script, replacing the previous None that derived the pattern from num_hidden_layers
  • Pin the same layer_types in the tiny Olmo3 generation script

Note

Low Risk
Only affects tiny test fixture generation scripts and regenerated Hub weights; no runtime TRL or production model behavior changes.

Overview
Pins layer_types to ["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 transformers spammed unrecognized rope_parameters warnings 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.

@bot-ci-comment

Copy link
Copy Markdown

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.

@albertvillanova

albertvillanova commented Aug 28, 2026

Copy link
Copy Markdown
Member Author

I created the corresponding PRs on the Hub for both tiny models:

And I tested them by pinning both revisions through MODEL_REVISIONS in tests/conftest.py: the log message is gone, 104 occurrences down to 0, with the test totals unchanged (2369 passed, 149 skipped, 7 xfailed).

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 main revision, so the message will keep showing here until then.

@albertvillanova

albertvillanova commented Aug 31, 2026

Copy link
Copy Markdown
Member Author

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

@albertvillanova
albertvillanova merged commit 73bd5c4 into main Aug 31, 2026
10 checks passed
@albertvillanova
albertvillanova deleted the fix-6961 branch August 31, 2026 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI emits transformers warning log: Unrecognized keys in rope_parameters for 'rope_type'='default': {'full_attention', 'sliding_attention'}

1 participant