ModelAdapters

Trait ModelAdapters 

Source
pub trait ModelAdapters {
    // Provided methods
    fn set_active_lora(&mut self, _name: &str) -> Result<()> { ... }
    fn adapter_id_for(&self, _slot: i32) -> u64 { ... }
    fn acquire_adapter_slot(&self, _slot: i32) -> i32 { ... }
    fn release_adapter_slot(&self, _resolved: i32) { ... }
    fn swap_lora_from_disk(
        &mut self,
        _dir: &Path,
        _name: &str,
        _slot: usize,
    ) -> Result<()> { ... }
    fn promote_lora_from_peer(
        &mut self,
        _peer_addr: &str,
        _adapter_id: &str,
        _name: &str,
        _peft: PeftAdapterConfig,
    ) -> Result<(usize, Option<String>)> { ... }
    fn promote_lora_from_disk(
        &mut self,
        _adapter_dir: &Path,
        _name: &str,
    ) -> Result<(usize, Option<String>)> { ... }
}
Expand description

2026-09-26: LoRA adapters: rotation, slot refs, disk swap and promotion.

Provided Methods§

Source

fn set_active_lora(&mut self, _name: &str) -> Result<()>

2026-09-25: Make the resident LoRA adapter name the active one. Takes &mut self, so it runs only while nothing else holds the model. Default: an error.

Source

fn adapter_id_for(&self, _slot: i32) -> u64

2026-09-25: The prefix-cache adapter id for a LoRA slot selector: >= 0 names a resident slot, -1 the active adapter. Default 0, the base model’s id.

Source

fn acquire_adapter_slot(&self, _slot: i32) -> i32

2026-09-25: Take a ref on the LoRA slot a sequence will use (called at prefill), resolving -1 to the active adapter as Self::adapter_id_for does. Returns the resolved slot, which the caller must pass to Self::release_adapter_slot, or -1 when no ref was taken. Default -1.

Source

fn release_adapter_slot(&self, _resolved: i32)

2026-09-25: Release a ref taken by Self::acquire_adapter_slot, by the slot it returned. Default: no-op.

Source

fn swap_lora_from_disk( &mut self, _dir: &Path, _name: &str, _slot: usize, ) -> Result<()>

2026-09-25: Load the LoRA adapter at dir into pool slot slot. Takes &mut self, so it runs only while nothing else holds the model. Default: an error.

Source

fn promote_lora_from_peer( &mut self, _peer_addr: &str, _adapter_id: &str, _name: &str, _peft: PeftAdapterConfig, ) -> Result<(usize, Option<String>)>

2026-09-25: Fetch the adapter name (staged on peer_addr as adapter_id) from the peer into a pool slot and make it active; returns (slot, evicted adapter name). peft supplies the rank, alpha and scaling. Default: an error.

Source

fn promote_lora_from_disk( &mut self, _adapter_dir: &Path, _name: &str, ) -> Result<(usize, Option<String>)>

2026-09-25: Load the adapter name from adapter_dir into a pool slot and make it active; returns (slot, evicted adapter name). Default: an error.

Implementors§