pub struct LoRALinear { /* private fields */ }Expand description
LoRA layer wrapping a linear layer
Implementations§
Source§impl LoRALinear
impl LoRALinear
Sourcepub fn new(in_features: usize, out_features: usize, config: LoRAConfig) -> Self
pub fn new(in_features: usize, out_features: usize, config: LoRAConfig) -> Self
Create new LoRA linear layer
Sourcepub fn merge_weights(&mut self)
pub fn merge_weights(&mut self)
Merge LoRA weights into base layer
Sourcepub fn unmerge_weights(&mut self)
pub fn unmerge_weights(&mut self)
Unmerge LoRA weights from base layer
Sourcepub fn lora_parameters(&self) -> Vec<Tensor>
pub fn lora_parameters(&self) -> Vec<Tensor>
Get LoRA parameters (only these are trainable)
Auto Trait Implementations§
impl Freeze for LoRALinear
impl !RefUnwindSafe for LoRALinear
impl Send for LoRALinear
impl Sync for LoRALinear
impl Unpin for LoRALinear
impl !UnwindSafe for LoRALinear
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