Coverage for transformer_lens/model_bridge/supported_architectures/gemma4_text.py: 100%
11 statements
« prev ^ index » next coverage.py v7.10.1, created at 2026-08-11 18:50 +0000
« prev ^ index » next coverage.py v7.10.1, created at 2026-08-11 18:50 +0000
1"""Gemma 4 text-only architecture adapter.
3``Gemma4ForCausalLM``: the bare Gemma4TextModel with an LM head — the same
4decoder the multimodal adapter maps, but living at ``model.*`` directly
5(no ``language_model`` nesting) and with no vision components.
6"""
8from typing import Any
10from transformer_lens.model_bridge.supported_architectures.gemma4 import (
11 Gemma4ArchitectureAdapter,
12)
14_MM_PREFIX = "model.language_model."
17class Gemma4TextArchitectureAdapter(Gemma4ArchitectureAdapter):
18 """Architecture adapter for Gemma4ForCausalLM models."""
20 _testing_wire_rotary = False
22 def __init__(self, cfg: Any) -> None:
23 super().__init__(cfg)
25 self.cfg.is_multimodal = False
26 self.components.pop("vision_encoder", None)
27 self.components.pop("vision_projector", None)
28 self._reprefix_components(_MM_PREFIX, "model.")