pub struct GgufLayout {
pub path: String,
pub metadata: GgufMetadata,
pub tensors: HashMap<String, Tensor>,
pub alignment: usize,
pub tensor_data_offset: usize,
pub bytes: Vec<u8>,
}Expand description
Fully-parsed GGUF checkpoint layout.
Owns the raw file bytes (loaded into a Vec<u8> by load_gguf)
and all derived tensor directory + metadata information. Callers use
the Tensor handles + GgufLayout::tensor_bytes to obtain raw
byte slices for each weight.
Fields§
§path: StringPath the checkpoint was loaded from (kept for error messages).
metadata: GgufMetadataParsed KV metadata.
tensors: HashMap<String, Tensor>Name -> tensor directory entry.
alignment: usizeByte alignment specified by the file (default 32).
tensor_data_offset: usizeAbsolute byte offset within bytes where tensor payloads begin.
bytes: Vec<u8>Full file contents. Tensor payloads live at bytes[tensor.absolute_offset ..].
Implementations§
Source§impl GgufLayout
impl GgufLayout
Sourcepub fn tensor_bytes<'a>(&'a self, tensor: &Tensor) -> Result<&'a [u8]>
pub fn tensor_bytes<'a>(&'a self, tensor: &Tensor) -> Result<&'a [u8]>
Return a borrowed slice of the raw tensor payload bytes.
Sourcepub fn find_tensors_with_suffix<'a>(&'a self, suffix: &str) -> Vec<&'a Tensor>
pub fn find_tensors_with_suffix<'a>(&'a self, suffix: &str) -> Vec<&'a Tensor>
Find all tensors whose name ends with the given suffix. Useful
for locating per-block MoE tensors like ffn_gate_exps.weight.
Trait Implementations§
Auto Trait Implementations§
impl Forget for GgufLayout
impl Freeze for GgufLayoutwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<(String, String)>: Freeze,
PhantomData<(String, u64)>: Freeze,
PhantomData<(String, i64)>: Freeze,
PhantomData<(String, f32)>: Freeze,
PhantomData<(String, f64)>: Freeze,
PhantomData<(String, Tensor)>: Freeze,
impl Move for GgufLayout
impl RefUnwindSafe for GgufLayout
impl Send for GgufLayout
impl Sync for GgufLayout
impl Unpin for GgufLayout
impl UnsafeUnpin for GgufLayoutwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<(String, String)>: UnsafeUnpin,
PhantomData<(String, u64)>: UnsafeUnpin,
PhantomData<(String, i64)>: UnsafeUnpin,
PhantomData<(String, f32)>: UnsafeUnpin,
PhantomData<(String, f64)>: UnsafeUnpin,
PhantomData<(String, Tensor)>: UnsafeUnpin,
impl UnwindSafe for GgufLayoutwhere
RawVecInner: UnwindSafe,
HashMap<String, String>: UnwindSafe,
HashMap<String, u64>: UnwindSafe,
HashMap<String, i64>: UnwindSafe,
HashMap<String, f32>: UnwindSafe,
HashMap<String, f64>: UnwindSafe,
HashMap<String, Tensor>: UnwindSafe,
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