[Feature] Support MiniMax-H3 Turbo LoRA with DLO (#6550)

Signed-off-by: mglyn <1203789601@qq.com>
Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
Mu GuanLinandHongsheng Liu authored and GitHub committed 2026-08-26 16:15:47 +08:00
1 parent 7439ed41c2
commit 59cf3add40
7 files changed
+124 -9

No files matched your search

+17 -1
View File
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
from __future__ import annotations
@@ -22,6 +22,19 @@ class DiffusionBaseLinearLayerWithLoRA(BaseLinearLayerWithLoRA):
is inherited from vLLM's BaseLinearLayerWithLoRA.
"""
lora_a_stacked: tuple[torch.Tensor, ...]
lora_b_stacked: tuple[torch.Tensor, ...]
def _move_lora_buffers(self, device: torch.device) -> None:
self.lora_a_stacked = tuple(tensor.to(device=device) for tensor in self.lora_a_stacked)
self.lora_b_stacked = tuple(tensor.to(device=device) for tensor in self.lora_b_stacked)
def _set_diffusion_lora_buffer_device(self, device: torch.device) -> None:
"""Keep dynamic LoRA sidecars resident on the compute device."""
self._diffusion_lora_buffer_device = device
self._move_lora_buffers(device)
def create_lora_weights(
self,
max_loras: int,
@@ -29,6 +42,9 @@ class DiffusionBaseLinearLayerWithLoRA(BaseLinearLayerWithLoRA):
model_config=None,
) -> None:
super().create_lora_weights(max_loras, lora_config, model_config)
buffer_device = getattr(self, "_diffusion_lora_buffer_device", None)
if buffer_device is not None:
self._move_lora_buffers(buffer_device)
# Keep a direct reference for attribute forwarding: `base_layer` is a
# registered submodule (stored under `_modules`), so direct access via
# `object.__getattribute__` will not find it. We stash a ref in
+13
View File
@@ -68,6 +68,12 @@ class DiffusionLoRAManager:
self.pipeline = pipeline
self.device = device
self.dtype = dtype
od_config = getattr(pipeline, "od_config", None)
# DLO owns the base-weight lifecycle. Keep request-switchable LoRA
# sidecars resident instead of rebuilding DLO host shards per request.
self._resident_lora_device = (
device if getattr(od_config, "enable_distributed_layerwise_offload", False) is True else None
)
# Cache supported/expected module suffixes once, before any layer
# replacement happens. After LoRA layers are injected, the original
@@ -450,6 +456,13 @@ class DiffusionLoRAManager:
)
if lora_layer is not module and isinstance(lora_layer, BaseLayerWithLoRA):
if self._resident_lora_device is not None:
set_buffer_device = getattr(lora_layer, "_set_diffusion_lora_buffer_device", None)
if not callable(set_buffer_device):
raise RuntimeError(
f"{type(lora_layer).__name__} cannot keep dynamic LoRA buffers resident for DLO"
)
set_buffer_device(self._resident_lora_device)
replace_submodule(component, module_name, lora_layer)
self._lora_modules[full_module_name] = lora_layer
logger.debug("Replaced layer: %s -> %s", full_module_name, type(lora_layer).__name__)
@@ -724,8 +724,6 @@ class MiniMaxH3Pipeline(
offload_modes.append("model-level CPU offload (--enable-cpu-offload)")
if getattr(od_config, "enable_layerwise_offload", False):
offload_modes.append("layerwise offload (--enable-layerwise-offload)")
if getattr(od_config, "enable_distributed_layerwise_offload", False):
offload_modes.append("distributed layerwise offload (--enable-distributed-layerwise-offload)")
loaded = load_minimax_h3_turbo_lora(
partition=self.partition,
lora_request=lora_request,