pub struct QLoraMapper { /* private fields */ }Expand description
A module mapper implementing QLoRA: it quantizes the (frozen) base weights and attaches full-precision trainable LoRA adapters to 2-D weights.
The quantized base is kept at rest in its low-bit representation; the adapter contribution is added on top during the forward pass (the base is dequantized on the fly when composed).
Implementations§
Source§impl QLoraMapper
impl QLoraMapper
Sourcepub fn new(config: LoraConfig, quantizer: Quantizer) -> Self
pub fn new(config: LoraConfig, quantizer: Quantizer) -> Self
Create a new QLoRA mapper from the LoRA configuration and a quantizer.
Trait Implementations§
Source§impl ModuleMapper for QLoraMapper
impl ModuleMapper for QLoraMapper
Source§fn map_float<const D: usize>(
&mut self,
param: Param<Tensor<D>>,
) -> Param<Tensor<D>>
fn map_float<const D: usize>( &mut self, param: Param<Tensor<D>>, ) -> Param<Tensor<D>>
Map a float parameter in the module. Read more
Source§fn enter_module(&mut self, name: &str, container_type: &str)
fn enter_module(&mut self, name: &str, container_type: &str)
Called when entering a submodule. Read more
Source§fn exit_module(&mut self, name: &str, container_type: &str)
fn exit_module(&mut self, name: &str, container_type: &str)
Called when exiting a submodule. Read more
Auto Trait Implementations§
impl Freeze for QLoraMapper
impl RefUnwindSafe for QLoraMapper
impl Send for QLoraMapper
impl Sync for QLoraMapper
impl Unpin for QLoraMapper
impl UnsafeUnpin for QLoraMapper
impl UnwindSafe for QLoraMapper
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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