Skip to content

vllm_omni.diffusion.lora.manager

logger module-attribute

logger = init_logger(__name__)

DiffusionLoRAManager

Manager for LoRA adapters in diffusion models.

Reuses vLLM's LoRA infrastructure, adapted for diffusion pipelines. Uses LRU cache management similar to LRUCacheLoRAModelManager.

device instance-attribute

device = device

dtype instance-attribute

dtype = dtype

max_cached_adapters instance-attribute

max_cached_adapters = max_cached_adapters

pipeline instance-attribute

pipeline = pipeline

add_adapter

add_adapter(lora_request: LoRARequest) -> bool

Add a new adapter to the cache without activating it.

list_adapters

list_adapters() -> list[int]

Return list of registered adapter ids.

pin_adapter

pin_adapter(adapter_id: int) -> bool

Mark an adapter as pinned so it will not be evicted.

remove_adapter

remove_adapter(adapter_id: int) -> bool

Remove an adapter from the cache.

set_active_adapter

set_active_adapter(
    lora_request: LoRARequest | None,
    lora_scale: float = 1.0,
) -> None

Set the active LoRA adapter for the pipeline.

Parameters:

Name Type Description Default
lora_request LoRARequest | None

The LoRA request, or None to deactivate all adapters.

required
lora_scale float

The external scale for the LoRA adapter.

1.0