Coverage for transformer_lens/model_bridge/supported_architectures/youtu.py: 100%
4 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"""Youtu architecture adapter.
3Tencent's Youtu-LLM (``YoutuForCausalLM``, native in transformers): the
4only laptop-scale densely-MLP'd Multi-head Latent Attention checkpoint —
5DeepSeek-V2's MLA (q LoRA + compressed KV with decoupled rope) with every
6layer dense. Module names match DeepSeek-V2 exactly and the MLA bridge
7already handles both q-projection variants, so this is a pure subclass:
8the MoE router/shared-expert submodules are optional and simply never
9bind on the dense MLPs.
10"""
12from transformer_lens.model_bridge.supported_architectures.deepseek_v2 import (
13 DeepSeekV2ArchitectureAdapter,
14)
17class YoutuArchitectureAdapter(DeepSeekV2ArchitectureAdapter):
18 """Architecture adapter for YoutuForCausalLM models."""
20 def _build_mlp_bridge(self):
21 """Every layer is a plain gated MLP — map it so weight processing
22 sees mlp.in/gate/out (the parent's MoE wrapper leaves them opaque)."""
23 return self._gated_mlp()