pub struct AdapterStack {
pub adapters: Vec<AdapterRef>,
}Expand description
Adapter composition: apply multiple LoRA adapters in sequence.
Allows stacking several adapters with independent blending weights. Weights can be normalized so they sum to 1.0, which is useful for even blending across adapters.
Fields§
§adapters: Vec<AdapterRef>The ordered list of adapters to apply.
Implementations§
Source§impl AdapterStack
impl AdapterStack
Sourcepub fn add(self, name: impl Into<String>, weight: f32) -> Self
pub fn add(self, name: impl Into<String>, weight: f32) -> Self
Add an adapter with the given blending weight.
Sourcepub fn total_weight(&self) -> f32
pub fn total_weight(&self) -> f32
Sum of all adapter weights.
Sourcepub fn normalize_weights(&mut self)
pub fn normalize_weights(&mut self)
Normalize weights so they sum to 1.0.
If the total weight is zero (or very close to it), weights are left unchanged to avoid division by zero.
Trait Implementations§
Source§impl Clone for AdapterStack
impl Clone for AdapterStack
Source§fn clone(&self) -> AdapterStack
fn clone(&self) -> AdapterStack
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AdapterStack
impl Debug for AdapterStack
Auto Trait Implementations§
impl Freeze for AdapterStack
impl RefUnwindSafe for AdapterStack
impl Send for AdapterStack
impl Sync for AdapterStack
impl Unpin for AdapterStack
impl UnsafeUnpin for AdapterStack
impl UnwindSafe for AdapterStack
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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