pub struct StreamingLoader { /* private fields */ }Expand description
Streaming layer loader for memory-efficient loading of large models.
Instead of loading all weights at once, this loader loads one layer at a time, allowing models larger than available RAM to be processed.
Implementations§
Source§impl StreamingLoader
impl StreamingLoader
Sourcepub fn new(path: &Path, config: LoadConfig) -> Result<Self>
pub fn new(path: &Path, config: LoadConfig) -> Result<Self>
Create a new streaming loader.
Sourcepub fn model_config(&self) -> GgufConfig
pub fn model_config(&self) -> GgufConfig
Get model configuration.
Sourcepub fn total_layers(&self) -> usize
pub fn total_layers(&self) -> usize
Get total number of layers.
Sourcepub fn current_layer(&self) -> usize
pub fn current_layer(&self) -> usize
Get current layer index.
Sourcepub fn has_more_layers(&self) -> bool
pub fn has_more_layers(&self) -> bool
Check if there are more layers to load.
Sourcepub fn load_embeddings(&self) -> Result<Vec<LoadedTensor>>
pub fn load_embeddings(&self) -> Result<Vec<LoadedTensor>>
Load embedding and pre-layer normalization tensors.
Sourcepub fn load_next_layer(&mut self) -> Result<Option<Vec<LoadedTensor>>>
pub fn load_next_layer(&mut self) -> Result<Option<Vec<LoadedTensor>>>
Load the next layer’s tensors.
Sourcepub fn load_output_head(&self) -> Result<Vec<LoadedTensor>>
pub fn load_output_head(&self) -> Result<Vec<LoadedTensor>>
Load final normalization and output head tensors.
Auto Trait Implementations§
impl !Freeze for StreamingLoader
impl !RefUnwindSafe for StreamingLoader
impl Send for StreamingLoader
impl Sync for StreamingLoader
impl Unpin for StreamingLoader
impl !UnwindSafe for StreamingLoader
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