pub struct ModelMerger { /* private fields */ }Expand description
Model merger for combining multiple models
Implementations§
Source§impl ModelMerger
impl ModelMerger
Sourcepub fn with_weights(weights: Vec<f32>) -> ModelResult<Self>
pub fn with_weights(weights: Vec<f32>) -> ModelResult<Self>
Create merger with weighted averaging
Sourcepub fn with_ema(alpha: f32) -> ModelResult<Self>
pub fn with_ema(alpha: f32) -> ModelResult<Self>
Create merger with exponential moving average
Sourcepub fn with_slerp(t: f32) -> ModelResult<Self>
pub fn with_slerp(t: f32) -> ModelResult<Self>
Create merger with SLERP
Sourcepub fn with_task_arithmetic(base_model: &dyn Module) -> Self
pub fn with_task_arithmetic(base_model: &dyn Module) -> Self
Create merger with task arithmetic
Sourcepub fn set_strategy(&mut self, strategy: MergeStrategy)
pub fn set_strategy(&mut self, strategy: MergeStrategy)
Set merging strategy
Sourcepub fn merge_models(
&self,
models: &[&dyn Module],
) -> ModelResult<HashMap<String, Parameter>>
pub fn merge_models( &self, models: &[&dyn Module], ) -> ModelResult<HashMap<String, Parameter>>
Merge multiple models into one
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ModelMerger
impl !RefUnwindSafe for ModelMerger
impl Send for ModelMerger
impl Sync for ModelMerger
impl Unpin for ModelMerger
impl UnsafeUnpin for ModelMerger
impl !UnwindSafe for ModelMerger
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