GgufMeta

Trait GgufMeta 

Source
pub trait GgufMeta {
    // Required methods
    fn get_u64(&self, key: &str) -> Option<u64>;
    fn get_f64(&self, key: &str) -> Option<f64>;
    fn get_str(&self, key: &str) -> Option<&str>;
    fn get_arr_len(&self, key: &str) -> Option<usize>;

    // Provided methods
    fn get_u64_arr(&self, _key: &str) -> Option<Vec<u64>> { ... }
    fn get_f64_arr(&self, _key: &str) -> Option<Vec<f64>> { ... }
}
Expand description

Typed read access to GGUF metadata. Implemented by the spark-runtime GGUF parser over its parsed key/value table. All getters return None when the key is absent or holds a different value type — the builder decides whether absence is fatal or has a derivation rule.

Required Methods§

Source

fn get_u64(&self, key: &str) -> Option<u64>

Any unsigned/signed integer metadata value, widened to u64.

Source

fn get_f64(&self, key: &str) -> Option<f64>

Any float metadata value (f32/f64), widened to f64.

Source

fn get_str(&self, key: &str) -> Option<&str>

A string metadata value.

Source

fn get_arr_len(&self, key: &str) -> Option<usize>

Length of an array metadata value (e.g. tokenizer.ggml.tokens).

Provided Methods§

Source

fn get_u64_arr(&self, _key: &str) -> Option<Vec<u64>>

An integer array metadata value, every element widened to u64.

DEFAULTS TO None so existing implementors keep compiling: a reader that has not implemented it reports “absent”, which every caller here already handles. DeepSeek-V4.1 is the first arch that needs real array VALUES rather than a length (attention.compress_ratios, engram.layer_ids, engram.{multipliers,primes,offsets}), so a reader that returns None here simply cannot build a V4.1 config.

Source

fn get_f64_arr(&self, _key: &str) -> Option<Vec<f64>>

A float array metadata value, every element widened to f64. Defaults to None for the same reason as GgufMeta::get_u64_arr. DeepSeek-V4.1 needs it for swiglu_clamp_exp / swiglu_clamp_shexp.

Implementors§