pub struct GgufTensorIndex {
pub tensor_data_start: u64,
pub hyperparams: GgufHyperparams,
pub max_tensor_bytes: usize,
pub max_layer_tensor_bytes: usize,
/* private fields */
}Expand description
Lookup table from tensor-name hash → GgufTensorInfo, built by walking the
GGUF tensor-info section that immediately follows the KV metadata section.
Fields§
§tensor_data_start: u64Absolute byte offset in the mmap where tensor payload data begins.
hyperparams: GgufHyperparams§max_tensor_bytes: usizeLargest tensor payload in the file (informational).
max_layer_tensor_bytes: usizeLargest layer matmul tensor (attn/ffn weights) — sizes reusable GPU staging.
Implementations§
Source§impl GgufTensorIndex
impl GgufTensorIndex
pub fn from_gguf(mmap: &[u8]) -> Self
Sourcepub fn from_components(
named_tensors: &[(&[u8], GgufTensorInfo)],
hyperparams: GgufHyperparams,
tensor_data_start: u64,
) -> Self
pub fn from_components( named_tensors: &[(&[u8], GgufTensorInfo)], hyperparams: GgufHyperparams, tensor_data_start: u64, ) -> Self
Build a synthetic index from an explicit (name, info) list — used to boot from a P64
weight container so the entire GGUF-based hot path (get_layer_tensors / fetch_tensor_bytes /
resident upload) works unchanged. The caller passes absolute blob offsets in each
GgufTensorInfo.byte_offset and tensor_data_start = 0, pointing the byte source at the
P64 bytes. Format-agnostic: the hot path never learns it is reading P64.
Sourcepub fn get_layer_tensors(&self, layer_idx: u32) -> LayerTensors
pub fn get_layer_tensors(&self, layer_idx: u32) -> LayerTensors
Retrieve attention + FFN tensor metadata for one transformer block.
pub fn output_norm_info(&self) -> Option<&GgufTensorInfo>
pub fn output_weight_info(&self) -> Option<&GgufTensorInfo>
Sourcepub fn output_weights_tied(&self) -> bool
pub fn output_weights_tied(&self) -> bool
True when output.weight is absent and logits use tied token_embd.weight.
Sourcepub fn logits_projection_info(&self) -> Option<&GgufTensorInfo>
pub fn logits_projection_info(&self) -> Option<&GgufTensorInfo>
Output projection weights: output.weight when present, else tied token_embd.weight.
Sourcepub fn weight_tie_probe(&self) -> (bool, u64, u64, [u64; 4], [u64; 4])
pub fn weight_tie_probe(&self) -> (bool, u64, u64, [u64; 4], [u64; 4])
Diagnostic: byte offset + dims for tied-weight validation (MC3g).
Sourcepub fn token_embd_info(&self) -> Option<&GgufTensorInfo>
pub fn token_embd_info(&self) -> Option<&GgufTensorInfo>
Cached token_embd.weight tensor metadata.
Sourcepub fn emb_dim(&self) -> usize
pub fn emb_dim(&self) -> usize
Return the embedding dimension (n_embd) from token_embd.weight, or 0 if unknown.
Sourcepub fn vocab_dim(&self) -> usize
pub fn vocab_dim(&self) -> usize
Vocabulary size from token_embd.weight shape [n_embd, n_vocab].
Trait Implementations§
Source§impl Clone for GgufTensorIndex
impl Clone for GgufTensorIndex
Source§fn clone(&self) -> GgufTensorIndex
fn clone(&self) -> GgufTensorIndex
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for GgufTensorIndex
impl RefUnwindSafe for GgufTensorIndex
impl Send for GgufTensorIndex
impl Sync for GgufTensorIndex
impl Unpin for GgufTensorIndex
impl UnsafeUnpin for GgufTensorIndex
impl UnwindSafe for GgufTensorIndex
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
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> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more