Laguna xs dflash support (#41880)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
MeganEFlynn
2026-05-07 13:31:16 -07:00
committed by GitHub
co-authored by Claude Opus 4.6
parent 3af561ec0a
commit 969fbfb4a9
2 changed files with 21 additions and 4 deletions
+1
View File
@@ -1003,6 +1003,7 @@ class SpeculativeConfig:
"kimi_k25",
"minimax_m2",
"gemma4",
"laguna",
]
if (
self.method in ("eagle3", "extract_hidden_states", "dflash")
+20 -4
View File
@@ -39,7 +39,12 @@ from vllm.model_executor.model_loader.weight_utils import (
default_weight_loader,
maybe_remap_kv_scale_name,
)
from vllm.model_executor.models.interfaces import SupportsLoRA, SupportsPP
from vllm.model_executor.models.interfaces import (
EagleModelMixin,
SupportsEagle3,
SupportsLoRA,
SupportsPP,
)
from vllm.model_executor.models.utils import (
AutoWeightsLoader,
PPMissingLayer,
@@ -554,7 +559,7 @@ class LagunaDecoderLayer(nn.Module):
@support_torch_compile
class LagunaModel(nn.Module):
class LagunaModel(nn.Module, EagleModelMixin):
def __init__(self, *, vllm_config: VllmConfig, prefix: str = ""):
super().__init__()
@@ -633,8 +638,17 @@ class LagunaModel(nn.Module):
hidden_states = intermediate_tensors["hidden_states"]
residual = intermediate_tensors["residual"]
for layer in islice(self.layers, self.start_layer, self.end_layer):
aux_hidden_states = self._maybe_add_hidden_state(
[], self.start_layer, hidden_states, residual
)
for layer_idx, layer in enumerate(
islice(self.layers, self.start_layer, self.end_layer),
start=self.start_layer,
):
hidden_states, residual = layer(positions, hidden_states, residual)
self._maybe_add_hidden_state(
aux_hidden_states, layer_idx + 1, hidden_states, residual
)
if not get_pp_group().is_last_rank:
return IntermediateTensors(
@@ -642,6 +656,8 @@ class LagunaModel(nn.Module):
)
hidden_states, _ = self.norm(hidden_states, residual)
if len(aux_hidden_states) > 0:
return hidden_states, aux_hidden_states
return hidden_states
def get_expert_mapping(self) -> list[tuple[str, str, int, str]]:
@@ -821,7 +837,7 @@ class LagunaModel(nn.Module):
return loaded_params
class LagunaForCausalLM(nn.Module, SupportsPP, SupportsLoRA):
class LagunaForCausalLM(nn.Module, SupportsPP, SupportsLoRA, SupportsEagle3):
fall_back_to_pt_during_load = False
packed_modules_mapping = {