pub struct GemmaConfig {Show 15 fields
pub num_attention_heads: usize,
pub num_key_value_heads: usize,
pub hidden_size: usize,
pub head_dim: usize,
pub intermediate_size: usize,
pub max_position_embeddings: usize,
pub rms_norm_eps: f32,
pub vocab_size: usize,
pub num_hidden_layers: usize,
pub rope_theta: f32,
pub rope_local_base_freq: f32,
pub sliding_window: Option<usize>,
pub layer_types: Vec<String>,
pub query_pre_attn_scalar: Option<f32>,
pub hidden_activation: String,
}Expand description
Gemma model configuration
Fields§
§num_attention_heads: usizeNumber of attention heads for queries
num_key_value_heads: usizeNumber of key-value heads (MQA)
Hidden dimension size
head_dim: usizeHead dimension
intermediate_size: usizeIntermediate size for FFN
max_position_embeddings: usizeMaximum position embeddings
rms_norm_eps: f32RMSNorm epsilon
vocab_size: usizeVocabulary size
Number of hidden layers
rope_theta: f32RoPE theta for global attention
rope_local_base_freq: f32RoPE theta for local attention (Gemma3)
sliding_window: Option<usize>Sliding window size (Gemma3)
layer_types: Vec<String>Layer types (sliding_attention or full_attention)
query_pre_attn_scalar: Option<f32>Query pre-attention scalar (QK-norm for Gemma3)
Hidden activation function
Trait Implementations§
Source§impl ArchitectureConfig for GemmaConfig
impl ArchitectureConfig for GemmaConfig
Source§fn num_attention_heads(&self) -> usize
fn num_attention_heads(&self) -> usize
Number of attention heads for queries
Source§fn num_key_value_heads(&self) -> usize
fn num_key_value_heads(&self) -> usize
Number of key-value heads (for MQA/GQA)
Hidden dimension size
Source§fn intermediate_size(&self) -> usize
fn intermediate_size(&self) -> usize
Intermediate/FFN dimension size
Source§fn vocab_size(&self) -> usize
fn vocab_size(&self) -> usize
Vocabulary size
Source§fn max_position_embeddings(&self) -> usize
fn max_position_embeddings(&self) -> usize
Maximum position embeddings
Source§fn rope_theta(&self) -> Option<f32>
fn rope_theta(&self) -> Option<f32>
RoPE base frequency (if applicable)
Source§fn layer_norm_eps(&self) -> f32
fn layer_norm_eps(&self) -> f32
Layer normalization epsilon
Source§fn use_rms_norm(&self) -> bool
fn use_rms_norm(&self) -> bool
Whether to use RMSNorm instead of LayerNorm
Source§fn use_parallel_residual(&self) -> bool
fn use_parallel_residual(&self) -> bool
Whether this architecture uses parallel attention and FFN
Source§fn attention_type(&self) -> AttentionType
fn attention_type(&self) -> AttentionType
Get attention type (MHA, MQA, GQA)
Source§fn default_dtype(&self) -> DType
fn default_dtype(&self) -> DType
Default dtype for this architecture
Source§impl Clone for GemmaConfig
impl Clone for GemmaConfig
Source§fn clone(&self) -> GemmaConfig
fn clone(&self) -> GemmaConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GemmaConfig
impl Debug for GemmaConfig
Auto Trait Implementations§
impl Freeze for GemmaConfig
impl RefUnwindSafe for GemmaConfig
impl Send for GemmaConfig
impl Sync for GemmaConfig
impl Unpin for GemmaConfig
impl UnsafeUnpin for GemmaConfig
impl UnwindSafe for GemmaConfig
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Apply a transformation to the response body. Read more
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using HTTP status codes. Read more
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using gRPC headers. Read more