pub struct StreamingLoader { /* private fields */ }Expand description
Streaming weight loader for models that don’t fit in memory
Implementations§
Source§impl StreamingLoader
impl StreamingLoader
pub fn new( config: WeightLoadingConfig, model_path: PathBuf, chunk_size: usize, max_memory_mb: usize, ) -> Self
Sourcepub fn initialize(&mut self) -> Result<()>
pub fn initialize(&mut self) -> Result<()>
Initialize the streaming loader by analyzing the model structure
pub fn load_chunk(&mut self, chunk_id: usize) -> Result<()>
pub fn evict_chunk(&mut self, chunk_id: usize) -> Result<()>
pub fn get_memory_usage(&self) -> usize
Sourcepub fn get_memory_usage_percentage(&self) -> f32
pub fn get_memory_usage_percentage(&self) -> f32
Get memory usage as a percentage of maximum allowed
Sourcepub fn get_memory_stats(&self) -> MemoryStats
pub fn get_memory_stats(&self) -> MemoryStats
Get detailed memory statistics
pub fn is_chunk_loaded(&self, chunk_id: usize) -> bool
Sourcepub fn get_chunk_info(&self) -> Vec<ChunkInfo>
pub fn get_chunk_info(&self) -> Vec<ChunkInfo>
Get information about all chunks
Sourcepub fn garbage_collect(&mut self) -> Result<()>
pub fn garbage_collect(&mut self) -> Result<()>
Force garbage collection of unused tensors
Source§impl StreamingLoader
Additional methods for streaming-specific functionality
impl StreamingLoader
Additional methods for streaming-specific functionality
Sourcepub fn list_loaded_tensors(&self) -> Vec<String>
pub fn list_loaded_tensors(&self) -> Vec<String>
List only currently loaded tensors
Trait Implementations§
Source§impl WeightLoader for StreamingLoader
impl WeightLoader for StreamingLoader
Auto Trait Implementations§
impl Freeze for StreamingLoader
impl RefUnwindSafe for StreamingLoader
impl Send for StreamingLoader
impl Sync for StreamingLoader
impl Unpin for StreamingLoader
impl UnsafeUnpin 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