pub struct QLoraLayer { /* private fields */ }Expand description
QLoRA adapter wrapping a model’s linear layers.
Implementations§
Source§impl QLoraLayer
impl QLoraLayer
Sourcepub fn new(linear: QuantizedLinear) -> QLoraLayer
pub fn new(linear: QuantizedLinear) -> QLoraLayer
Create a new QLoRA layer.
Sourcepub fn quantized_weight(&self) -> &QuantizedTensor
pub fn quantized_weight(&self) -> &QuantizedTensor
Get a reference to the quantized base weight tensor.
Sourcepub fn lora_weights(&self) -> (&Tensor, &Tensor)
pub fn lora_weights(&self) -> (&Tensor, &Tensor)
Get the LoRA A and B weight tensors.
Returns (lora_a, lora_b) where:
lora_ahas shape[r, in_features]lora_bhas shape[out_features, r]
Sourcepub fn lora_scale(&self) -> f64
pub fn lora_scale(&self) -> f64
Get the LoRA scaling factor (alpha / rank).
Sourcepub fn config(&self) -> &QLoraConfig
pub fn config(&self) -> &QLoraConfig
Get the quantization configuration.
Auto Trait Implementations§
impl Freeze for QLoraLayer
impl !RefUnwindSafe for QLoraLayer
impl Send for QLoraLayer
impl Sync for QLoraLayer
impl Unpin for QLoraLayer
impl !UnwindSafe for QLoraLayer
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