Skip to main content

AdapterHandler

Trait AdapterHandler 

Source
pub trait AdapterHandler {
    // Required methods
    fn handle_load<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        ctx: &'life1 EnvelopeContext,
        request_id: u64,
        model_ref: &'life2 str,
        value: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn handle_unload<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        ctx: &'life1 EnvelopeContext,
        request_id: u64,
        model_ref: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn handle_status<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        ctx: &'life1 EnvelopeContext,
        request_id: u64,
        model_ref: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn handle_inspect<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        ctx: &'life1 EnvelopeContext,
        request_id: u64,
        model_ref: &'life2 str,
        value: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<AdapterInfo>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn handle_merge<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        ctx: &'life1 EnvelopeContext,
        request_id: u64,
        model_ref: &'life2 str,
        data: &'life3 MergeLoraRequest,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
}
Expand description

Generated handler trait for the adapter scope.

Required Methods§

Source

fn handle_load<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, ctx: &'life1 EnvelopeContext, request_id: u64, model_ref: &'life2 str, value: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Load a PEFT adapter from disk into the base_delta register. Applied to all inference until unloaded. Path is relative within the model worktree (e.g. ‘adapters/my-adapter’).

Source

fn handle_unload<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 EnvelopeContext, request_id: u64, model_ref: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Clear the base_delta register, removing the loaded adapter from GPU/CPU memory.

Source

fn handle_status<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 EnvelopeContext, request_id: u64, model_ref: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Check if a LoRA adapter is currently loaded in the base_delta register.

Source

fn handle_inspect<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, ctx: &'life1 EnvelopeContext, request_id: u64, model_ref: &'life2 str, value: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<AdapterInfo>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Validate an on-disk PEFT adapter directory and return its metadata (rank, alpha, target modules, base model). Does not load anything into memory.

Source

fn handle_merge<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, ctx: &'life1 EnvelopeContext, request_id: u64, model_ref: &'life2 str, data: &'life3 MergeLoraRequest, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Read a PEFT adapter from disk and merge it into the currently loaded base_delta register using a configurable merge strategy (replace/additive/do_merge). Requires an adapter already loaded via adapter.load.

Implementors§