PeftAdapterConfig

Struct PeftAdapterConfig 

Source
pub struct PeftAdapterConfig {
    pub r: usize,
    pub lora_alpha: f64,
    pub target_modules: Vec<String>,
    pub target_modules_pattern: Option<String>,
    pub use_rslora: bool,
    pub layers_to_transform: Option<Vec<usize>>,
    pub trainable_token_indices: Vec<u32>,
    pub modules_to_save: Vec<String>,
    pub lora_embedding: bool,
}
Expand description

2026-09-26: The fields of a PEFT adapter_config.json that the engine uses, as validated by parse_peft_adapter_config. lora_dropout, a training-only setting, is ignored.

Fields§

§r: usize

2026-09-26: LoRA rank, greater than 0.

§lora_alpha: f64

2026-09-26: LoRA alpha, finite and positive; the JSON may hold an integer or a float.

§target_modules: Vec<String>

2026-09-26: The target_modules list as written: bare module names or full paths, each validated on its last .-segment. Per-layer matching is the weight loader’s.

§target_modules_pattern: Option<String>

2026-09-26: PEFT’s regex form of target_modules (a JSON string other than all-linear), kept as written and not expanded. It skips the name-level allow-list, but every adapter tensor is still checked by classify_key, which accepts only the projections it names.

§use_rslora: bool

2026-09-26: rsLoRA: scaling is alpha/sqrt(r) instead of alpha/r. The config must state it; an absent key is rejected rather than read as false.

§layers_to_transform: Option<Vec<usize>>

2026-09-26: The layers_to_transform list, if present. Nothing reads it; the weight loader decides which layers receive deltas.

§trainable_token_indices: Vec<u32>

2026-09-26: Token ids for the trainable-token overlay, unique and ascending, from the trainable_token_indices list or the list shared by its embed_tokens and lm_head entries. Empty means no overlay.

§modules_to_save: Vec<String>

2026-09-26: The accepted modules_to_save leaves, embed_tokens and lm_head, sorted and deduplicated. Any other leaf is a REJECT(modules_to_save). Empty means no full-module overlay.

§lora_embedding: bool

2026-09-26: Always false from this parser. Low-rank embedding LoRA (lora_embedding_A/B) is detected from tensor names by the overlay loader, which rejects it.

Implementations§

Source§

impl PeftAdapterConfig

Source

pub fn scaling(&self) -> f32

2026-09-26: The delta scale, y += scaling() * (x @ Aᵀ) @ Bᵀ: alpha/r, or alpha/sqrt(r) with use_rslora.

Trait Implementations§

Source§

impl Clone for PeftAdapterConfig

Source§

fn clone(&self) -> PeftAdapterConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PeftAdapterConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.