Skip to main content

WeightSource

Trait WeightSource 

Source
pub trait WeightSource {
    // Required methods
    fn describe(&self, name: &str) -> Result<(GgmlType, Vec<u64>)>;
    fn row_bytes(
        &mut self,
        name: &str,
        first: usize,
        count: usize,
    ) -> Result<Vec<u8>>;
    fn has(&self, name: &str) -> bool;
}
Expand description

Where the reference reads a model’s weights: a checkpoint, or tensors held in memory (a test’s tiny model). Tensors are named and laid out as GGUF names and lays them out (dims[0] the fastest).

Required Methods§

Source

fn describe(&self, name: &str) -> Result<(GgmlType, Vec<u64>)>

A tensor’s format and dims.

Source

fn row_bytes( &mut self, name: &str, first: usize, count: usize, ) -> Result<Vec<u8>>

The bytes of rows [first, first + count), a row being the tensor’s dims[0] elements.

Source

fn has(&self, name: &str) -> bool

Implementors§

Source§

impl WeightSource for GgufHeader

A header as a checkpoint’s weights: every tensor’s format and dims and none of its bytes, what lays the checkpoint out on the card and lowers its step.

Source§

impl WeightSource for Gguf

Source§

impl WeightSource for HfCheckpoint

Source§

impl WeightSource for Tensors