pub struct GgufFileSource { /* private fields */ }Expand description
WeightSource backed by a GGUF file, using seek-based lazy tensor loading.
Each call to load_tensor seeks to the tensor’s
data region, reads only the required bytes, and dequantizes them. This means
only one tensor’s worth of raw data is in memory at a time.
Implementations§
Source§impl GgufFileSource
impl GgufFileSource
Sourcepub fn open(path: &Path) -> ModelResult<Self>
pub fn open(path: &Path) -> ModelResult<Self>
Open a GGUF file and parse its header + tensor index.
The file is kept open after construction for subsequent lazy reads.
Trait Implementations§
Source§impl WeightSource for GgufFileSource
impl WeightSource for GgufFileSource
Source§fn tensor_names(&self) -> Vec<String>
fn tensor_names(&self) -> Vec<String>
Return the names of all tensors available in this source.
Source§fn load_tensor(&mut self, name: &str) -> ModelResult<Vec<f32>>
fn load_tensor(&mut self, name: &str) -> ModelResult<Vec<f32>>
Source§fn contains(&self, name: &str) -> bool
fn contains(&self, name: &str) -> bool
Return
true if the source contains a tensor with the given name.Source§fn total_bytes_estimate(&self) -> u64
fn total_bytes_estimate(&self) -> u64
Return a rough estimate of the total number of bytes occupied by all
tensor data in the underlying file (used for progress reporting).
Auto Trait Implementations§
impl Freeze for GgufFileSource
impl RefUnwindSafe for GgufFileSource
impl Send for GgufFileSource
impl Sync for GgufFileSource
impl Unpin for GgufFileSource
impl UnsafeUnpin for GgufFileSource
impl UnwindSafe for GgufFileSource
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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