Skip to content

vllm.v1.worker.gpu.lora_utils

LoRA utilities for the Model Runner V2 and cudagraph.

Functions:

create_lora_capture_hook(lora_config, runner)

Create a hook to set up LoRA state before each cudagraph capture.

get_lora_capture_cases(lora_config, compilation_config)

Return num_active_loras values for cudagraph capture.

When cudagraph_specialize_lora=True: powers of 2 up to max_loras, plus max_loras+1. When False: [0, max_loras+1]. When LoRA disabled: [0].

get_num_active_loras_for_dispatch(lora_config, lora_state, req_ids, dummy_run)

Compute num_active_loras for cudagraph dispatch.

Counts no-LoRA requests as one more active LoRA when they share the batch with adapters, as the LoRA kernels do.