API discrepancy between `Gemma3TextConfig` and others
Author: Tcc0403
Pull request: no
Labels: name: bug

### System Info

transformers==v5.0.0rc3

### Who can help?

@zucchini-nlp 

### Information

- [ ] The official example scripts
- [x] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

`Gemma3TextConfig` has inconsistent behavior compared to other counterparts (e.g., `Gemma2Config`, `LlamaConfig`, `Qwen3VLTextConfig`) when handling the `rope_parameters` argument during initialization.

While other configuration classes generally accept a simple dictionary for `rope_parameters`, `Gemma3TextConfig` strictly expects a nested dictionary structure with specific keys ("full_attention", "sliding_attention"). Passing a standard dictionary (e.g. `{'rope_theta': 1000000.0}`) raises a KeyError.

Run:
```py
from transformers import Gemma3TextConfig
from transformers import Qwen3VLTextConfig
print("Default")
qwen3_config = Qwen3VLTextConfig()
print(f"qwen3_config.rope_parameters: {qwen3_config.rope_parameters}")
gemma3_config = Gemma3TextConfig()
print(f"gemma3_config.rope_parameters: {gemma3_config.rope_parameters}")
print("\nSet rope_theta=1000000.0")
qwen3_config = Qwen3VLTextConfig(
    rope_parameters=dict(
        rope_theta=1000000.0,
    )
)
print(f"qwen3_config.rope_parameters: {qwen3_config.rope_parameters}")
gemma3_config = Gemma3TextConfig(
    rope_parameters=dict(
        rope_theta=1000000.0,
    )
)
print(f"gemma3_config.rope_parameters: {gemma3_config.rope_parameters}")
```

Output:
```
Default
qwen3_config.rope_parameters: {'rope_theta': 500000.0, 'rope_type': 'default'}
gemma3_config.rope_parameters: {'sliding_attention': {'rope_type': 'default', 'rope_theta': 10000.0}, 'full_attention': {'rope_type': 'default', 'rope_theta': 1000000.0}}

Set rope_theta=1000000.0
qwen3_config.rope_parameters: {'rope_theta': 1000000.0, 'rope_type': 'default'}
Traceback (most recent call last):
  File "/home/tcc/transformers/rope_params.py", line 19, in <module>
    gemma3_config = Gemma3TextConfig(
        rope_parameters=dict(
            rope_theta=1000000.0,
        )
    )
  File "/home/tcc/transformers/src/transformers/models/gemma3/configuration_gemma3.py", line 202, in __init__
    super().__init__(**kwargs)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/home/tcc/transformers/src/transformers/configuration_utils.py", line 219, in __init__
    kwargs = self.convert_rope_params_to_dict(
        ignore_keys_at_rope_validation=ignore_keys_at_rope_validation, **kwargs
    )
  File "/home/tcc/transformers/src/transformers/models/gemma3/configuration_gemma3.py", line 216, in convert_rope_params_to_dict
    self.rope_parameters["full_attention"].setdefault(
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
KeyError: 'full_attention'
```

root cause:
https://github.com/huggingface/transformers/blob/35a09896f997f0dac8b3f1c7b10e10b48321ae91/src/transformers/models/gemma3/configuration_gemma3.py#L216-L219


### Expected behavior

https://github.com/huggingface/transformers/blob/35a09896f997f0dac8b3f1c7b10e10b48321ae91/src/transformers/models/gemma3/configuration_gemma3.py#L204

There should be some extra handlings if `rope_parameters` accepts `RopeParameters` type
https://github.com/huggingface/transformers/blob/35a09896f997f0dac8b3f1c7b10e10b48321ae91/src/transformers/models/gemma3/configuration_gemma3.py#L158

or perhaps another typed dict should be defined.

Comments:
Hey @Tcc0403 , this is because Gemma3 was released with different RoPE parameters for full attention layers vs sliding attention layers. To allow the model store two different values, we added a nested `rope_params` support. Later in code you can see that each layer applies its own RoPE

https://github.com/huggingface/transformers/blob/35a09896f997f0dac8b3f1c7b10e10b48321ae91/src/transformers/models/gemma3/modeling_gemma3.py#L580-L582 

If you want to use the same RoPE params for all layers, you can create a nested dict with the same params copied

Yeah I get that we should pass difference RoPE params for full attention and sliding attention layers. Not really a bug, but its typehint is somewhat misleading

https://github.com/huggingface/transformers/blob/35a09896f997f0dac8b3f1c7b10e10b48321ae91/src/transformers/models/gemma3/configuration_gemma3.py#L158

as it only expects 
```py
dict[Literal["full_attention", "sliding_attention"], RopeParameters] | None
```

oh, you meant typing hints! Right, would you like to open a PR and fix gemma3/gemma3n and modernbert/modernbert_decoder typing hints, these are all models with different rope param per layer type?

sure!