load_lora_adapters_multi

Function load_lora_adapters_multi 

Source
pub fn load_lora_adapters_multi(
    adapters: &[LoraAdapterInput<'_>],
    cfg: &ModelConfig,
    gpu: &dyn GpuBackend,
    max_loras: usize,
    max_lora_rank: usize,
) -> Result<LoraWeights>
Expand description

Model-agnostic MULTI-adapter PEFT load: audit every adapter, VRAM-preflight the N-slot pool, pack each adapter into its slot (0..N-1), and build the per-module [max_loras] pointer tables (index k filled per packed slot, rest NULL). One resident adapter is byte-identical to the single-adapter path (slot 0, off starts at 0).

Called (via the ModelWeightLoader::load_lora_adapters hook) from build_model BEFORE BufferArena::new and the free-memory snapshot, so the pool bytes land in used_so_far and the KV budget shrinks automatically. Do NOT move the call later.