pub struct LoraBank {
pub slot: Option<SlotEmbed>,
pub meta: HashMap<String, String>,
/* private fields */
}Expand description
Every branch an adapter file carries, keyed by the projection it belongs
to — the container’s name with the dit. prefix dropped, which is what
the adapters use after their own diffusion_model..
Fields§
§slot: Option<SlotEmbed>§meta: HashMap<String, String>Implementations§
Source§impl LoraBank
impl LoraBank
Sourcepub fn load(path: &Path, strength: f32) -> Result<LoraBank, String>
pub fn load(path: &Path, strength: f32) -> Result<LoraBank, String>
Read an adapter. scale multiplies every branch — the strength dial.
alpha is honoured when the file records it: the trained convention is
scale = strength · alpha / rank, and an adapter that ships neither
alpha nor lora_alpha is taken at strength as-is, which is what
the diffusers loaders do for a file whose A/B are already scaled.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn keys(&self) -> Vec<&str>
pub fn keys(&self) -> Vec<&str>
Every projection this adapter names. The caller binds what its container has and reports the rest: an adapter that trained a module we fold away (adaLN, on a curve-form pack) must say so rather than render as though it had been applied.
Sourcepub fn branch_for(
&self,
name: &str,
out: usize,
inn: usize,
) -> Result<Option<LoraBranch>, String>
pub fn branch_for( &self, name: &str, out: usize, inn: usize, ) -> Result<Option<LoraBranch>, String>
The branch for a projection of a KNOWN shape. A branch whose matrices
do not match the panel it will be handed belongs to another model —
add writes n·out floats through a raw pointer, so a mismatch is a
buffer overrun, not a bad picture. Refuse it by name instead.
Sourcepub fn branch(&self, name: &str) -> Option<LoraBranch>
pub fn branch(&self, name: &str) -> Option<LoraBranch>
The branch for a container tensor name, if this adapter carries one.
name is the projection without .weight — dit.transformer_blocks.0.attn1.to_q.
Sourcepub fn check_reference_convention(&self) -> Result<(), String>
pub fn check_reference_convention(&self) -> Result<(), String>
How the adapter wants reference tokens placed. Both are refused rather than approximated when they are not what this implementation does.