pub struct LoraAdapterManager { /* private fields */ }Expand description
Manager for multiple LoRA adapters
Implementations§
Source§impl LoraAdapterManager
impl LoraAdapterManager
Sourcepub fn new(config: LoraConfig) -> Self
pub fn new(config: LoraConfig) -> Self
Create a new adapter manager
Sourcepub fn register_adapter(&mut self, adapter: LoraAdapter)
pub fn register_adapter(&mut self, adapter: LoraAdapter)
Register a new adapter
Sourcepub fn activate(&mut self, name: impl AsRef<str>) -> InferenceResult<()>
pub fn activate(&mut self, name: impl AsRef<str>) -> InferenceResult<()>
Activate an adapter by name
Sourcepub fn deactivate(&mut self)
pub fn deactivate(&mut self)
Deactivate the current adapter
Sourcepub fn active_adapter(&self) -> Option<&LoraAdapter>
pub fn active_adapter(&self) -> Option<&LoraAdapter>
Get the active adapter
Sourcepub fn apply(&self, input: &Array1<f32>) -> InferenceResult<Array1<f32>>
pub fn apply(&self, input: &Array1<f32>) -> InferenceResult<Array1<f32>>
Apply the active adapter (if any) to input
Sourcepub fn apply_batch(&self, inputs: &Array2<f32>) -> InferenceResult<Array2<f32>>
pub fn apply_batch(&self, inputs: &Array2<f32>) -> InferenceResult<Array2<f32>>
Apply the active adapter to a batch
Sourcepub fn list_adapters(&self) -> Vec<&String>
pub fn list_adapters(&self) -> Vec<&String>
List all registered adapters
Sourcepub fn get_adapter(&self, name: impl AsRef<str>) -> Option<&LoraAdapter>
pub fn get_adapter(&self, name: impl AsRef<str>) -> Option<&LoraAdapter>
Get adapter by name
Sourcepub fn remove_adapter(&mut self, name: impl AsRef<str>) -> Option<LoraAdapter>
pub fn remove_adapter(&mut self, name: impl AsRef<str>) -> Option<LoraAdapter>
Remove an adapter
Sourcepub fn config(&self) -> &LoraConfig
pub fn config(&self) -> &LoraConfig
Get configuration
Auto Trait Implementations§
impl Freeze for LoraAdapterManager
impl RefUnwindSafe for LoraAdapterManager
impl Send for LoraAdapterManager
impl Sync for LoraAdapterManager
impl Unpin for LoraAdapterManager
impl UnwindSafe for LoraAdapterManager
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