def from_config(cls, config: GemmaTransformerConfig) -> GemmaTransformerBlock:
    """Builds a ``GemmaTransformerBlock`` from a configuration.

    Args:
      config: The configuration of the Gemma model.

    Returns:
      A ``GemmaTransformerBlock`` with uninitialized parameters.
    """
    return cls(
        sublayers=[
            pz.nn.Residual(
                pz.nn.Sequential([
                    pz.nn.add_parameter_prefix(
                        "pre_attention_norm",
                        pz.nn.RMSLayerNorm.from_config(
                            {"embedding": config.embedding_dim},
                            dtype=config.parameter_dtype,
                        ),
                    ),
                    pz.nn.add_parameter_prefix(
                        "attn", GemmaAttention.from_config(config)
                    ),
                ])
            ),
            pz.nn.Residual(
                pz.nn.Sequential([
                    pz.nn.add_parameter_prefix(
                        "pre_ffw_norm",
                        pz.nn.RMSLayerNorm.from_config(
                            {"embedding": config.embedding_dim},
                            dtype=config.parameter_dtype,
                        ),
                    ),
                    pz.nn.add_parameter_prefix(
                        "mlp",
                        GemmaFeedForward.from_config(
                            embedding_dim=config.embedding_dim,
                            hidden_dim=config.mlp_hidden_dim,
                            dtype=config.parameter_dtype,
                        ),
                    ),
                ])
            ),
        ],
    )
Builds a ``GemmaTransformerBlock`` from a configuration.

    Args:
      config: The configuration of the Gemma model.

    Returns:
      A ``GemmaTransformerBlock`` with uninitialized parameters.
    
penzai/deprecated/v1/example_models/gemma/model_core.py