pub struct GgufHeader {
pub metadata: BTreeMap<String, Value>,
pub file_bytes: u64,
pub data_offset: u64,
pub tensors: Vec<TensorRow>,
}Expand description
A GGUF header: the metadata and the whole tensor table, and where in the file the tensor data lives.
Fields§
§metadata: BTreeMap<String, Value>§file_bytes: u64§data_offset: u64§tensors: Vec<TensorRow>Implementations§
Source§impl GgufHeader
impl GgufHeader
Sourcepub fn read_ledger(path: &Path) -> Result<GgufHeader, String>
pub fn read_ledger(path: &Path) -> Result<GgufHeader, String>
A header ledger (benchmarks/silicon/decode/headers/*.json, written by
scripts/accel/gguf_remote_header.py --tensors).
Sourcepub fn source(&self) -> HeaderSource
pub fn source(&self) -> HeaderSource
The header as a checkpoint’s description (crate::model::spec::SpecSource).
Sourcepub fn spec(&self) -> Result<ModelSpec, SpecError>
pub fn spec(&self) -> Result<ModelSpec, SpecError>
The architecture the header describes, read as crate::model::spec::ModelSpec::from_gguf reads its
checkpoint’s.
Sourcepub fn arch(&self) -> Option<&str>
pub fn arch(&self) -> Option<&str>
general.architecture — the prefix every architecture key carries.
Sourcepub fn meta_u64(&self, key: &str) -> Option<u64>
pub fn meta_u64(&self, key: &str) -> Option<u64>
The architecture key {arch}.{key} as an unsigned integer.
Sourcepub fn tensor_type(&self, t: &TensorRow) -> Result<GgmlType, DecodeRefusal>
pub fn tensor_type(&self, t: &TensorRow) -> Result<GgmlType, DecodeRefusal>
The storage type of t.
Sourcepub fn tensor_bytes(&self, t: &TensorRow) -> Result<u64, DecodeRefusal>
pub fn tensor_bytes(&self, t: &TensorRow) -> Result<u64, DecodeRefusal>
Bytes t occupies in the file.
Sourcepub fn byte_audit(&self) -> Result<(), String>
pub fn byte_audit(&self) -> Result<(), String>
Holds the tensor table to the file: in offset order each tensor’s bytes fill the gap to the next up to the alignment padding, and the last one ends exactly where the file does. A wrong block size, a wrong type id or a missing tensor cannot pass.
Trait Implementations§
Source§impl Clone for GgufHeader
impl Clone for GgufHeader
Source§fn clone(&self) -> GgufHeader
fn clone(&self) -> GgufHeader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GgufHeader
impl Debug for GgufHeader
Source§impl<'de> Deserialize<'de> for GgufHeader
impl<'de> Deserialize<'de> for GgufHeader
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for GgufHeader
impl PartialEq for GgufHeader
Source§impl Serialize for GgufHeader
impl Serialize for GgufHeader
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.
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.
impl StructuralPartialEq for GgufHeader
Auto Trait Implementations§
impl Freeze for GgufHeader
impl RefUnwindSafe for GgufHeader
impl Send for GgufHeader
impl Sync for GgufHeader
impl Unpin for GgufHeader
impl UnsafeUnpin for GgufHeader
impl UnwindSafe for GgufHeader
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.