pub struct LoadedLora {
pub adapters: HashMap<String, Arc<LoraAdapter>>,
pub rank: usize,
pub alpha: f32,
}Expand description
A fully loaded LoRA adapter, mapping tensor base names to their adapters.
The key in adapters is the tensor base name without the
.lora_a / .lora_b suffix (e.g. "blk.0.attn_q.weight").
After loading, attach adapters to QuantLinear layers via
LoadedLora::get + QuantLinear::set_lora.
Fields§
§adapters: HashMap<String, Arc<LoraAdapter>>Map from tensor base name → LoRA adapter.
rank: usizeThe LoRA rank used throughout this adapter file.
alpha: f32The alpha value (scale numerator).
Implementations§
Source§impl LoadedLora
impl LoadedLora
Sourcepub fn load(path: &str) -> Result<LoadedLora, ArchError>
pub fn load(path: &str) -> Result<LoadedLora, ArchError>
Load a LoRA adapter from a GGUF file on disk.
§Errors
Returns ArchError::Gguf if the file cannot be parsed, or
ArchError::Quant if dequantization of any adapter tensor fails.
Sourcepub fn from_gguf(model: &GgufModel) -> Result<LoadedLora, ArchError>
pub fn from_gguf(model: &GgufModel) -> Result<LoadedLora, ArchError>
Load a LoRA adapter from an already-loaded GgufModel.
This is the primary construction path, separated from file I/O for testability.
Sourcepub fn get(&self, tensor_name: &str) -> Option<Arc<LoraAdapter>>
pub fn get(&self, tensor_name: &str) -> Option<Arc<LoraAdapter>>
Look up the adapter for a named linear weight tensor.
Returns None if this LoRA file does not patch the named tensor.
Sourcepub fn num_adapters(&self) -> usize
pub fn num_adapters(&self) -> usize
Number of adapted layers in this adapter file.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LoadedLora
impl RefUnwindSafe for LoadedLora
impl Send for LoadedLora
impl Sync for LoadedLora
impl Unpin for LoadedLora
impl UnsafeUnpin for LoadedLora
impl UnwindSafe for LoadedLora
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
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>
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>
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