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
Parsed subset of a PEFT adapter_config.json that Atlas consumes.
lora_dropout is intentionally ignored (train-time only, inference
no-op). Everything else PEFT can emit that would change inference
output is validated in parse_peft_adapter_config and rejected by
name if unsupported.
Fields§
§r: usizeLoRA rank. Must be > 0.
lora_alpha: f64LoRA alpha. PEFT serializes int or float; both accepted.
target_modules: Vec<String>Verbatim target_modules entries (bare module names, or full paths
which are validated on their final .-segment). The weight loader’s
bidirectional audit is the authority on actual per-layer matching.
target_modules_pattern: Option<String>PEFT’s REGEX form of target_modules (a JSON string rather than a
list) — e.g. Dxniz/Novelist1.0-27b-Adapter, whose pattern matches
q|k|v|o_proj and gate|up|down_proj under several possible
parent-module spellings.
Held verbatim and NOT expanded: expanding it would mean resolving a
Python-flavoured regex against a module tree this layer cannot see.
It does not need to be. The adapter’s own TENSOR NAMES are ground
truth for what it targets, and every one of them still goes through
classify_key, which is strictly stricter than the name-level
allow-list a pattern bypasses. A pattern therefore DEFERS module
validation to the per-tensor gate rather than skipping it.
use_rslora: boolrsLoRA flag: switches scaling from alpha/r to alpha/sqrt(r).
Hard-required in the on-disk config (never defaulted — a wrong scale
is silent quality loss).
layers_to_transform: Option<Vec<usize>>Informational: the layers_to_transform restriction if present.
The weight loader’s per-LayerType gate is the real authority on
which layers receive deltas; this is kept only for the startup log.
trainable_token_indices: Vec<u32>Vocab-extension / trainable-token ids for the token overlay
(Feature 2). Unique ascending order from the config’s
trainable_token_indices list, or the common order declared for
embed_tokens and lm_head. Empty ⇒ no trainable_tokens overlay.
modules_to_save: Vec<String>Accepted modules_to_save leaves — the subset Atlas can apply as a
token overlay (embed_tokens / lm_head full-row replacement).
Anything else is still a hard REJECT(modules_to_save). Empty ⇒
no full-module overlay.
lora_embedding: boolClassic low-rank embedding LoRA (lora_embedding_A/B) present.
Tier-2: parse-accepted here so the adapter is not silently dropped,
but the loader rejects it until the embedding-LoRA kernel lands.
Reserved — always false today (detection is at the tensor level).
Implementations§
Trait Implementations§
Source§impl Clone for PeftAdapterConfig
impl Clone for PeftAdapterConfig
Source§fn clone(&self) -> PeftAdapterConfig
fn clone(&self) -> PeftAdapterConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more