Skip to main content

LoraBank

Struct LoraBank 

Source
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

Source

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.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn rank(&self) -> usize

The rank the file was trained at, for the log line.

Source

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.

Source

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.

Source

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 .weightdit.transformer_blocks.0.attn1.to_q.

Source

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.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more