pub struct LargeModelOptimizer { /* private fields */ }Expand description
Large model optimization manager
Implementations§
Source§impl LargeModelOptimizer
impl LargeModelOptimizer
Sourcepub fn new(config: LargeModelConfig) -> Self
pub fn new(config: LargeModelConfig) -> Self
Create a new large model optimizer
Sourcepub fn analyze_model(
&self,
total_layers: usize,
parameters_per_layer: usize,
) -> Result<ModelExecutionPlan>
pub fn analyze_model( &self, total_layers: usize, parameters_per_layer: usize, ) -> Result<ModelExecutionPlan>
Analyze model and create memory-optimized execution plan
Sourcepub fn create_checkpoint(
&self,
layer_index: usize,
activations: Vec<Box<dyn Any + Send + Sync>>,
) -> Result<()>
pub fn create_checkpoint( &self, layer_index: usize, activations: Vec<Box<dyn Any + Send + Sync>>, ) -> Result<()>
Create gradient checkpoint
Sourcepub fn offload_parameter(
&self,
name: &str,
data: &[u8],
shape: Vec<usize>,
dtype: DType,
) -> Result<()>
pub fn offload_parameter( &self, name: &str, data: &[u8], shape: Vec<usize>, dtype: DType, ) -> Result<()>
Offload parameter to CPU memory
Sourcepub fn get_optimization_stats(&self) -> MemoryOptimizationStats
pub fn get_optimization_stats(&self) -> MemoryOptimizationStats
Get optimization statistics
Sourcepub fn generate_optimization_report(&self) -> LargeModelOptimizationReport
pub fn generate_optimization_report(&self) -> LargeModelOptimizationReport
Generate optimization report
Auto Trait Implementations§
impl !Freeze for LargeModelOptimizer
impl RefUnwindSafe for LargeModelOptimizer
impl Send for LargeModelOptimizer
impl Sync for LargeModelOptimizer
impl Unpin for LargeModelOptimizer
impl UnsafeUnpin for LargeModelOptimizer
impl UnwindSafe for LargeModelOptimizer
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> 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