pub struct EngramHashTables {
pub layer_ids: Vec<usize>,
pub max_ngram: usize,
pub n_heads: usize,
pub pad_id: i64,
pub token_map: Vec<i64>,
pub multipliers: Vec<Vec<i64>>,
pub primes: Vec<Vec<Vec<i64>>>,
pub offsets: Vec<Vec<i64>>,
}Expand description
The hash tables, shaped as the reference indexes them.
Fields§
§layer_ids: Vec<usize>§max_ngram: usize§n_heads: usize§pad_id: i64token_map[engram_pad_token_id]: the pad in the compressed space.
token_map: Vec<i64>[vocab], -1 = unmapped.
multipliers: Vec<Vec<i64>>[layer][lookback]
primes: Vec<Vec<Vec<i64>>>[layer][ngram_size - 2][head]
offsets: Vec<Vec<i64>>[layer][(ngram_size - 2) * n_heads + head]
Implementations§
Source§impl EngramHashTables
impl EngramHashTables
Sourcepub fn from_flat(
layer_ids: Vec<usize>,
max_ngram: usize,
n_heads: usize,
pad_token_id: u32,
token_map: Vec<i64>,
multipliers: &[u64],
primes: &[u64],
offsets: &[u64],
) -> Result<Self>
pub fn from_flat( layer_ids: Vec<usize>, max_ngram: usize, n_heads: usize, pad_token_id: u32, token_map: Vec<i64>, multipliers: &[u64], primes: &[u64], offsets: &[u64], ) -> Result<Self>
From the flat GGUF metadata arrays (deepseek41.engram.*, as
ModelConfig carries them): multipliers [layers * max_ngram], primes
[layers * (max_ngram - 1) * n_heads], offsets the same length.
pub fn n_hash_cols(&self) -> usize
pub fn n_layers(&self) -> usize
Sourcepub fn hash_index(&self, layer: usize) -> Option<usize>
pub fn hash_index(&self, layer: usize) -> Option<usize>
Position of model layer layer in layer_ids.
Auto Trait Implementations§
impl Freeze for EngramHashTables
impl RefUnwindSafe for EngramHashTables
impl Send for EngramHashTables
impl Sync for EngramHashTables
impl Unpin for EngramHashTables
impl UnwindSafe for EngramHashTables
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
Mutably borrows from an owned value. Read more