Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions vllm/transformers_utils/configs/olmo_hybrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project


from transformers.configuration_utils import PretrainedConfig, layer_type_validation
from transformers.configuration_utils import PretrainedConfig


class OlmoHybridConfig(PretrainedConfig):
Expand Down Expand Up @@ -228,7 +228,15 @@ def __init__(
if "full_attention" not in layer_types:
layer_types[-1] = "full_attention"

layer_type_validation(layer_types, num_hidden_layers)
if hasattr(self, "validate_layer_type"):
# Transformers v5
self.layer_types = layer_types
self.validate_layer_type()
else:
# Transformers v4
from transformers.configuration_utils import layer_type_validation

layer_type_validation(layer_types, num_hidden_layers)
if "linear_attention" not in layer_types:
raise ValueError(
"OLMoHybrid expects at least one 'linear_attention' layer."
Expand Down
19 changes: 13 additions & 6 deletions vllm/transformers_utils/configs/qwen3_5.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# limitations under the License.
"""Qwen3.5 model configuration"""

from transformers.configuration_utils import PretrainedConfig, layer_type_validation
from transformers.configuration_utils import PretrainedConfig


class Qwen3_5TextConfig(PretrainedConfig):
Expand Down Expand Up @@ -68,10 +68,6 @@ def __init__(
eos_token_id=None,
**kwargs,
):
kwargs["ignore_keys_at_rope_validation"] = [
"mrope_section",
"mrope_interleaved",
]
self.vocab_size = vocab_size
self.max_position_embeddings = max_position_embeddings
self.hidden_size = hidden_size
Expand All @@ -98,7 +94,18 @@ def __init__(
else "full_attention"
for i in range(self.num_hidden_layers)
]
layer_type_validation(self.layer_types, self.num_hidden_layers)
if hasattr(self, "validate_layer_type"):
# Transformers v5
kwargs["ignore_keys_at_rope_validation"] = {
"mrope_section",
"mrope_interleaved",
}
self.validate_layer_type()
else:
# Transformers v4
from transformers.configuration_utils import layer_type_validation

layer_type_validation(self.layer_types, self.num_hidden_layers)

# linear attention part
self.linear_conv_kernel_dim = linear_conv_kernel_dim
Expand Down
19 changes: 13 additions & 6 deletions vllm/transformers_utils/configs/qwen3_5_moe.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# limitations under the License.
"""Qwen3.5-MoE model configuration"""

from transformers.configuration_utils import PretrainedConfig, layer_type_validation
from transformers.configuration_utils import PretrainedConfig


class Qwen3_5MoeTextConfig(PretrainedConfig):
Expand Down Expand Up @@ -75,10 +75,6 @@ def __init__(
eos_token_id=None,
**kwargs,
):
kwargs["ignore_keys_at_rope_validation"] = [
"mrope_section",
"mrope_interleaved",
]
self.vocab_size = vocab_size
self.max_position_embeddings = max_position_embeddings
self.hidden_size = hidden_size
Expand All @@ -104,7 +100,18 @@ def __init__(
else "full_attention"
for i in range(self.num_hidden_layers)
]
layer_type_validation(self.layer_types, self.num_hidden_layers)
if hasattr(self, "validate_layer_type"):
# Transformers v5
kwargs["ignore_keys_at_rope_validation"] = {
"mrope_section",
"mrope_interleaved",
}
self.validate_layer_type()
else:
# Transformers v4
from transformers.configuration_utils import layer_type_validation

layer_type_validation(self.layer_types, self.num_hidden_layers)

# linear attention part
self.linear_conv_kernel_dim = linear_conv_kernel_dim
Expand Down
11 changes: 9 additions & 2 deletions vllm/transformers_utils/configs/qwen3_next.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# limitations under the License.
"""Qwen3-Next model configuration"""

from transformers.configuration_utils import PretrainedConfig, layer_type_validation
from transformers.configuration_utils import PretrainedConfig
from transformers.utils import logging

logger = logging.get_logger(__name__)
Expand Down Expand Up @@ -253,7 +253,14 @@ def __init__(
"linear_attention" if bool((i + 1) % 4) else "full_attention"
for i in range(self.num_hidden_layers)
]
layer_type_validation(self.layer_types)
if hasattr(self, "validate_layer_type"):
# Transformers v5
self.validate_layer_type()
else:
# Transformers v4
from transformers.configuration_utils import layer_type_validation

layer_type_validation(self.layer_types)

# linear attention part
self.linear_conv_kernel_dim = linear_conv_kernel_dim
Expand Down
Loading