pub struct BertHparams {Show 18 fields
pub arch: String,
pub n_layer: usize,
pub n_embd: usize,
pub n_ff: usize,
pub n_head: usize,
pub n_head_kv: usize,
pub n_ctx_train: usize,
pub n_token_types: usize,
pub layer_norm_eps: f32,
pub rope_theta: Option<f32>,
pub rope_dim: usize,
pub ffn: BertFfn,
pub topology: BertTopology,
pub rope_interleaved: bool,
pub alibi_slopes: Option<Vec<f32>>,
pub pooling: PoolingType,
pub cls_id: u32,
pub sep_id: u32,
}Expand description
bert.* metadata, after the loader has checked it.
Fields§
§arch: String§n_layer: usize§n_embd: usize§n_ff: usize§n_head: usize§n_head_kv: usize§n_ctx_train: usizeHeight of the learned position table.
n_token_types: usize§layer_norm_eps: f32§rope_theta: Option<f32>NEOX RoPE on Q and K instead of a learned position table:
Some(theta) for the architectures bert.cpp:126-133 rotates
(nomic-bert, nomic-bert-moe, jina-bert-v3), None for
bert itself, which adds position_embd at :90 instead.
One field for both facts on purpose: a file cannot have a
position table AND a rotation here, because upstream decides
both from the architecture and never reads the table for a
rotating one – measured, libllama’s load log never names
position_embd for nomic-bert.
rope_dim: usizeHow many of each head’s channels rotate
({arch}.rope.dimension_count), head_dim when the key is
absent. Only read when Self::rope_theta is Some.
ffn: BertFfnThe FFN this architecture runs (bert.cpp:179-201).
topology: BertTopologyWhere this architecture’s norms sit and what they are.
rope_interleaved: booltrue for the NORM (interleaved-pair) rotation, false for
NEOX (split-half). llama_model_rope_type answers NORM for
neo-bert alone among the encoders here.
alibi_slopes: Option<Vec<f32>>ALiBi slopes, one per head, for the architecture whose graph carries a positional bias instead of a table or a rotation.
jina-bert-v2.cpp:5 sets f_max_alibi_bias = 8.0f as a
LITERAL and bert.cpp:78-80 builds no inp_pos for it at all,
so this is the only place position enters that model. The bias
is SYMMETRIC here – llama-graph.cpp:442 fills the mask with
-|p0 - p1| for a non-causal model, where the decoder’s is
p_key - p_query – which is why the encoder computes its own
rather than calling the decoder’s row helper.
pooling: PoolingType§cls_id: u32[CLS] / [SEP], from tokenizer.ggml.bos_token_id and
tokenizer.ggml.seperator_token_id (upstream’s spelling of the
key, typo included). See BertEncoder::wrap_special.
sep_id: u32Implementations§
Trait Implementations§
Source§impl Clone for BertHparams
impl Clone for BertHparams
Auto Trait Implementations§
impl Freeze for BertHparams
impl RefUnwindSafe for BertHparams
impl Send for BertHparams
impl Sync for BertHparams
impl Unpin for BertHparams
impl UnsafeUnpin for BertHparams
impl UnwindSafe for BertHparams
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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