[Chore] Use Transformers v5 names and drop redundant processor use_fast (#58550)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
484c211fe8
commit
d881812500
@@ -2,16 +2,16 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
from typing import Any
|
||||
|
||||
from transformers import PretrainedConfig
|
||||
from transformers import PreTrainedConfig
|
||||
|
||||
|
||||
class AXK1Config(PretrainedConfig):
|
||||
class AXK1Config(PreTrainedConfig):
|
||||
r"""This is the configuration class to store the configuration of a [`AXK1Model`].
|
||||
It is used to instantiate an A.X model according to the specified arguments,
|
||||
defining the model architecture. Instantiating a configuration with the defaults
|
||||
will yield a similar configuration to that of the A.X K1.
|
||||
Configuration objects inherit from [`PretrainedConfig`] and can be used to control
|
||||
the model outputs. Read the documentation from [`PretrainedConfig`] for more
|
||||
Configuration objects inherit from [`PreTrainedConfig`] and can be used to control
|
||||
the model outputs. Read the documentation from [`PreTrainedConfig`] for more
|
||||
information.
|
||||
|
||||
Args:
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
|
||||
|
||||
class AfmoeConfig(PretrainedConfig):
|
||||
class AfmoeConfig(PreTrainedConfig):
|
||||
model_type = "afmoe"
|
||||
|
||||
def __init__(
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
from transformers import PretrainedConfig, SiglipVisionConfig
|
||||
from transformers import PreTrainedConfig, SiglipVisionConfig
|
||||
from transformers.models.qwen2 import Qwen2Config
|
||||
|
||||
|
||||
class BagelConfig(PretrainedConfig):
|
||||
class BagelConfig(PreTrainedConfig):
|
||||
"""Configuration class for BAGEL model."""
|
||||
|
||||
model_type = "bagel"
|
||||
|
||||
@@ -9,11 +9,11 @@ from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
|
||||
|
||||
def _normalize_mrope_parameters(
|
||||
config: PretrainedConfig,
|
||||
config: PreTrainedConfig,
|
||||
mrope_section: list[int],
|
||||
) -> None:
|
||||
"""Add the top-level Bailing M-RoPE split to a text config."""
|
||||
@@ -50,7 +50,7 @@ def _build_layer_types(
|
||||
]
|
||||
|
||||
|
||||
class BailingMoeV3TextConfig(PretrainedConfig):
|
||||
class BailingMoeV3TextConfig(PreTrainedConfig):
|
||||
model_type = "bailing_hybrid"
|
||||
base_config_key = "text_config"
|
||||
keys_to_ignore_at_inference = ["past_key_values"]
|
||||
@@ -230,7 +230,7 @@ class BailingMoeV3TextConfig(PretrainedConfig):
|
||||
self.validate_layer_type()
|
||||
|
||||
|
||||
class BailingMoeV3VisionConfig(PretrainedConfig):
|
||||
class BailingMoeV3VisionConfig(PreTrainedConfig):
|
||||
model_type = "qwen3_moe_vit"
|
||||
base_config_key = "vision_config"
|
||||
|
||||
@@ -273,7 +273,7 @@ class BailingMoeV3VisionConfig(PretrainedConfig):
|
||||
self.initializer_range = initializer_range
|
||||
|
||||
|
||||
class BailingMoeV3VLConfig(PretrainedConfig):
|
||||
class BailingMoeV3VLConfig(PreTrainedConfig):
|
||||
model_type = "bailing_moe_v3_vl"
|
||||
keys_to_ignore_at_inference = ["past_key_values"]
|
||||
sub_configs = {
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
# Adapted from
|
||||
# https://github.com/zai-org/ChatGLM2-6B
|
||||
from transformers import PretrainedConfig
|
||||
from transformers import PreTrainedConfig
|
||||
|
||||
|
||||
class ChatGLMConfig(PretrainedConfig):
|
||||
class ChatGLMConfig(PreTrainedConfig):
|
||||
model_type = "chatglm"
|
||||
attribute_map = {
|
||||
"num_hidden_layers": "num_layers",
|
||||
|
||||
@@ -8,10 +8,10 @@ with a pixel shuffle connector and ColBERT-style 128-dim per-token embeddings.
|
||||
Reference: https://huggingface.co/ModernVBERT/colmodernvbert-merged
|
||||
"""
|
||||
|
||||
from transformers import ModernBertConfig, PretrainedConfig, SiglipVisionConfig
|
||||
from transformers import ModernBertConfig, PreTrainedConfig, SiglipVisionConfig
|
||||
|
||||
|
||||
class ColModernVBertConfig(PretrainedConfig):
|
||||
class ColModernVBertConfig(PreTrainedConfig):
|
||||
model_type = "colmodernvbert"
|
||||
|
||||
def __init__(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
from transformers.models.siglip2.configuration_siglip2 import Siglip2VisionConfig
|
||||
|
||||
from .nemotron_h import NemotronHConfig
|
||||
@@ -50,7 +50,7 @@ class Cosmos3EdgeTextConfig(NemotronHConfig):
|
||||
return config_dict
|
||||
|
||||
|
||||
class Cosmos3EdgeProjectorConfig(PretrainedConfig):
|
||||
class Cosmos3EdgeProjectorConfig(PreTrainedConfig):
|
||||
model_type = "cosmos3_edge_projector"
|
||||
|
||||
def __init__(
|
||||
@@ -74,7 +74,7 @@ class Cosmos3EdgeVisionConfig(Siglip2VisionConfig):
|
||||
model_type = "cosmos3_edge_vision"
|
||||
|
||||
|
||||
class Cosmos3EdgeConfig(PretrainedConfig):
|
||||
class Cosmos3EdgeConfig(PreTrainedConfig):
|
||||
model_type = "cosmos3_edge"
|
||||
keys_to_ignore_at_inference = ["past_key_values"]
|
||||
has_no_defaults_at_init = True
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
from typing import Any
|
||||
|
||||
from transformers import PretrainedConfig
|
||||
from transformers import PreTrainedConfig
|
||||
|
||||
|
||||
class DeepseekV4Config(PretrainedConfig):
|
||||
class DeepseekV4Config(PreTrainedConfig):
|
||||
model_type = "deepseek_v4"
|
||||
|
||||
def __init__(
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
from typing import Any
|
||||
|
||||
from transformers import PretrainedConfig
|
||||
from transformers import PreTrainedConfig
|
||||
|
||||
|
||||
class DeepseekV41Config(PretrainedConfig):
|
||||
class DeepseekV41Config(PreTrainedConfig):
|
||||
"""DeepSeek V4.1 config.
|
||||
|
||||
The HF config nests the text model under ``text_config`` and the vision
|
||||
@@ -34,7 +34,7 @@ class DeepseekV41Config(PretrainedConfig):
|
||||
for key, value in text_config.items():
|
||||
if key == "model_type":
|
||||
continue
|
||||
# Don't clobber PretrainedConfig properties (e.g. is_encoder_decoder).
|
||||
# Don't clobber PreTrainedConfig properties (e.g. is_encoder_decoder).
|
||||
if isinstance(getattr(type(self), key, None), property):
|
||||
continue
|
||||
setattr(self, key, value)
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
# adapted from https://github.com/deepseek-ai/DeepSeek-VL2/blob/faf18023f24b962b32d9f0a2d89e402a8d383a78/deepseek_vl2/models/modeling_deepseek_vl_v2.py#L115-L268
|
||||
|
||||
from huggingface_hub.dataclasses import strict
|
||||
from transformers import DeepseekV2Config, PretrainedConfig
|
||||
from transformers import DeepseekV2Config, PreTrainedConfig
|
||||
|
||||
|
||||
class VisionEncoderConfig(PretrainedConfig):
|
||||
class VisionEncoderConfig(PreTrainedConfig):
|
||||
model_type: str = "vision"
|
||||
|
||||
model_name: str = "vit_so400m_patch14_siglip_384.webli"
|
||||
@@ -58,7 +58,7 @@ class VisionEncoderConfig(PretrainedConfig):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
|
||||
class MlpProjectorConfig(PretrainedConfig):
|
||||
class MlpProjectorConfig(PreTrainedConfig):
|
||||
model_type = "mlp_projector"
|
||||
projector_type: str = "downsample_mlp_gelu"
|
||||
input_dim: int = 1152
|
||||
@@ -98,7 +98,7 @@ class DeepseekVLV2TextConfig(DeepseekV2Config):
|
||||
kv_lora_rank: int | None = DeepseekV2Config.kv_lora_rank
|
||||
|
||||
|
||||
class DeepseekVLV2Config(PretrainedConfig):
|
||||
class DeepseekVLV2Config(PreTrainedConfig):
|
||||
model_type = "deepseek_vl_v2"
|
||||
|
||||
tile_tag: str = "2D"
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
from typing import Any
|
||||
|
||||
from transformers import PretrainedConfig
|
||||
from transformers import PreTrainedConfig
|
||||
from transformers.models.gemma4.configuration_gemma4 import Gemma4VisionConfig
|
||||
|
||||
|
||||
def _init_text_config(self: PretrainedConfig, **kwargs: Any) -> None:
|
||||
PretrainedConfig.__init__(self, **kwargs)
|
||||
def _init_text_config(self: PreTrainedConfig, **kwargs: Any) -> None:
|
||||
PreTrainedConfig.__init__(self, **kwargs)
|
||||
# DiffusionGemma always uses MoE and K=V sharing for full_attention
|
||||
# layers. The HF reference removed these config fields entirely.
|
||||
if getattr(self, "num_experts", None):
|
||||
@@ -15,14 +15,14 @@ def _init_text_config(self: PretrainedConfig, **kwargs: Any) -> None:
|
||||
self.attention_k_eq_v = True
|
||||
|
||||
|
||||
class DiffusionGemmaTextConfig(PretrainedConfig):
|
||||
class DiffusionGemmaTextConfig(PreTrainedConfig):
|
||||
model_type = "diffusion_gemma_text"
|
||||
|
||||
def __init__(self, **kwargs: Any):
|
||||
_init_text_config(self, **kwargs)
|
||||
|
||||
|
||||
class DiffusionGemmaConfig(PretrainedConfig):
|
||||
class DiffusionGemmaConfig(PreTrainedConfig):
|
||||
model_type = "diffusion_gemma"
|
||||
|
||||
def __init__(
|
||||
@@ -41,4 +41,4 @@ class DiffusionGemmaConfig(PretrainedConfig):
|
||||
else:
|
||||
self.vision_config = vision_config
|
||||
self.audio_config = None
|
||||
PretrainedConfig.__init__(self, **kwargs)
|
||||
PreTrainedConfig.__init__(self, **kwargs)
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
from typing import Any
|
||||
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
from transformers.models.qwen2 import Qwen2Config
|
||||
|
||||
|
||||
class DotsVisionConfig(PretrainedConfig):
|
||||
class DotsVisionConfig(PreTrainedConfig):
|
||||
model_type: str = "dots_vit"
|
||||
|
||||
def __init__(
|
||||
|
||||
@@ -3,22 +3,22 @@
|
||||
|
||||
import os
|
||||
|
||||
from transformers import AutoConfig, DeepseekV2Config, PretrainedConfig
|
||||
from transformers import AutoConfig, DeepseekV2Config, PreTrainedConfig
|
||||
|
||||
from vllm.transformers_utils.utils import without_trust_remote_code
|
||||
|
||||
|
||||
class EAGLEConfig(PretrainedConfig):
|
||||
class EAGLEConfig(PreTrainedConfig):
|
||||
model_type = "eagle"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
model: PretrainedConfig | dict | None = None,
|
||||
model: PreTrainedConfig | dict | None = None,
|
||||
truncated_vocab_size: int | None = None,
|
||||
method: str | None = "eagle",
|
||||
**kwargs,
|
||||
):
|
||||
model_config: PretrainedConfig | DeepseekV2Config | None
|
||||
model_config: PreTrainedConfig | DeepseekV2Config | None
|
||||
if isinstance(model, dict):
|
||||
model_config = AutoConfig.for_model(**model)
|
||||
else:
|
||||
|
||||
@@ -5,17 +5,17 @@ the extract_hidden_states spec decoding method."""
|
||||
|
||||
import os
|
||||
|
||||
from transformers import PretrainedConfig
|
||||
from transformers import PreTrainedConfig
|
||||
|
||||
from vllm.transformers_utils.utils import without_trust_remote_code
|
||||
|
||||
|
||||
class ExtractHiddenStatesConfig(PretrainedConfig):
|
||||
class ExtractHiddenStatesConfig(PreTrainedConfig):
|
||||
model_type = "extract_hidden_states"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
model: PretrainedConfig | dict | None = None,
|
||||
model: PreTrainedConfig | dict | None = None,
|
||||
method: str | None = "extract_hidden_states",
|
||||
**kwargs,
|
||||
):
|
||||
@@ -24,7 +24,7 @@ class ExtractHiddenStatesConfig(PretrainedConfig):
|
||||
if isinstance(model, dict):
|
||||
model_dict = model
|
||||
source_text_config = None
|
||||
elif isinstance(model, PretrainedConfig):
|
||||
elif isinstance(model, PreTrainedConfig):
|
||||
model_dict = model.to_dict()
|
||||
text_config = model.get_text_config()
|
||||
source_text_config = text_config if text_config is not model else None
|
||||
@@ -40,7 +40,7 @@ class ExtractHiddenStatesConfig(PretrainedConfig):
|
||||
combined["architectures"] = ["ExtractHiddenStatesModel"]
|
||||
|
||||
# to_dict() and kwargs both flatten text_config to a plain dict;
|
||||
# downstream get_hf_text_config() needs it as a PretrainedConfig
|
||||
# downstream get_hf_text_config() needs it as a PreTrainedConfig
|
||||
# for attribute access. Re-insert the original object.
|
||||
if source_text_config is not None:
|
||||
combined["text_config"] = source_text_config
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
# limitations under the License.
|
||||
"""Falcon configuration."""
|
||||
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
|
||||
|
||||
class RWConfig(PretrainedConfig):
|
||||
class RWConfig(PreTrainedConfig):
|
||||
model_type = "falcon"
|
||||
keys_to_ignore_at_inference = ["past_key_values"]
|
||||
attribute_map = {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from transformers import CONFIG_MAPPING, PretrainedConfig
|
||||
from transformers import CONFIG_MAPPING, PreTrainedConfig
|
||||
|
||||
# NOTE: Temporary shim for FunAudioChat checkpoints.
|
||||
# These checkpoints use `model_type="funaudiochat"`, which is not currently
|
||||
@@ -13,7 +13,7 @@ from transformers import CONFIG_MAPPING, PretrainedConfig
|
||||
# provides an `auto_map`) and vLLM can rely on `AutoConfig.from_pretrained()`.
|
||||
|
||||
|
||||
class FunAudioChatAudioEncoderConfig(PretrainedConfig):
|
||||
class FunAudioChatAudioEncoderConfig(PreTrainedConfig):
|
||||
model_type = "funaudiochat_audio_encoder"
|
||||
|
||||
def __init__(
|
||||
@@ -74,7 +74,7 @@ class FunAudioChatAudioEncoderConfig(PretrainedConfig):
|
||||
self.pad_token_id = pad_token_id
|
||||
|
||||
|
||||
class FunAudioChatConfig(PretrainedConfig):
|
||||
class FunAudioChatConfig(PreTrainedConfig):
|
||||
model_type = "funaudiochat"
|
||||
attribute_map = {
|
||||
"audio_token_id": "audio_token_index",
|
||||
@@ -82,8 +82,8 @@ class FunAudioChatConfig(PretrainedConfig):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
audio_config: PretrainedConfig | dict | None = None,
|
||||
text_config: PretrainedConfig | dict | None = None,
|
||||
audio_config: PreTrainedConfig | dict | None = None,
|
||||
text_config: PreTrainedConfig | dict | None = None,
|
||||
audio_token_index: int = 151646,
|
||||
ignore_index: int = -100,
|
||||
hidden_size: int | None = None,
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
|
||||
from copy import copy
|
||||
|
||||
from transformers import PretrainedConfig
|
||||
from transformers import PreTrainedConfig
|
||||
|
||||
|
||||
def gemma4_layer_config(
|
||||
text_config: PretrainedConfig, layer_idx: int
|
||||
) -> PretrainedConfig:
|
||||
text_config: PreTrainedConfig, layer_idx: int
|
||||
) -> PreTrainedConfig:
|
||||
"""The Gemma4 text config as it applies to one layer.
|
||||
|
||||
Gemma4 uses a larger head dimension on its full attention layers than on its
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
|
||||
from vllm.logger import init_logger
|
||||
|
||||
logger = init_logger(__name__)
|
||||
|
||||
|
||||
class Glm5NextTextConfig(PretrainedConfig):
|
||||
class Glm5NextTextConfig(PreTrainedConfig):
|
||||
model_type = "glm5_next_text"
|
||||
base_config_key = "text_config"
|
||||
keys_to_ignore_at_inference = ["past_key_values"]
|
||||
@@ -271,7 +271,7 @@ class Glm5NextTextConfig(PretrainedConfig):
|
||||
]
|
||||
|
||||
|
||||
class Glm5NextVisionConfig(PretrainedConfig):
|
||||
class Glm5NextVisionConfig(PreTrainedConfig):
|
||||
model_type = "glm5_next_vision"
|
||||
base_config_key = "vision_config"
|
||||
|
||||
@@ -324,7 +324,7 @@ class Glm5NextVisionConfig(PretrainedConfig):
|
||||
self.swiglu_limit = swiglu_limit
|
||||
|
||||
|
||||
class Glm5NextConfig(PretrainedConfig):
|
||||
class Glm5NextConfig(PreTrainedConfig):
|
||||
model_type = "glm5_next"
|
||||
sub_configs = {
|
||||
"vision_config": Glm5NextVisionConfig,
|
||||
@@ -345,7 +345,7 @@ class Glm5NextConfig(PretrainedConfig):
|
||||
**kwargs,
|
||||
):
|
||||
# Init super() first so base-class defaults don't clobber text-config
|
||||
# values set below (PretrainedConfig has many text-related defaults
|
||||
# values set below (PreTrainedConfig has many text-related defaults
|
||||
# that differ from Glm5NextTextConfig).
|
||||
super().__init__(**kwargs)
|
||||
|
||||
@@ -379,7 +379,7 @@ class Glm5NextConfig(PretrainedConfig):
|
||||
# and must NOT be mirrored onto text_config: ``architectures`` /
|
||||
# ``torch_dtype`` differ between the top-level config and the text
|
||||
# sub-config, and mirroring them makes the top-level ``architectures``
|
||||
# silently read back as None (PretrainedConfig initializes both to None),
|
||||
# silently read back as None (PreTrainedConfig initializes both to None),
|
||||
# which then fails model-class resolution ("No model architectures are
|
||||
# specified").
|
||||
_UNMIRRORED_KEYS = [
|
||||
|
||||
@@ -6,7 +6,7 @@ from typing import Any
|
||||
import transformers
|
||||
|
||||
|
||||
class Granite4VisionConfig(transformers.PretrainedConfig):
|
||||
class Granite4VisionConfig(transformers.PreTrainedConfig):
|
||||
"""Configuration for Granite 4 Vision model.
|
||||
|
||||
This config is needed because the granite4_vision model type is not yet
|
||||
@@ -81,7 +81,7 @@ class Granite4VisionConfig(transformers.PretrainedConfig):
|
||||
**vision_config
|
||||
)
|
||||
else:
|
||||
self.vision_config = transformers.PretrainedConfig(**vision_config)
|
||||
self.vision_config = transformers.PreTrainedConfig(**vision_config)
|
||||
|
||||
text_model_type = text_config.get("model_type", "granite")
|
||||
if text_model_type in transformers.CONFIG_MAPPING:
|
||||
@@ -89,6 +89,6 @@ class Granite4VisionConfig(transformers.PretrainedConfig):
|
||||
**text_config
|
||||
)
|
||||
else:
|
||||
self.text_config = transformers.PretrainedConfig(**text_config)
|
||||
self.text_config = transformers.PreTrainedConfig(**text_config)
|
||||
|
||||
super().__init__(**kwargs)
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
from typing import Any
|
||||
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
|
||||
|
||||
class HYV3Config(PretrainedConfig):
|
||||
class HYV3Config(PreTrainedConfig):
|
||||
r"""This is the configuration class to store the configuration of a [`HYV3Model`].
|
||||
It is used to instantiate a HYV3 model (HY V3 MoE language model) according to
|
||||
the specified arguments.
|
||||
|
||||
Configuration objects inherit from [`PretrainedConfig`] and can be used to
|
||||
control the model outputs. Read the documentation from [`PretrainedConfig`]
|
||||
Configuration objects inherit from [`PreTrainedConfig`] and can be used to
|
||||
control the model outputs. Read the documentation from [`PreTrainedConfig`]
|
||||
for more information.
|
||||
|
||||
Args:
|
||||
|
||||
@@ -17,16 +17,16 @@
|
||||
# limitations under the License.
|
||||
"""HyperCLOVA X model configuration."""
|
||||
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
|
||||
|
||||
class HyperCLOVAXConfig(PretrainedConfig):
|
||||
class HyperCLOVAXConfig(PreTrainedConfig):
|
||||
r"""This is the configuration class to store the configuration of a
|
||||
[`HyperCLOVAXModel`]. It is used to instantiate a HyperCLOVAX model
|
||||
according to the specified arguments, defining the model architecture.
|
||||
Configuration objects inherit from [`PretrainedConfig`] and can be used
|
||||
Configuration objects inherit from [`PreTrainedConfig`] and can be used
|
||||
to control the model outputs. Read the documentation from
|
||||
[`PretrainedConfig`] for more information.
|
||||
[`PreTrainedConfig`] for more information.
|
||||
|
||||
Args:
|
||||
vocab_size (`int`, *optional*, defaults to 32000):
|
||||
|
||||
@@ -7,10 +7,10 @@ A video-chunk is the smallest independently processable unit of video.
|
||||
"""
|
||||
|
||||
from transformers import DeepseekV3Config
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
|
||||
|
||||
class KimiK25VisionConfig(PretrainedConfig):
|
||||
class KimiK25VisionConfig(PreTrainedConfig):
|
||||
model_type = "kimi_k25_vision"
|
||||
|
||||
def __init__(
|
||||
@@ -59,7 +59,7 @@ class KimiK25VisionConfig(PretrainedConfig):
|
||||
self.projector_ln_eps = projector_ln_eps
|
||||
|
||||
|
||||
class KimiK25Config(PretrainedConfig):
|
||||
class KimiK25Config(PreTrainedConfig):
|
||||
"""Kimi-K2.5 model configuration.
|
||||
|
||||
Kimi-K2.5 extends Kimi-K2 with vision support using video-chunks.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
"""Kimi-K3 multimodal configuration."""
|
||||
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
|
||||
from vllm.logger import init_logger
|
||||
from vllm.transformers_utils.configs.kimi_linear import KimiLinearConfig
|
||||
@@ -10,7 +10,7 @@ from vllm.transformers_utils.configs.kimi_linear import KimiLinearConfig
|
||||
logger = init_logger(__name__)
|
||||
|
||||
|
||||
class KimiK3VisionConfig(PretrainedConfig):
|
||||
class KimiK3VisionConfig(PreTrainedConfig):
|
||||
model_type = "kimi_k3_vision"
|
||||
|
||||
def __init__(
|
||||
@@ -83,7 +83,7 @@ class KimiK3VisionConfig(PretrainedConfig):
|
||||
self.intermediate_size = vt_intermediate_size
|
||||
|
||||
|
||||
class KimiK3Config(PretrainedConfig):
|
||||
class KimiK3Config(PreTrainedConfig):
|
||||
model_type = "kimi_k3"
|
||||
|
||||
def __init__(
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
|
||||
|
||||
class KimiLinearConfig(PretrainedConfig):
|
||||
class KimiLinearConfig(PreTrainedConfig):
|
||||
model_type = "kimi_linear"
|
||||
keys_to_ignore_at_inference = ["past_key_values"]
|
||||
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
# Adapted from https://huggingface.co/moonshotai/Kimi-VL-A3B-Instruct/blob/main/configuration_kimi_vl.py
|
||||
|
||||
from transformers import DeepseekV2Config
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
|
||||
from vllm.transformers_utils.configs.moonvit import MoonViTConfig
|
||||
|
||||
|
||||
class KimiVLConfig(PretrainedConfig):
|
||||
class KimiVLConfig(PreTrainedConfig):
|
||||
model_type = "kimi_vl"
|
||||
|
||||
def __init__(
|
||||
|
||||
@@ -2,17 +2,17 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
from typing import Any
|
||||
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
|
||||
|
||||
class Lfm2MoeConfig(PretrainedConfig):
|
||||
class Lfm2MoeConfig(PreTrainedConfig):
|
||||
r"""This is the configuration class to store the configuration of a [`Lfm2MoeModel`]. It is used to instantiate a LFM2 Moe
|
||||
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
|
||||
defaults will yield a similar configuration to that of the LFM2-8B-A1B model.
|
||||
e.g. [LiquidAI/LFM2-8B-A1B](https://huggingface.co/LiquidAI/LFM2-8B-A1B)
|
||||
|
||||
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
||||
documentation from [`PretrainedConfig`] for more information.
|
||||
Configuration objects inherit from [`PreTrainedConfig`] and can be used to control the model outputs. Read the
|
||||
documentation from [`PreTrainedConfig`] for more information.
|
||||
|
||||
|
||||
Args:
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
|
||||
import os
|
||||
|
||||
from transformers import PretrainedConfig
|
||||
from transformers import PreTrainedConfig
|
||||
|
||||
from vllm.transformers_utils.utils import without_trust_remote_code
|
||||
|
||||
|
||||
class MedusaConfig(PretrainedConfig):
|
||||
class MedusaConfig(PreTrainedConfig):
|
||||
model_type = "medusa"
|
||||
|
||||
def __init__(
|
||||
|
||||
@@ -22,13 +22,13 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from transformers import PretrainedConfig
|
||||
from transformers import PreTrainedConfig
|
||||
from transformers.models.qwen2_5_omni.configuration_qwen2_5_omni import (
|
||||
Qwen2_5OmniTextConfig,
|
||||
)
|
||||
|
||||
|
||||
class DashengConfig(PretrainedConfig):
|
||||
class DashengConfig(PreTrainedConfig):
|
||||
model_type = "midashenglm_dasheng_encoder"
|
||||
|
||||
def __init__(
|
||||
@@ -80,7 +80,7 @@ class DashengConfig(PretrainedConfig):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
|
||||
class MiDashengLMConfig(PretrainedConfig):
|
||||
class MiDashengLMConfig(PreTrainedConfig):
|
||||
model_type = "midashenglm"
|
||||
|
||||
def __init__(
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
|
||||
|
||||
from transformers import PretrainedConfig
|
||||
from transformers import PreTrainedConfig
|
||||
|
||||
|
||||
class Mimo_VLVisionConfig(PretrainedConfig):
|
||||
class Mimo_VLVisionConfig(PreTrainedConfig):
|
||||
model_type = "mimovl"
|
||||
base_config_key = "vision_config"
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
from typing import Any
|
||||
|
||||
from transformers import PretrainedConfig
|
||||
from transformers import PreTrainedConfig
|
||||
|
||||
|
||||
class MiniMaxM3TextConfig(PretrainedConfig):
|
||||
class MiniMaxM3TextConfig(PreTrainedConfig):
|
||||
"""Config for the MiniMax M3 text backbone (MiniMaxM3SparseForCausalLM).
|
||||
|
||||
Defaults mirror the ``text_config`` of the MiniMax-M3-preview checkpoint.
|
||||
@@ -120,7 +120,7 @@ class MiniMaxM3MTPConfig(MiniMaxM3TextConfig):
|
||||
super().__init__(num_hidden_layers=num_hidden_layers, **kwargs)
|
||||
|
||||
|
||||
class MiniMaxM3Config(PretrainedConfig):
|
||||
class MiniMaxM3Config(PreTrainedConfig):
|
||||
"""Top-level MiniMax M3 (VL) config.
|
||||
|
||||
Holds the text backbone as ``text_config`` so that
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
from typing import Any
|
||||
|
||||
from transformers import PretrainedConfig, WhisperConfig
|
||||
from transformers import PreTrainedConfig, WhisperConfig
|
||||
|
||||
from vllm.logger import init_logger
|
||||
|
||||
@@ -12,7 +12,7 @@ logger = init_logger(__name__)
|
||||
def adapt_config_dict(
|
||||
config_dict: dict[str, Any],
|
||||
defaults: dict[str, Any],
|
||||
) -> PretrainedConfig:
|
||||
) -> PreTrainedConfig:
|
||||
config_dict = _remap_general_mistral_args(config_dict)
|
||||
config_dict = _remap_mistral_sliding_window(config_dict)
|
||||
|
||||
@@ -86,7 +86,7 @@ def adapt_config_dict(
|
||||
for k, v in defaults.items():
|
||||
config_dict.setdefault(k, v)
|
||||
|
||||
config = PretrainedConfig.from_dict(config_dict)
|
||||
config = PreTrainedConfig.from_dict(config_dict)
|
||||
|
||||
logger.debug("Initialized config %s", config)
|
||||
|
||||
@@ -103,8 +103,8 @@ def _remap_mistral_vision_args(config: dict) -> dict:
|
||||
config = {
|
||||
"model_type": "pixtral",
|
||||
"architectures": ["PixtralForConditionalGeneration"],
|
||||
"text_config": PretrainedConfig.from_dict(config),
|
||||
"vision_config": PretrainedConfig.from_dict(vision_config),
|
||||
"text_config": PreTrainedConfig.from_dict(config),
|
||||
"vision_config": PreTrainedConfig.from_dict(vision_config),
|
||||
}
|
||||
if quant_config:
|
||||
config["quantization_config"] = quant_config
|
||||
@@ -248,7 +248,7 @@ def _remap_mistral_audio_args(config: dict) -> dict:
|
||||
config = {
|
||||
"model_type": "voxtral",
|
||||
"architectures": [architecture],
|
||||
"text_config": PretrainedConfig.from_dict(config),
|
||||
"text_config": PreTrainedConfig.from_dict(config),
|
||||
"audio_config": WhisperConfig(
|
||||
num_mel_bins=encoder_args["audio_encoding_args"]["num_mel_bins"],
|
||||
window_size=encoder_args["audio_encoding_args"]["window_size"],
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
|
||||
|
||||
from transformers import PretrainedConfig
|
||||
from transformers import PreTrainedConfig
|
||||
|
||||
|
||||
class MLPSpeculatorConfig(PretrainedConfig):
|
||||
class MLPSpeculatorConfig(PreTrainedConfig):
|
||||
model_type = "mlp_speculator"
|
||||
|
||||
attribute_map = {
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
"""Configuration for Moondream3 model."""
|
||||
|
||||
from transformers import PretrainedConfig
|
||||
from transformers import PreTrainedConfig
|
||||
|
||||
|
||||
class Moondream3VisionConfig(PretrainedConfig):
|
||||
class Moondream3VisionConfig(PreTrainedConfig):
|
||||
"""Vision encoder configuration for Moondream3."""
|
||||
|
||||
model_type = "moondream3_vision"
|
||||
@@ -43,7 +43,7 @@ class Moondream3VisionConfig(PretrainedConfig):
|
||||
self.image_size = crop_size
|
||||
|
||||
|
||||
class Moondream3TextConfig(PretrainedConfig):
|
||||
class Moondream3TextConfig(PreTrainedConfig):
|
||||
"""Text decoder configuration for Moondream3."""
|
||||
|
||||
model_type = "moondream3_text"
|
||||
@@ -101,7 +101,7 @@ class Moondream3TextConfig(PretrainedConfig):
|
||||
self.num_experts_per_tok = self.moe_experts_per_token
|
||||
|
||||
|
||||
class Moondream3Config(PretrainedConfig):
|
||||
class Moondream3Config(PreTrainedConfig):
|
||||
"""Combined configuration for Moondream3 multimodal model."""
|
||||
|
||||
model_type = "moondream3"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
# Adapted from https://huggingface.co/moonshotai/Kimi-VL-A3B-Instruct/blob/main/configuration_kimi_vl.py
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
|
||||
|
||||
class MoonViTConfig(PretrainedConfig):
|
||||
class MoonViTConfig(PreTrainedConfig):
|
||||
model_type = "moonvit"
|
||||
|
||||
def __init__(
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
|
||||
from typing import Any
|
||||
|
||||
from transformers import PretrainedConfig, Qwen3Config
|
||||
from transformers import PreTrainedConfig, Qwen3Config
|
||||
from transformers.models.whisper.configuration_whisper import WhisperConfig
|
||||
|
||||
|
||||
class MossTranscribeDiarizeConfig(PretrainedConfig):
|
||||
class MossTranscribeDiarizeConfig(PreTrainedConfig):
|
||||
"""Configuration for MOSS-Transcribe-Diarize."""
|
||||
|
||||
model_type = "moss_transcribe_diarize"
|
||||
|
||||
@@ -15,7 +15,7 @@ and vision configs are consumed by the native multimodal serving path.
|
||||
from __future__ import annotations
|
||||
|
||||
from transformers import Qwen3Config
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
|
||||
|
||||
def _default_no_rope_layers(num_hidden_layers: int) -> list[int]:
|
||||
@@ -27,7 +27,7 @@ def _default_no_rope_layers(num_hidden_layers: int) -> list[int]:
|
||||
]
|
||||
|
||||
|
||||
class MuseGlimmerTextConfig(PretrainedConfig):
|
||||
class MuseGlimmerTextConfig(PreTrainedConfig):
|
||||
model_type = "muse_glimmer_text"
|
||||
keys_to_ignore_at_inference = ["past_key_values"]
|
||||
|
||||
@@ -127,7 +127,7 @@ class MuseGlimmerTextConfig(PretrainedConfig):
|
||||
)
|
||||
|
||||
|
||||
class MuseGlimmerVisionConfig(PretrainedConfig):
|
||||
class MuseGlimmerVisionConfig(PreTrainedConfig):
|
||||
model_type = "muse_glimmer_vision"
|
||||
|
||||
def __init__(
|
||||
@@ -177,7 +177,7 @@ class MuseGlimmerVisionConfig(PretrainedConfig):
|
||||
self.layer_types = layer_types
|
||||
|
||||
|
||||
class MuseGlimmerConfig(PretrainedConfig):
|
||||
class MuseGlimmerConfig(PreTrainedConfig):
|
||||
model_type = "muse_glimmer"
|
||||
sub_configs = {
|
||||
"text_config": MuseGlimmerTextConfig,
|
||||
|
||||
@@ -17,22 +17,22 @@
|
||||
# limitations under the License.
|
||||
"""Nemotron model configuration."""
|
||||
|
||||
from transformers import PretrainedConfig
|
||||
from transformers import PreTrainedConfig
|
||||
from transformers.utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
|
||||
class NemotronConfig(PretrainedConfig):
|
||||
class NemotronConfig(PreTrainedConfig):
|
||||
r"""This is the configuration class to store the configuration of a
|
||||
[`NemotronModel`]. It is used to instantiate a Nemotron model
|
||||
according to the specified arguments, defining the model architecture.
|
||||
Instantiating a configuration with the defaults will yield a similar
|
||||
configuration to that of the Nemotron-8B.
|
||||
|
||||
Configuration objects inherit from [`PretrainedConfig`] and can be
|
||||
Configuration objects inherit from [`PreTrainedConfig`] and can be
|
||||
used to control the model outputs. Read the documentation from
|
||||
[`PretrainedConfig`] for more information.
|
||||
[`PreTrainedConfig`] for more information.
|
||||
|
||||
|
||||
Args:
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
"""NemotronH model configuration."""
|
||||
|
||||
import regex as re
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
from transformers.utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
|
||||
class NemotronHConfig(PretrainedConfig):
|
||||
class NemotronHConfig(PreTrainedConfig):
|
||||
r"""This is the configuration class to store the configuration of a
|
||||
[`NemotronHModel`]. It is used to instantiate a NemotronH model according
|
||||
to the specified arguments, defining the model architecture. Instantiating
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
|
||||
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
|
||||
|
||||
class OlmoHybridConfig(PretrainedConfig):
|
||||
class OlmoHybridConfig(PreTrainedConfig):
|
||||
r"""Configuration class for [`OlmoHybridModel`]. It is used to
|
||||
instantiate an OLMo Hybrid model according to the specified
|
||||
arguments, defining the model architecture. Instantiating a
|
||||
|
||||
@@ -9,10 +9,10 @@ configuration without executing Hugging Face remote code.
|
||||
|
||||
from typing import Any
|
||||
|
||||
from transformers import LlamaConfig, PretrainedConfig
|
||||
from transformers import LlamaConfig, PreTrainedConfig
|
||||
|
||||
|
||||
class OpenVLAConfig(PretrainedConfig):
|
||||
class OpenVLAConfig(PreTrainedConfig):
|
||||
"""Configuration class for OpenVLA models."""
|
||||
|
||||
model_type = "openvla"
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
# Ovis Config with AimV2 config registration removed for Transformers compatibility
|
||||
from typing import Any
|
||||
|
||||
from transformers import AutoConfig, PretrainedConfig
|
||||
from transformers import AutoConfig, PreTrainedConfig
|
||||
|
||||
|
||||
class AIMv2Config(PretrainedConfig):
|
||||
class AIMv2Config(PreTrainedConfig):
|
||||
"""This is the configuration class to store the configuration of an [`AIMv2Model`].
|
||||
Instantiating a configuration with the defaults will yield a similar configuration
|
||||
to that of the [apple/aimv2-large-patch14-224](https://huggingface.co/apple/aimv2-large-patch14-224).
|
||||
@@ -29,7 +29,7 @@ class AIMv2Config(PretrainedConfig):
|
||||
projection_dropout: Dropout ratio for the projection layer after the attention.
|
||||
qkv_bias: Whether to add a bias to the queries, keys and values.
|
||||
use_bias: Whether to add a bias in the feed-forward and projection layers.
|
||||
kwargs: Keyword arguments for the [`PretrainedConfig`].
|
||||
kwargs: Keyword arguments for the [`PreTrainedConfig`].
|
||||
|
||||
"""
|
||||
|
||||
@@ -70,7 +70,7 @@ class AIMv2Config(PretrainedConfig):
|
||||
# ----------------------------------------------------------------------
|
||||
# Visual Tokenizer Configuration
|
||||
# ----------------------------------------------------------------------
|
||||
class BaseVisualTokenizerConfig(PretrainedConfig):
|
||||
class BaseVisualTokenizerConfig(PreTrainedConfig):
|
||||
def __init__(
|
||||
self,
|
||||
vocab_size=16384,
|
||||
@@ -78,7 +78,7 @@ class BaseVisualTokenizerConfig(PretrainedConfig):
|
||||
tau=1.0,
|
||||
depths=None,
|
||||
drop_cls_token=False,
|
||||
backbone_config: PretrainedConfig | dict | None = None,
|
||||
backbone_config: PreTrainedConfig | dict | None = None,
|
||||
hidden_stride: int = 1,
|
||||
**kwargs,
|
||||
):
|
||||
@@ -92,10 +92,10 @@ class BaseVisualTokenizerConfig(PretrainedConfig):
|
||||
self.backbone_kwargs = dict[str, Any]()
|
||||
self.drop_cls_token = drop_cls_token
|
||||
if backbone_config is not None:
|
||||
assert isinstance(backbone_config, (PretrainedConfig, dict)), (
|
||||
f"expect `backbone_config` to be instance of PretrainedConfig or dict, but got {type(backbone_config)} type"
|
||||
assert isinstance(backbone_config, (PreTrainedConfig, dict)), (
|
||||
f"expect `backbone_config` to be instance of PreTrainedConfig or dict, but got {type(backbone_config)} type"
|
||||
)
|
||||
if not isinstance(backbone_config, PretrainedConfig):
|
||||
if not isinstance(backbone_config, PreTrainedConfig):
|
||||
model_type = backbone_config["model_type"]
|
||||
if model_type != "aimv2":
|
||||
backbone_config.pop("model_type")
|
||||
@@ -139,13 +139,13 @@ AutoConfig.register("aimv2_visual_tokenizer", Aimv2VisualTokenizerConfig)
|
||||
# ----------------------------------------------------------------------
|
||||
# Ovis Configuration
|
||||
# ----------------------------------------------------------------------
|
||||
class OvisConfig(PretrainedConfig):
|
||||
class OvisConfig(PreTrainedConfig):
|
||||
model_type = "ovis"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
llm_config: PretrainedConfig | dict | None = None,
|
||||
visual_tokenizer_config: PretrainedConfig | dict | None = None,
|
||||
llm_config: PreTrainedConfig | dict | None = None,
|
||||
visual_tokenizer_config: PreTrainedConfig | dict | None = None,
|
||||
multimodal_max_length=8192,
|
||||
hidden_size=None,
|
||||
conversation_formatter_class=None,
|
||||
@@ -155,10 +155,10 @@ class OvisConfig(PretrainedConfig):
|
||||
):
|
||||
super().__init__(**kwargs)
|
||||
if llm_config is not None:
|
||||
assert isinstance(llm_config, (PretrainedConfig, dict)), (
|
||||
f"expect `llm_config` to be instance of PretrainedConfig or dict, but got {type(llm_config)} type"
|
||||
assert isinstance(llm_config, (PreTrainedConfig, dict)), (
|
||||
f"expect `llm_config` to be instance of PreTrainedConfig or dict, but got {type(llm_config)} type"
|
||||
)
|
||||
if not isinstance(llm_config, PretrainedConfig):
|
||||
if not isinstance(llm_config, PreTrainedConfig):
|
||||
model_type = llm_config["model_type"]
|
||||
llm_config.pop("model_type")
|
||||
llm_config = AutoConfig.for_model(model_type, **llm_config)
|
||||
@@ -166,10 +166,10 @@ class OvisConfig(PretrainedConfig):
|
||||
# map llm_config to text_config
|
||||
self.text_config = llm_config
|
||||
if visual_tokenizer_config is not None:
|
||||
assert isinstance(visual_tokenizer_config, (PretrainedConfig, dict)), (
|
||||
f"expect `visual_tokenizer_config` to be instance of PretrainedConfig or dict, but got {type(visual_tokenizer_config)} type"
|
||||
assert isinstance(visual_tokenizer_config, (PreTrainedConfig, dict)), (
|
||||
f"expect `visual_tokenizer_config` to be instance of PreTrainedConfig or dict, but got {type(visual_tokenizer_config)} type"
|
||||
)
|
||||
if not isinstance(visual_tokenizer_config, PretrainedConfig):
|
||||
if not isinstance(visual_tokenizer_config, PreTrainedConfig):
|
||||
model_type = visual_tokenizer_config["model_type"]
|
||||
visual_tokenizer_config.pop("model_type")
|
||||
visual_tokenizer_config = AutoConfig.for_model(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
from dataclasses import dataclass
|
||||
|
||||
from transformers import ParakeetEncoderConfig, PretrainedConfig
|
||||
from transformers import ParakeetEncoderConfig, PreTrainedConfig
|
||||
|
||||
|
||||
class ParakeetConfig(ParakeetEncoderConfig):
|
||||
@@ -24,9 +24,9 @@ class ParakeetConfig(ParakeetEncoderConfig):
|
||||
|
||||
@staticmethod
|
||||
def from_hf_config(
|
||||
config: PretrainedConfig, *, llm_hidden_size: int, max_model_len: int
|
||||
config: PreTrainedConfig, *, llm_hidden_size: int, max_model_len: int
|
||||
) -> "ParakeetConfig":
|
||||
assert isinstance(config, PretrainedConfig)
|
||||
assert isinstance(config, PreTrainedConfig)
|
||||
return ParakeetConfig(
|
||||
**config.to_dict(),
|
||||
scale_input=False,
|
||||
@@ -55,8 +55,8 @@ class ExtractorConfig:
|
||||
padding_value: float = 0.0
|
||||
|
||||
@classmethod
|
||||
def from_hf_config(cls, config: PretrainedConfig) -> "ExtractorConfig":
|
||||
assert isinstance(config, PretrainedConfig)
|
||||
def from_hf_config(cls, config: PreTrainedConfig) -> "ExtractorConfig":
|
||||
assert isinstance(config, PreTrainedConfig)
|
||||
defaults = ("hop_length", "win_length", "preemphasis", "n_fft", "padding_value")
|
||||
optional_kwargs = {
|
||||
name: getattr(config, name) for name in defaults if hasattr(config, name)
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
|
||||
from typing import Any
|
||||
|
||||
from transformers import PretrainedConfig
|
||||
from transformers import PreTrainedConfig
|
||||
from transformers.models.auto import CONFIG_MAPPING
|
||||
|
||||
|
||||
class QianfanOCRVisionConfig(PretrainedConfig):
|
||||
class QianfanOCRVisionConfig(PreTrainedConfig):
|
||||
model_type = "qianfan_ocr_vision"
|
||||
|
||||
def __init__(
|
||||
@@ -53,7 +53,7 @@ class QianfanOCRVisionConfig(PretrainedConfig):
|
||||
self.use_mean_pooling = use_mean_pooling
|
||||
|
||||
|
||||
class QianfanOCRConfig(PretrainedConfig):
|
||||
class QianfanOCRConfig(PreTrainedConfig):
|
||||
model_type = "qianfan_ocr"
|
||||
|
||||
def __init__(
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
# limitations under the License.
|
||||
"""Qwen3.5 model configuration."""
|
||||
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
|
||||
|
||||
class Qwen3_5TextConfig(PretrainedConfig):
|
||||
class Qwen3_5TextConfig(PreTrainedConfig):
|
||||
model_type = "qwen3_5_text"
|
||||
keys_to_ignore_at_inference = ["past_key_values"]
|
||||
|
||||
@@ -108,7 +108,7 @@ class Qwen3_5TextConfig(PretrainedConfig):
|
||||
self.linear_num_value_heads = linear_num_value_heads
|
||||
super().__init__(**kwargs)
|
||||
# Set these AFTER super().__init__() because transformers v4's
|
||||
# PretrainedConfig.__init__ has these as explicit params with different
|
||||
# PreTrainedConfig.__init__ has these as explicit params with different
|
||||
# defaults (e.g. tie_word_embeddings=True) that would overwrite our values.
|
||||
self.pad_token_id = pad_token_id
|
||||
self.bos_token_id = bos_token_id
|
||||
@@ -116,7 +116,7 @@ class Qwen3_5TextConfig(PretrainedConfig):
|
||||
self.tie_word_embeddings = tie_word_embeddings
|
||||
|
||||
|
||||
class Qwen3_5VisionConfig(PretrainedConfig):
|
||||
class Qwen3_5VisionConfig(PreTrainedConfig):
|
||||
model_type = "qwen3_5"
|
||||
base_config_key = "vision_config"
|
||||
|
||||
@@ -152,7 +152,7 @@ class Qwen3_5VisionConfig(PretrainedConfig):
|
||||
self.initializer_range = initializer_range
|
||||
|
||||
|
||||
class Qwen3_5Config(PretrainedConfig):
|
||||
class Qwen3_5Config(PreTrainedConfig):
|
||||
model_type = "qwen3_5"
|
||||
sub_configs = {
|
||||
"vision_config": Qwen3_5VisionConfig,
|
||||
@@ -186,7 +186,7 @@ class Qwen3_5Config(PretrainedConfig):
|
||||
self.vision_start_token_id = vision_start_token_id
|
||||
self.vision_end_token_id = vision_end_token_id
|
||||
super().__init__(**kwargs)
|
||||
# Set after super().__init__() to avoid v4 PretrainedConfig overwrite
|
||||
# Set after super().__init__() to avoid v4 PreTrainedConfig overwrite
|
||||
self.tie_word_embeddings = tie_word_embeddings
|
||||
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
# limitations under the License.
|
||||
"""Qwen3.5-MoE model configuration."""
|
||||
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
|
||||
|
||||
class Qwen3_5MoeTextConfig(PretrainedConfig):
|
||||
class Qwen3_5MoeTextConfig(PreTrainedConfig):
|
||||
model_type = "qwen3_5_moe_text"
|
||||
keys_to_ignore_at_inference = ["past_key_values"]
|
||||
|
||||
@@ -120,7 +120,7 @@ class Qwen3_5MoeTextConfig(PretrainedConfig):
|
||||
self.router_aux_loss_coef = router_aux_loss_coef
|
||||
super().__init__(**kwargs)
|
||||
# Set these AFTER super().__init__() because transformers v4's
|
||||
# PretrainedConfig.__init__ has these as explicit params with different
|
||||
# PreTrainedConfig.__init__ has these as explicit params with different
|
||||
# defaults (e.g. tie_word_embeddings=True) that would overwrite our values.
|
||||
self.pad_token_id = pad_token_id
|
||||
self.bos_token_id = bos_token_id
|
||||
@@ -128,7 +128,7 @@ class Qwen3_5MoeTextConfig(PretrainedConfig):
|
||||
self.tie_word_embeddings = tie_word_embeddings
|
||||
|
||||
|
||||
class Qwen3_5MoeVisionConfig(PretrainedConfig):
|
||||
class Qwen3_5MoeVisionConfig(PreTrainedConfig):
|
||||
model_type = "qwen3_5_moe"
|
||||
base_config_key = "vision_config"
|
||||
|
||||
@@ -164,7 +164,7 @@ class Qwen3_5MoeVisionConfig(PretrainedConfig):
|
||||
self.initializer_range = initializer_range
|
||||
|
||||
|
||||
class Qwen3_5MoeConfig(PretrainedConfig):
|
||||
class Qwen3_5MoeConfig(PreTrainedConfig):
|
||||
model_type = "qwen3_5_moe"
|
||||
sub_configs = {
|
||||
"vision_config": Qwen3_5MoeVisionConfig,
|
||||
@@ -198,7 +198,7 @@ class Qwen3_5MoeConfig(PretrainedConfig):
|
||||
self.vision_start_token_id = vision_start_token_id
|
||||
self.vision_end_token_id = vision_end_token_id
|
||||
super().__init__(**kwargs)
|
||||
# Set after super().__init__() to avoid v4 PretrainedConfig overwrite
|
||||
# Set after super().__init__() to avoid v4 PreTrainedConfig overwrite
|
||||
self.tie_word_embeddings = tie_word_embeddings
|
||||
|
||||
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
from transformers.modeling_rope_utils import rope_config_validation
|
||||
from transformers.utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
|
||||
class Qwen3ASRAudioEncoderConfig(PretrainedConfig):
|
||||
class Qwen3ASRAudioEncoderConfig(PreTrainedConfig):
|
||||
r"""
|
||||
This is the configuration class to store the configuration of a [`Qwen3ASRAudioEncoder`]. It is used to instantiate a
|
||||
Qwen3-ASR audio encoder according to the specified arguments, defining the model architecture. Instantiating a
|
||||
@@ -33,8 +33,8 @@ class Qwen3ASRAudioEncoderConfig(PretrainedConfig):
|
||||
|
||||
e.g. [Qwen/Qwen3-ASR-1.7B](https://huggingface.co/Qwen/Qwen3-ASR-1.7B)
|
||||
|
||||
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
||||
documentation from [`PretrainedConfig`] for more information.
|
||||
Configuration objects inherit from [`PreTrainedConfig`] and can be used to control the model outputs. Read the
|
||||
documentation from [`PreTrainedConfig`] for more information.
|
||||
|
||||
Args:
|
||||
num_mel_bins (`int`, *optional*, defaults to 128):
|
||||
@@ -130,15 +130,15 @@ class Qwen3ASRAudioEncoderConfig(PretrainedConfig):
|
||||
self.downsample_hidden_size = downsample_hidden_size
|
||||
|
||||
|
||||
class Qwen3ASRTextConfig(PretrainedConfig):
|
||||
class Qwen3ASRTextConfig(PreTrainedConfig):
|
||||
r"""
|
||||
This is the configuration class to store the configuration of a [`Qwen3ASRTextModel`]. It is used to instantiate a
|
||||
Qwen3-ASR model according to the specified arguments, defining the model architecture. Instantiating a configuration
|
||||
with the defaults will yield a similar configuration to that of
|
||||
Qwen3-ASR-1.7B [Qwen/Qwen3-ASR-1.7B](https://huggingface.co/Qwen/Qwen3-ASR-1.7B)
|
||||
|
||||
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
||||
documentation from [`PretrainedConfig`] for more information.
|
||||
Configuration objects inherit from [`PreTrainedConfig`] and can be used to control the model outputs. Read the
|
||||
documentation from [`PreTrainedConfig`] for more information.
|
||||
|
||||
Args:
|
||||
vocab_size (`int`, *optional*, defaults to 151936):
|
||||
@@ -285,7 +285,7 @@ class Qwen3ASRTextConfig(PretrainedConfig):
|
||||
super().__init__(tie_word_embeddings=tie_word_embeddings, **kwargs)
|
||||
|
||||
|
||||
class Qwen3ASRThinkerConfig(PretrainedConfig):
|
||||
class Qwen3ASRThinkerConfig(PreTrainedConfig):
|
||||
r"""
|
||||
This is the configuration class to store the configuration of a [`Qwen3ASRThinker`]. It is used to instantiate a
|
||||
Qwen3-ASR-Thinker model according to the specified arguments, defining the model architecture. Instantiating a
|
||||
@@ -294,8 +294,8 @@ class Qwen3ASRThinkerConfig(PretrainedConfig):
|
||||
|
||||
e.g. [Qwen/Qwen3-ASR-1.7B](https://huggingface.co/Qwen/Qwen3-ASR-1.7B)
|
||||
|
||||
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
||||
documentation from [`PretrainedConfig`] for more information.
|
||||
Configuration objects inherit from [`PreTrainedConfig`] and can be used to control the model outputs. Read the
|
||||
documentation from [`PreTrainedConfig`] for more information.
|
||||
|
||||
Args:
|
||||
audio_config (`dict`, *optional*):
|
||||
@@ -365,7 +365,7 @@ class Qwen3ASRThinkerConfig(PretrainedConfig):
|
||||
self.audio_token_id = audio_token_id
|
||||
|
||||
|
||||
class Qwen3ASRConfig(PretrainedConfig):
|
||||
class Qwen3ASRConfig(PreTrainedConfig):
|
||||
"""
|
||||
This is the configuration class to store the configuration of a [`Qwen3ASRForConditionalGeneration`]. It is used to instantiate a Qwen3ASR
|
||||
model according to the specified sub-models configurations, defining the model architecture.
|
||||
@@ -373,8 +373,8 @@ class Qwen3ASRConfig(PretrainedConfig):
|
||||
Instantiating a configuration with the defaults will yield a similar configuration to that of the
|
||||
[Qwen/Qwen3-ASR-1.7B](https://huggingface.co/Qwen/Qwen3-ASR-1.7B) architecture.
|
||||
|
||||
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
||||
documentation from [`PretrainedConfig`] for more information.
|
||||
Configuration objects inherit from [`PreTrainedConfig`] and can be used to control the model outputs. Read the
|
||||
documentation from [`PreTrainedConfig`] for more information.
|
||||
|
||||
Args:
|
||||
thinker_config (`dict`, *optional*): Configuration of the underlying thinker sub-model.
|
||||
@@ -437,7 +437,7 @@ class Qwen3ASRConfig(PretrainedConfig):
|
||||
self.timestamp_segment_time = timestamp_segment_time
|
||||
super().__init__(**kwargs)
|
||||
|
||||
def get_text_config(self, decoder=False) -> "PretrainedConfig":
|
||||
def get_text_config(self, decoder=False) -> "PreTrainedConfig":
|
||||
"""
|
||||
Returns the config that is meant to be used with text IO. On most models, it is the original config instance
|
||||
itself. On specific composite models, it is under a set of valid names.
|
||||
|
||||
@@ -16,20 +16,20 @@
|
||||
# limitations under the License.
|
||||
"""Qwen3-Next model configuration."""
|
||||
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
from transformers.utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
|
||||
class Qwen3NextConfig(PretrainedConfig):
|
||||
class Qwen3NextConfig(PreTrainedConfig):
|
||||
r"""This is the configuration class to store the configuration of a [`Qwen3NextModel`]. It is used to instantiate a
|
||||
Qwen3-Next model according to the specified arguments, defining the model architecture.
|
||||
Instantiating a configuration with the defaults will yield a similar configuration to that of
|
||||
Qwen3-Next-80B-A3B-Instruct [Qwen/Qwen3-Next-80B-A3B-Instruct](https://huggingface.co/Qwen/Qwen3-Next-80B-A3B-Instruct).
|
||||
|
||||
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
||||
documentation from [`PretrainedConfig`] for more information.
|
||||
Configuration objects inherit from [`PreTrainedConfig`] and can be used to control the model outputs. Read the
|
||||
documentation from [`PreTrainedConfig`] for more information.
|
||||
|
||||
|
||||
Args:
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
from typing import Any
|
||||
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
from transformers.utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
@@ -20,7 +20,7 @@ OPENAI_CLIP_MEAN = (0.48145466, 0.4578275, 0.40821073)
|
||||
OPENAI_CLIP_STD = (0.26862954, 0.26130258, 0.27577711)
|
||||
|
||||
|
||||
class RadioConfig(PretrainedConfig):
|
||||
class RadioConfig(PreTrainedConfig):
|
||||
r"""This is the configuration class to store the configuration of a Radio
|
||||
vision model. It is used to instantiate a Radio model according to the
|
||||
specified arguments, defining the model architecture.
|
||||
|
||||
@@ -4,7 +4,7 @@ import os
|
||||
from dataclasses import fields
|
||||
from typing import Any
|
||||
|
||||
from transformers import PretrainedConfig
|
||||
from transformers import PreTrainedConfig
|
||||
|
||||
from vllm.transformers_utils.configs.speculators.algos import (
|
||||
SUPPORTED_SPECULATORS_TYPES,
|
||||
@@ -12,13 +12,13 @@ from vllm.transformers_utils.configs.speculators.algos import (
|
||||
from vllm.transformers_utils.utils import without_trust_remote_code
|
||||
|
||||
|
||||
class SpeculatorsConfig(PretrainedConfig):
|
||||
class SpeculatorsConfig(PreTrainedConfig):
|
||||
model_type = "speculators"
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
# super().__init__ performs some validation before setting all kwargs as
|
||||
# attributes, so we set them first to be safe
|
||||
pre_trained_config_fields = {f.name for f in fields(PretrainedConfig)}
|
||||
pre_trained_config_fields = {f.name for f in fields(PreTrainedConfig)}
|
||||
super_kwargs = dict()
|
||||
for key, value in kwargs.items():
|
||||
if key == "model_type":
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
from typing import Any
|
||||
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
|
||||
|
||||
class Step3VisionEncoderConfig(PretrainedConfig):
|
||||
class Step3VisionEncoderConfig(PreTrainedConfig):
|
||||
model_type = "step3_vision_encoder"
|
||||
|
||||
def __init__(
|
||||
@@ -35,7 +35,7 @@ class Step3VisionEncoderConfig(PretrainedConfig):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
|
||||
class Step3TextConfig(PretrainedConfig):
|
||||
class Step3TextConfig(PreTrainedConfig):
|
||||
model_type = "step3_text"
|
||||
architectures = ["Step3TextForCausalLM"]
|
||||
|
||||
@@ -146,7 +146,7 @@ class Step3TextConfig(PretrainedConfig):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
|
||||
class Step3VLConfig(PretrainedConfig):
|
||||
class Step3VLConfig(PreTrainedConfig):
|
||||
model_type = "step3_vl"
|
||||
|
||||
def __init__(
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
from typing import Any
|
||||
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.configuration_utils import PreTrainedConfig
|
||||
|
||||
|
||||
class Step3p5Config(PretrainedConfig):
|
||||
class Step3p5Config(PreTrainedConfig):
|
||||
model_type = "step3p5"
|
||||
|
||||
def __init__(
|
||||
|
||||
@@ -7,14 +7,14 @@ from typing import Any
|
||||
import transformers
|
||||
|
||||
|
||||
class UltravoxConfig(transformers.PretrainedConfig):
|
||||
class UltravoxConfig(transformers.PreTrainedConfig):
|
||||
r"""This is the configuration class to store the configuration of a
|
||||
[`UltravoxForConditionalGeneration`]. It is used to instantiate an
|
||||
Ultravox model according to the specified arguments, defining the model
|
||||
architecture.
|
||||
|
||||
Configuration objects inherit from [`PretrainedConfig`] and can be used to
|
||||
control the model outputs. Read the documentation from [`PretrainedConfig`]
|
||||
Configuration objects inherit from [`PreTrainedConfig`] and can be used to
|
||||
control the model outputs. Read the documentation from [`PreTrainedConfig`]
|
||||
for more information.
|
||||
|
||||
Args:
|
||||
@@ -74,7 +74,7 @@ class UltravoxConfig(transformers.PretrainedConfig):
|
||||
self.num_projector_layers = num_projector_layers
|
||||
|
||||
# N.B. May set the wrapped_model_config below.
|
||||
self.wrapped_model_config: transformers.PretrainedConfig
|
||||
self.wrapped_model_config: transformers.PreTrainedConfig
|
||||
self.text_model_id = text_model_id
|
||||
if text_model_id is None:
|
||||
text_config = text_config or {}
|
||||
@@ -113,7 +113,7 @@ class UltravoxConfig(transformers.PretrainedConfig):
|
||||
return super().__setattr__(key, value)
|
||||
|
||||
@property
|
||||
def text_config(self) -> transformers.PretrainedConfig:
|
||||
def text_config(self) -> transformers.PreTrainedConfig:
|
||||
# When Ultravox wraps a multi-modal model (e.g. Gemma), we instantiate
|
||||
# the full model, but the text config is the text config of the inner
|
||||
# model.
|
||||
|
||||
Reference in New Issue
Block a user