[CI] Bump Transformers version to 5.17.0 (#56108)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>

Harry Mellor committed Sep 16, 2026 at 14:34 UTC ec4a3a537068db40afbc9374a67da719c8c9b964
17 files changed +148 -171
requirements/test/cpu.txt
+1 -1
@@ -1174,7 +1174,7 @@ tqdm==4.67.3
1174 # segmentation-models-pytorch
1175 # sentence-transformers
1176 # transformers
1177 -transformers==5.16.1
1177 +transformers==5.17.0
1178 # via
1179 # -r requirements/test/../common.txt
1180 # -r requirements/test/cuda.in
requirements/test/cuda.in
+1 -1
@@ -39,7 +39,7 @@ open_clip_torch==2.32.0 # Required for nemotron_vl test, Nemotron Parse in test_
39 datamodel_code_generator # required for minicpm3 test
40 lm-eval[api]>=0.4.12 # required for model evaluation test
41 mteb[bm25s]>=2, <3 # required for mteb test
42 -transformers==5.16.1
42 +transformers==5.17.0
43 schemathesis>=4.0.0 # Required for openai schema test.
44 # quantization
45 buildkite-test-collector==0.1.9
requirements/test/cuda.txt
+1 -1
@@ -1281,7 +1281,7 @@ tqdm==4.67.3
1281 # segmentation-models-pytorch
1282 # sentence-transformers
1283 # transformers
1284 -transformers==5.16.1
1284 +transformers==5.17.0
1285 # via
1286 # -c requirements/common.txt
1287 # -r requirements/test/../common.txt
requirements/test/nightly-torch.txt
+1 -1
@@ -29,7 +29,7 @@ opencv-python-headless >= 4.13.0 # required for video test
29 datamodel_code_generator # required for minicpm3 test
30 lm-eval[api]>=0.4.12 # required for model evaluation test
31 mteb[bm25s]>=2, <3 # required for mteb test
32 -transformers==5.16.1
32 +transformers==5.17.0
33 schemathesis>=4.0.0 # Required for openai schema test.
34 # quantization
35 buildkite-test-collector==0.1.9
requirements/test/rocm.in
+1 -1
@@ -35,7 +35,7 @@ open_clip_torch==2.32.0 # Required for nemotron_vl test, Nemotron Parse in test_
35 datamodel_code_generator # required for minicpm3 test
36 lm-eval[api]>=0.4.12 # required for model evaluation test
37 mteb[bm25s]>=2, <3 # required for mteb test
38 -transformers==5.16.1
38 +transformers==5.17.0
39 schemathesis>=4.0.0 # Required for openai schema test
40 # quantization
41 bitsandbytes==0.50.0
requirements/test/rocm.txt
+1 -1
@@ -1233,7 +1233,7 @@ tqdm==4.67.3
1233 # sentence-transformers
1234 # tilelang
1235 # transformers
1236 -transformers==5.16.1
1236 +transformers==5.17.0
1237 # via
1238 # -c requirements/common.txt
1239 # -r requirements/test/../common.txt
requirements/test/xpu.in
+1 -1
@@ -19,7 +19,7 @@ lm_eval[api]>=0.4.12
19 modelscope<1.38
20 runai-model-streamer[s3,gcs,azure]>=0.15.7
21 tensorizer==2.10.1
22 -transformers==5.16.1
22 +transformers==5.17.0
23
24 # --- Audio Processing ---
25 av
requirements/test/xpu.txt
+1 -1
@@ -1081,7 +1081,7 @@ tqdm==4.70.0
1081 # pqdm
1082 # sentence-transformers
1083 # transformers
1084 -transformers==5.16.1
1084 +transformers==5.17.0
1085 # via
1086 # -c requirements/common.txt
1087 # -r requirements/test/../common.txt
vllm/model_executor/models/laguna.py
+16 -11
@@ -54,8 +54,19 @@ from vllm.sequence import IntermediateTensors
54 logger = init_logger(__name__)
55
56
57 +def get_mlp_layer_types(config) -> list[str]:
58 + """Return which layers are MoE, rejecting configs predating Transformers support."""
59 + mlp_layer_types = getattr(config, "mlp_layer_types", None)
60 + if mlp_layer_types is None:
61 + raise ValueError(
62 + "Laguna requires the `LagunaConfig` from Transformers, which is "
63 + "available from v5.17.0. Please update Transformers to run this model."
64 + )
65 + return mlp_layer_types
66 +
67 +
68 class LagunaMLP(nn.Module):
58 - """Dense MLP for Laguna (used in mlp_only_layers)."""
69 + """Dense MLP for Laguna."""
70
71 def __init__(
72 self,
@@ -206,7 +217,7 @@ class LagunaMoE(nn.Module):
217 top_k=config.num_experts_per_tok,
218 hidden_size=config.hidden_size,
219 intermediate_size=config.moe_intermediate_size,
209 - renormalize=config.norm_topk_prob,
220 + renormalize=True,
221 quant_config=quant_config,
222 prefix=f"{prefix}.experts",
223 scoring_func="sigmoid",
@@ -293,13 +304,12 @@ class LagunaAttention(nn.Module):
304 else:
305 self.sliding_window = None
306
296 - # QKV projection (no bias for Laguna)
307 self.qkv_proj = QKVParallelLinear(
308 self.hidden_size,
309 self.head_dim,
310 self.total_num_heads,
311 self.total_num_kv_heads,
302 - bias=config.qkv_bias,
312 + bias=config.attention_bias,
313 quant_config=quant_config,
314 prefix=f"{prefix}.qkv_proj",
315 )
@@ -506,14 +516,9 @@ class LagunaDecoderLayer(nn.Module):
516 ),
517 )
518
509 - # Check if this layer uses MoE or dense MLP (matches Qwen2/Qwen3 convention)
510 - mlp_only_layers = (
511 - [] if not hasattr(config, "mlp_only_layers") else config.mlp_only_layers
512 - )
519 self.is_moe_layer = (
514 - (layer_idx not in mlp_only_layers)
515 - and (config.num_experts > 0)
516 - and ((layer_idx + 1) % config.decoder_sparse_step == 0)
520 + get_mlp_layer_types(config)[layer_idx] == "sparse"
521 + and config.num_experts > 0
522 )
523
524 if self.is_moe_layer:
vllm/model_executor/models/pixtral.py
+39 -6
@@ -1,6 +1,7 @@
1 # SPDX-License-Identifier: Apache-2.0
2 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
4 +import importlib.metadata
5 import math
6 from collections.abc import Iterable, Mapping, Sequence
7 from dataclasses import dataclass, fields
@@ -12,15 +13,12 @@ import torch.nn as nn
13 from mistral_common.protocol.instruct.chunk import ImageChunk, TextChunk
14 from mistral_common.protocol.instruct.messages import UserMessage
15 from mistral_common.protocol.instruct.request import ChatCompletionRequest
16 +from packaging.version import Version
17 from transformers import BatchFeature, PixtralVisionConfig
18 from transformers.models.pixtral.image_processing_pixtral import (
19 _num_image_tokens as _get_pixtral_hf_num_image_tokens,
20 )
19 -from transformers.models.pixtral.modeling_pixtral import (
20 - PixtralRotaryEmbedding,
21 - apply_rotary_pos_emb,
22 - position_ids_in_meshgrid,
23 -)
21 +from transformers.models.pixtral.modeling_pixtral import apply_rotary_pos_emb
22
23 from vllm.config import VllmConfig
24 from vllm.config.multimodal import BaseDummyOptions
@@ -92,6 +90,39 @@ from .vision import (
90
91 PATCH_MERGE = "patch_merge"
92
93 +# Transformers 5.17 renamed Pixtral's rotary embedding and switched it to axial
94 +# RoPE, which takes 2D (height, width) positions instead of flattened grid ids.
95 +TRANSFORMERS_VERSION = importlib.metadata.version("transformers")
96 +TRANSFORMERS_WITH_AXIAL_ROPE = Version(TRANSFORMERS_VERSION) >= Version("5.17.0.dev0")
97 +
98 +if TRANSFORMERS_WITH_AXIAL_ROPE:
99 + from transformers.models.pixtral.modeling_pixtral import (
100 + PixtralVisionRotaryEmbedding,
101 + )
102 +else:
103 + from transformers.models.pixtral.modeling_pixtral import (
104 + PixtralRotaryEmbedding as PixtralVisionRotaryEmbedding,
105 + )
106 + from transformers.models.pixtral.modeling_pixtral import (
107 + position_ids_in_meshgrid as flat_position_ids_in_meshgrid,
108 + )
109 +
110 +
111 +def position_ids_in_meshgrid(
112 + patch_embeds_list: list[torch.Tensor],
113 + max_width: int,
114 +) -> torch.Tensor:
115 + if not TRANSFORMERS_WITH_AXIAL_ROPE:
116 + return flat_position_ids_in_meshgrid(patch_embeds_list, max_width)
117 + positions = []
118 + for patch in patch_embeds_list:
119 + height, width = patch.shape[-2:]
120 + h_ids, w_ids = torch.meshgrid(
121 + torch.arange(height), torch.arange(width), indexing="ij"
122 + )
123 + positions.append(torch.stack([h_ids.flatten(), w_ids.flatten()], dim=-1))
124 + return torch.cat(positions, dim=0)
125 +
126
127 def _make_packed_sequence_metadata(
128 sequence_lengths: list[int],
@@ -1467,7 +1498,9 @@ class PixtralHFVisionModel(nn.Module):
1498
1499 self.dtype = next(self.parameters()).dtype
1500 self.device = next(self.parameters()).device
1470 - self.patch_positional_embedding = PixtralRotaryEmbedding(config, self.device)
1501 + self.patch_positional_embedding = PixtralVisionRotaryEmbedding(config).to(
1502 + self.device
1503 + )
1504
1505 def forward(
1506 self,
vllm/models/qwen4_exp/amd/model.py
+12 -6
@@ -76,7 +76,7 @@ from vllm.transformers_utils.configs.qwen4_exp import (
76 from vllm.v1.attention.backends.registry import MambaAttentionBackendEnum
77 from vllm.v1.kv_cache_interface import MambaSpec
78
79 -from ..config import Qwen4ExpConfig
79 +from ..config import ATTENTION_LAYER_TYPES, QSA_LAYER_TYPE, Qwen4ExpConfig
80 from .hyperconnection import GatedResidual, HyperConnectionConfig
81 from .low_latency_gemm import enable_qwen4_exp_low_latency_gemm
82 from .ple_layer import Qwen4ExpPLELayer
@@ -214,8 +214,11 @@ class Qwen4ExpDecoderLayer(nn.Module):
214 prefix=f"{prefix}.linear_attn",
215 gqa_interleaved_layout=False,
216 )
217 - elif layer_type == "full_attention":
218 - use_qsa = getattr(config, "indexer_n_heads", None) is not None
217 + elif layer_type in ATTENTION_LAYER_TYPES:
218 + use_qsa = (
219 + layer_type == QSA_LAYER_TYPE
220 + or getattr(config, "indexer_n_heads", None) is not None
221 + )
222 if not use_qsa:
223 self.self_attn = Qwen3NextAttention(
224 config,
@@ -311,7 +314,7 @@ class Qwen4ExpDecoderLayer(nn.Module):
314
315 if self.layer_type == "linear_attention":
316 attn_out = self.linear_attn(hidden_states=block_input)
314 - elif self.layer_type == "full_attention":
317 + elif self.layer_type in ATTENTION_LAYER_TYPES:
318 attn_out = self.self_attn(
319 hidden_states=block_input,
320 positions=positions,
@@ -402,8 +405,11 @@ class Qwen4ExpModel(nn.Module):
405 self._qsa_layer_ids = frozenset(
406 layer_idx
407 for layer_idx, layer_type in enumerate(config.layer_types)
405 - if layer_type == "full_attention"
406 - and getattr(config, "indexer_n_heads", None) is not None
408 + if layer_type == QSA_LAYER_TYPE
409 + or (
410 + layer_type == "full_attention"
411 + and getattr(config, "indexer_n_heads", None) is not None
412 + )
413 )
414 self.embed_tokens = VocabParallelEmbedding(self.vocab_size, config.hidden_size)
415
vllm/models/qwen4_exp/config.py
+12 -1
@@ -19,6 +19,12 @@ _QSA_CONFIG_FIELDS = (
19 "indexer_compress_ratio",
20 )
21
22 +# Transformers labels Qwen4Exp's sparse-attention layers `qwen_sparse_attention`.
23 +# Older checkpoints label them `full_attention` and mark QSA by setting the
24 +# indexer fields for the whole model.
25 +QSA_LAYER_TYPE = "qwen_sparse_attention"
26 +ATTENTION_LAYER_TYPES = ("full_attention", QSA_LAYER_TYPE)
27 +
28
29 class Qwen4ExpVisionConfig(Qwen3VLVisionConfig):
30 model_type = "qwen4_exp"
@@ -134,6 +140,11 @@ class Qwen4ExpTextConfig(Qwen3NextConfig):
140 def _validate_qsa_config(self) -> None:
141 configured = {name: getattr(self, name, None) for name in _QSA_CONFIG_FIELDS}
142 if all(value is None for value in configured.values()):
143 + if QSA_LAYER_TYPE in (self.layer_types or ()):
144 + raise ValueError(
145 + f"{QSA_LAYER_TYPE} layers require the QSA config fields: "
146 + f"{list(_QSA_CONFIG_FIELDS)}"
147 + )
148 return
149
150 missing = [name for name, value in configured.items() if value is None]
@@ -165,7 +176,7 @@ class Qwen4ExpTextConfig(Qwen3NextConfig):
176 @property
177 def layers_block_type(self) -> list[str]:
178 return [
168 - "attention" if layer_type == "full_attention" else layer_type
179 + "attention" if layer_type in ATTENTION_LAYER_TYPES else layer_type
180 for layer_type in self.layer_types
181 ]
182
vllm/models/qwen4_exp/nvidia/model.py
+12 -6
@@ -75,7 +75,7 @@ from vllm.transformers_utils.configs.qwen4_exp import (
75 from vllm.v1.attention.backends.registry import MambaAttentionBackendEnum
76 from vllm.v1.kv_cache_interface import MambaSpec
77
78 -from ..config import Qwen4ExpConfig
78 +from ..config import ATTENTION_LAYER_TYPES, QSA_LAYER_TYPE, Qwen4ExpConfig
79 from .hyperconnection import GatedResidual, HyperConnectionConfig
80 from .low_latency_gemm import enable_qwen4_exp_low_latency_gemm
81 from .ple_layer import Qwen4ExpPLELayer
@@ -215,8 +215,11 @@ class Qwen4ExpDecoderLayer(nn.Module):
215 prefix=f"{prefix}.linear_attn",
216 gqa_interleaved_layout=False,
217 )
218 - elif layer_type == "full_attention":
219 - use_qsa = getattr(config, "indexer_n_heads", None) is not None
218 + elif layer_type in ATTENTION_LAYER_TYPES:
219 + use_qsa = (
220 + layer_type == QSA_LAYER_TYPE
221 + or getattr(config, "indexer_n_heads", None) is not None
222 + )
223 if not use_qsa:
224 self.self_attn = Qwen3NextAttention(
225 config,
@@ -314,7 +317,7 @@ class Qwen4ExpDecoderLayer(nn.Module):
317
318 if self.layer_type == "linear_attention":
319 attn_out = self.linear_attn(hidden_states=block_input)
317 - elif self.layer_type == "full_attention":
320 + elif self.layer_type in ATTENTION_LAYER_TYPES:
321 attn_out = self.self_attn(
322 hidden_states=block_input,
323 positions=positions,
@@ -394,8 +397,11 @@ class Qwen4ExpModel(nn.Module):
397 self._qsa_layer_ids = frozenset(
398 layer_idx
399 for layer_idx, layer_type in enumerate(config.layer_types)
397 - if layer_type == "full_attention"
398 - and getattr(config, "indexer_n_heads", None) is not None
400 + if layer_type == QSA_LAYER_TYPE
401 + or (
402 + layer_type == "full_attention"
403 + and getattr(config, "indexer_n_heads", None) is not None
404 + )
405 )
406 self.embed_tokens = VocabParallelEmbedding(self.vocab_size, config.hidden_size)
407
vllm/transformers_utils/config.py
+49 -2
@@ -13,6 +13,7 @@ from typing import Any, Literal, TypeAlias
13
14 import huggingface_hub
15 import torch
16 +import transformers.configuration_utils as hf_configuration_utils
17 from huggingface_hub import constants
18 from packaging.version import Version
19 from safetensors.torch import _TYPES as _SAFETENSORS_TO_TORCH_DTYPE
@@ -126,7 +127,6 @@ _CONFIG_REGISTRY: dict[str, type[PretrainedConfig]] = LazyConfigDict(
127 RefinedWebModel="RWConfig", # For tiiuae/falcon-7b(-instruct)
128 mlp_speculator="MLPSpeculatorConfig",
129 medusa="MedusaConfig",
129 - mellum="MellumConfig",
130 midashenglm="MiDashengLMConfig",
131 minimax_m3_vl="MiniMaxM3Config",
132 minimax_m3_mtp="MiniMaxM3MTPConfig",
@@ -151,7 +151,6 @@ _CONFIG_REGISTRY: dict[str, type[PretrainedConfig]] = LazyConfigDict(
151 qwen3_5_text="Qwen3_5TextConfig",
152 qwen3_5_moe="Qwen3_5MoeConfig",
153 qwen3_5_moe_text="Qwen3_5MoeTextConfig",
154 - laguna="LagunaConfig",
154 lfm2_moe="Lfm2MoeConfig",
155 **{"unlimited-ocr": "UnlimitedOCRConfig"},
156 **{"deepseek_v41": "DeepseekV41Config"},
@@ -163,6 +162,12 @@ _SPECULATIVE_DECODING_CONFIGS: set[str] = {"eagle", "speculators", "medusa"}
162
163 _PATCH_HF_VALIDATE_ROPE: set[str] = {"sarvam_mla"}
164
165 +# Model types whose checkpoints store shared RoPE parameters alongside the
166 +# per-layer-type dicts (e.g. Laguna's `original_max_position_embeddings`).
167 +# Since transformers 5.17, `validate_rope` treats every top-level value of such
168 +# a dict as a layer's parameters and raises on the shared ones.
169 +_PATCH_HF_NESTED_ROPE_VALIDATION: set[str] = {"laguna"}
170 +
171 # Model types whose checkpoints declare `layer_types` entries that upstream
172 # transformers has not added to `ALLOWED_LAYER_TYPES` yet, so its strict config
173 # validation rejects them (e.g. GLM-5.2 `glm_moe_dsa` use
@@ -236,6 +241,11 @@ def _patch_hf_transformers_validate_rope():
241 def patched_validate_rope(self, *args, **kwargs):
242 ignore_keys_param = kwargs.pop("ignore_keys", None)
243 original_ignore_keys = self.ignore_keys_at_rope_validation
244 + if ignore_keys_param is not None:
245 + logger.warning(
246 + "validate_rope() was called with the legacy 'ignore_keys' "
247 + "argument; use 'ignore_keys_at_rope_validation' instead"
248 + )
249 self.ignore_keys_at_rope_validation = original_ignore_keys or ignore_keys_param
250 result = _original_validate_rope(self, *args, **kwargs)
251 return result
@@ -244,6 +254,40 @@ def _patch_hf_transformers_validate_rope():
254 PretrainedConfig.validate_rope = patched_validate_rope
255
256
257 +def _patch_hf_transformers_nested_rope_validation() -> None:
258 + """Drop shared entries sitting alongside a nested ``rope_parameters`` dict.
259 +
260 + Transformers validates a dict with any layer-type key by iterating all of
261 + its values, so a shared entry next to the per-layer dicts raises an
262 + ``AttributeError``. The per-layer dicts already carry their own defaults by
263 + the time validation runs, so the shared entries can be dropped.
264 + """
265 + if hasattr(PretrainedConfig.validate_rope, "__vllm_nested_rope_patched__"):
266 + return
267 +
268 + _original_validate_rope = PretrainedConfig.validate_rope
269 +
270 + @wraps(_original_validate_rope)
271 + def patched_validate_rope(self, *args, **kwargs):
272 + rope_parameters = getattr(self, "rope_parameters", None)
273 + if isinstance(rope_parameters, dict):
274 + layer_types = set(rope_parameters) & set(
275 + hf_configuration_utils.ALLOWED_LAYER_TYPES
276 + )
277 + if shared_keys := set(rope_parameters) - layer_types:
278 + for key in shared_keys:
279 + del rope_parameters[key]
280 + logger.warning(
281 + "Dropping %s from rope_parameters; entries shared across "
282 + "layer types are not supported",
283 + sorted(shared_keys),
284 + )
285 + return _original_validate_rope(self, *args, **kwargs)
286 +
287 + patched_validate_rope.__vllm_nested_rope_patched__ = True # type: ignore[attr-defined]
288 + PretrainedConfig.validate_rope = patched_validate_rope
289 +
290 +
291 def _patch_hf_transformers_allowed_layer_types(
292 extra_layer_types: tuple[str, ...],
293 ) -> None:
@@ -304,6 +348,9 @@ class HFConfigParser(ConfigParserBase):
348 if model_type in _PATCH_HF_VALIDATE_ROPE:
349 _patch_hf_transformers_validate_rope()
350
351 + if model_type in _PATCH_HF_NESTED_ROPE_VALIDATION:
352 + _patch_hf_transformers_nested_rope_validation()
353 +
354 if extra_layer_types := _PATCH_HF_ALLOWED_LAYER_TYPES.get(model_type):
355 _patch_hf_transformers_allowed_layer_types(extra_layer_types)
356
vllm/transformers_utils/configs/__init__.py
-4
@@ -55,10 +55,8 @@ _CLASS_TO_MODULE: dict[str, str] = {
55 # tiiuae/falcon-7b(-instruct) models. Newer Falcon models will use the
56 # `FalconConfig` class from the official HuggingFace transformers library.
57 "RWConfig": "vllm.transformers_utils.configs.falcon",
58 - "LagunaConfig": "vllm.transformers_utils.configs.laguna",
58 "Lfm2MoeConfig": "vllm.transformers_utils.configs.lfm2_moe",
59 "MedusaConfig": "vllm.transformers_utils.configs.medusa",
61 - "MellumConfig": "vllm.transformers_utils.configs.mellum",
60 "MiDashengLMConfig": "vllm.transformers_utils.configs.midashenglm",
61 "MiniMaxM3Config": "vllm.transformers_utils.configs.minimax_m3",
62 "MiniMaxM3MTPConfig": "vllm.transformers_utils.configs.minimax_m3",
@@ -151,10 +149,8 @@ __all__ = [
149 "HyperCLOVAXConfig",
150 "IsaacConfig",
151 "RWConfig",
154 - "LagunaConfig",
152 "Lfm2MoeConfig",
153 "MedusaConfig",
157 - "MellumConfig",
154 "MiDashengLMConfig",
155 "MiniMaxM3Config",
156 "MiniMaxM3MTPConfig",
vllm/transformers_utils/configs/laguna.py deleted
-120
@@ -1,120 +0,0 @@
1 -# SPDX-License-Identifier: Apache-2.0
2 -# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3 -
4 -from transformers.configuration_utils import PretrainedConfig
5 -
6 -
7 -class LagunaConfig(PretrainedConfig):
8 - model_type = "laguna"
9 - keys_to_ignore_at_inference = ["past_key_values"]
10 - base_model_tp_plan = {
11 - "layers.*.self_attn.q_proj": "colwise",
12 - "layers.*.self_attn.k_proj": "colwise",
13 - "layers.*.self_attn.v_proj": "colwise",
14 - "layers.*.self_attn.g_proj": "colwise",
15 - "layers.*.self_attn.o_proj": "rowwise",
16 - "layers.*.mlp.gate_proj": "colwise",
17 - "layers.*.mlp.up_proj": "colwise",
18 - "layers.*.mlp.down_proj": "rowwise",
19 - }
20 - base_model_pp_plan = {
21 - "embed_tokens": (["input_ids"], ["inputs_embeds"]),
22 - "layers": (["hidden_states", "attention_mask"], ["hidden_states"]),
23 - "norm": (["hidden_states"], ["hidden_states"]),
24 - }
25 -
26 - def __init__(
27 - self,
28 - vocab_size: int = 100352,
29 - hidden_size: int = 2048,
30 - intermediate_size: int = 8192,
31 - num_hidden_layers: int = 40,
32 - num_attention_heads: int = 48,
33 - num_key_value_heads: int = 8,
34 - head_dim: int = 128,
35 - qkv_bias: bool = False,
36 - attention_bias: bool = False,
37 - gating: bool | str = True,
38 - hidden_act: str = "silu",
39 - max_position_embeddings: int = 131072,
40 - initializer_range: float = 0.02,
41 - rms_norm_eps: float = 1e-6,
42 - use_cache: bool = True,
43 - tie_word_embeddings: bool = False,
44 - rope_theta: float = 500000.0,
45 - rope_scaling: dict | None = None,
46 - rope_parameters: dict | None = None,
47 - partial_rotary_factor: float = 1.0,
48 - attention_dropout: float = 0.0,
49 - sliding_window: int | None = None,
50 - layer_types: list[str] | None = None,
51 - swa_attention_sink_enabled: bool = False,
52 - swa_rope_parameters: dict | None = None,
53 - num_attention_heads_per_layer: list[int] | None = None,
54 - num_experts: int = 256,
55 - num_experts_per_tok: int = 8,
56 - moe_intermediate_size: int = 512,
57 - shared_expert_intermediate_size: int = 512,
58 - norm_topk_prob: bool = True,
59 - decoder_sparse_step: int = 1,
60 - mlp_only_layers: list[int] | None = None,
61 - router_aux_loss_coef: float = 0.001,
62 - output_router_logits: bool = False,
63 - moe_routed_scaling_factor: float = 1.0,
64 - moe_apply_router_weight_on_input: bool = False,
65 - **kwargs,
66 - ):
67 - if mlp_only_layers is None:
68 - mlp_only_layers = [0]
69 -
70 - # Accept either v4-style (rope_theta + rope_scaling) or v5-style
71 - # (rope_parameters). Translate v5 → v4 so downstream code has one path.
72 - if rope_parameters is not None:
73 - rp = dict(rope_parameters)
74 - rope_theta = float(rp.pop("rope_theta", rope_theta))
75 - rt = rp.pop("rope_type", None)
76 - if rt is not None and rt != "default":
77 - rope_scaling = {"rope_type": rt, **rp}
78 - elif rp and rope_scaling is None:
79 - rope_scaling = {"rope_type": "default", **rp}
80 -
81 - self.vocab_size = vocab_size
82 - self.hidden_size = hidden_size
83 - self.intermediate_size = intermediate_size
84 - self.num_hidden_layers = num_hidden_layers
85 - self.num_attention_heads = num_attention_heads
86 - self.num_key_value_heads = num_key_value_heads
87 - self.head_dim = head_dim
88 - self.qkv_bias = qkv_bias
89 - self.attention_bias = attention_bias
90 - self.gating = gating
91 - self.hidden_act = hidden_act
92 - self.max_position_embeddings = max_position_embeddings
93 - self.initializer_range = initializer_range
94 - self.rms_norm_eps = rms_norm_eps
95 - self.use_cache = use_cache
96 - self.rope_theta = rope_theta
97 - self.rope_scaling = rope_scaling
98 - self.partial_rotary_factor = partial_rotary_factor
99 - self.attention_dropout = attention_dropout
100 - self.sliding_window = sliding_window
101 - self.layer_types = layer_types
102 - self.swa_attention_sink_enabled = swa_attention_sink_enabled
103 - self.swa_rope_parameters = swa_rope_parameters
104 - self.num_attention_heads_per_layer = num_attention_heads_per_layer
105 - self.num_experts = num_experts
106 - self.num_experts_per_tok = num_experts_per_tok
107 - self.moe_intermediate_size = moe_intermediate_size
108 - self.shared_expert_intermediate_size = shared_expert_intermediate_size
109 - self.norm_topk_prob = norm_topk_prob
110 - self.decoder_sparse_step = decoder_sparse_step
111 - self.mlp_only_layers = mlp_only_layers
112 - self.router_aux_loss_coef = router_aux_loss_coef
113 - self.output_router_logits = output_router_logits
114 - self.moe_routed_scaling_factor = moe_routed_scaling_factor
115 - self.moe_apply_router_weight_on_input = moe_apply_router_weight_on_input
116 -
117 - super().__init__(tie_word_embeddings=tie_word_embeddings, **kwargs)
118 -
119 -
120 -__all__ = ["LagunaConfig"]
vllm/transformers_utils/configs/mellum.py deleted
-7
@@ -1,7 +0,0 @@
1 -# SPDX-License-Identifier: Apache-2.0
2 -# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3 -from transformers import Qwen3MoeConfig
4 -
5 -
6 -class MellumConfig(Qwen3MoeConfig):
7 - model_type = "mellum"