Add pydocstyle to the ruff rules (#52136)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Signed-off-by: Harry Mellor <hej.mellor@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
804e5377aa
commit
8c1557a79c
@@ -6,14 +6,14 @@ from transformers import PretrainedConfig
|
||||
|
||||
|
||||
class AXK1Config(PretrainedConfig):
|
||||
r"""
|
||||
This is the configuration class to store the configuration of a [`AXK1Model`].
|
||||
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
|
||||
information.
|
||||
|
||||
Args:
|
||||
vocab_size (`int`, *optional*, defaults to 163840):
|
||||
Vocabulary size of the A.X K1 model. Defines the number of different
|
||||
@@ -112,6 +112,7 @@ class AXK1Config(PretrainedConfig):
|
||||
layers during self-attention.
|
||||
attention_dropout (`float`, *optional*, defaults to 0.0):
|
||||
The dropout ratio for the attention probabilities.
|
||||
|
||||
"""
|
||||
|
||||
model_type = "axk1"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
"""
|
||||
Model configs may be defined in this directory for the following reasons:
|
||||
"""Model configs may be defined in this directory for the following reasons:
|
||||
|
||||
- There is no configuration file defined by HF Hub or Transformers library.
|
||||
- There is a need to override the existing config to support vLLM.
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
"""
|
||||
ColPali configuration that extends PaliGemmaConfig with embedding projection
|
||||
"""ColPali configuration that extends PaliGemmaConfig with embedding projection
|
||||
fields. This allows ColPali models to be loaded without trust_remote_code
|
||||
by mapping their custom model_type (colpali) to a standard config class
|
||||
that vLLM understands.
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
"""
|
||||
ColQwen3 configuration that extends Qwen3VLConfig with embedding projection
|
||||
"""ColQwen3 configuration that extends Qwen3VLConfig with embedding projection
|
||||
fields. This allows ColQwen3 models to be loaded without trust_remote_code
|
||||
by mapping their custom model_type (colqwen3, ops_colqwen3, etc.) to a
|
||||
standard config class that vLLM understands.
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
"""Config definitions for ExtractHiddenStatesModel, to be used with
|
||||
the extract_hidden_states spec decoding method."""
|
||||
the extract_hidden_states spec decoding method.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
# 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.
|
||||
"""Falcon configuration"""
|
||||
"""Falcon configuration."""
|
||||
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
|
||||
|
||||
@@ -6,8 +6,7 @@ from transformers.configuration_utils import PretrainedConfig
|
||||
|
||||
|
||||
class HYV3Config(PretrainedConfig):
|
||||
r"""
|
||||
This is the configuration class to store the configuration of a [`HYV3Model`].
|
||||
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.
|
||||
|
||||
@@ -93,6 +92,7 @@ class HYV3Config(PretrainedConfig):
|
||||
>>> config = HYV3Config()
|
||||
>>> model = HYV3Model(config)
|
||||
```
|
||||
|
||||
"""
|
||||
|
||||
model_type = "hy_v3"
|
||||
|
||||
@@ -52,6 +52,7 @@ class HYV4Config(PreTrainedConfig):
|
||||
below zero disable the clamp.
|
||||
num_nextn_predict_layers: Number of MTP layers in the checkpoint.
|
||||
mtp_loss_factor: Training-time MTP loss weight (unused at inference).
|
||||
|
||||
"""
|
||||
|
||||
model_type = "hy_v4"
|
||||
|
||||
@@ -21,8 +21,7 @@ from transformers.configuration_utils import PretrainedConfig
|
||||
|
||||
|
||||
class HyperCLOVAXConfig(PretrainedConfig):
|
||||
r"""
|
||||
This is the configuration class to store the configuration of a
|
||||
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
|
||||
@@ -166,6 +165,7 @@ class HyperCLOVAXConfig(PretrainedConfig):
|
||||
`get_rope`. When provided, takes precedence over `rope_theta`
|
||||
and `rope_scaling`. If `None`, it is derived from `rope_theta`
|
||||
and `rope_scaling` automatically.
|
||||
|
||||
"""
|
||||
|
||||
model_type = "hyperclovax"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
"""
|
||||
Kimi-K2.5 Model Configuration.
|
||||
"""Kimi-K2.5 Model Configuration.
|
||||
|
||||
This configuration supports video-chunk as an internal modality type.
|
||||
A video-chunk is the smallest independently processable unit of video.
|
||||
@@ -73,6 +72,7 @@ class KimiK25Config(PretrainedConfig):
|
||||
ignore_index: The ignore index for the loss function.
|
||||
media_placeholder_token_id: The token ID for media placeholders.
|
||||
pad_token_id: The token ID for padding.
|
||||
|
||||
"""
|
||||
|
||||
model_type = "kimi_k25"
|
||||
|
||||
@@ -6,8 +6,7 @@ from transformers.configuration_utils import 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
|
||||
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)
|
||||
@@ -85,7 +84,9 @@ class Lfm2MoeConfig(PretrainedConfig):
|
||||
|
||||
>>> # Accessing the model configuration
|
||||
>>> configuration = model.config
|
||||
```""" # noqa: E501
|
||||
```
|
||||
|
||||
""" # noqa: E501
|
||||
|
||||
model_type = "lfm2_moe"
|
||||
keys_to_ignore_at_inference = ["past_key_values"]
|
||||
|
||||
@@ -24,8 +24,7 @@ class MLPSpeculatorConfig(PretrainedConfig):
|
||||
scale_input: bool = False,
|
||||
**kwargs,
|
||||
):
|
||||
"""
|
||||
Initialize an MLPSpeculatorConfig
|
||||
"""Initialize an MLPSpeculatorConfig.
|
||||
|
||||
Args:
|
||||
vocab_size: int
|
||||
@@ -52,6 +51,7 @@ class MLPSpeculatorConfig(PretrainedConfig):
|
||||
scale_input: bool
|
||||
if True, will scale the initial hidden states from
|
||||
the base model.
|
||||
|
||||
"""
|
||||
if top_k_tokens_per_head is None:
|
||||
top_k_tokens_per_head = [5, 4, 3]
|
||||
|
||||
@@ -148,5 +148,6 @@ class Moondream3Config(PretrainedConfig):
|
||||
|
||||
Args:
|
||||
decoder: Ignored. Only used for encoder-decoder models.
|
||||
|
||||
"""
|
||||
return self.text_config
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
# 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.
|
||||
"""Nemotron model configuration"""
|
||||
"""Nemotron model configuration."""
|
||||
|
||||
from transformers import PretrainedConfig
|
||||
from transformers.utils import logging
|
||||
@@ -24,8 +24,7 @@ logger = logging.get_logger(__name__)
|
||||
|
||||
|
||||
class NemotronConfig(PretrainedConfig):
|
||||
r"""
|
||||
This is the configuration class to store the configuration of a
|
||||
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
|
||||
@@ -114,7 +113,9 @@ class NemotronConfig(PretrainedConfig):
|
||||
>>> model = NemotronModel(configuration)
|
||||
>>> # Accessing the model configuration
|
||||
>>> configuration = model.config
|
||||
```"""
|
||||
```
|
||||
|
||||
"""
|
||||
|
||||
model_type = "nemotron"
|
||||
keys_to_ignore_at_inference = ["past_key_values"]
|
||||
@@ -193,9 +194,7 @@ class NemotronConfig(PretrainedConfig):
|
||||
)
|
||||
|
||||
def _rope_parameters_validation(self):
|
||||
"""
|
||||
Validate the `rope_parameters` configuration.
|
||||
"""
|
||||
"""Validate the `rope_parameters` configuration."""
|
||||
if self.rope_parameters is None:
|
||||
return
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
# 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.
|
||||
"""NemotronH model configuration"""
|
||||
"""NemotronH model configuration."""
|
||||
|
||||
import regex as re
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
@@ -25,12 +25,12 @@ logger = logging.get_logger(__name__)
|
||||
|
||||
|
||||
class NemotronHConfig(PretrainedConfig):
|
||||
r"""
|
||||
This is the configuration class to store the configuration of a
|
||||
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
|
||||
a configuration with the defaults will yield a similar configuration to
|
||||
that of the NemotronH-v0.1 model.
|
||||
|
||||
Args:
|
||||
vocab_size (`int`, *optional*, defaults to 131072):
|
||||
Vocabulary size of the NemotronH model. Defines the number of
|
||||
@@ -139,6 +139,7 @@ class NemotronHConfig(PretrainedConfig):
|
||||
Size of chunks for Mamba processing.
|
||||
rescale_prenorm_residual (`bool`, *optional*, defaults to `True`):
|
||||
Whether to rescale the pre-normalization residual connections.
|
||||
|
||||
"""
|
||||
|
||||
model_type = "nemotron_h"
|
||||
|
||||
@@ -6,8 +6,7 @@ from transformers.configuration_utils import PretrainedConfig
|
||||
|
||||
|
||||
class OlmoHybridConfig(PretrainedConfig):
|
||||
r"""
|
||||
Configuration class for [`OlmoHybridModel`]. It is used to
|
||||
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
|
||||
configuration with the defaults will yield a similar
|
||||
@@ -19,7 +18,7 @@ class OlmoHybridConfig(PretrainedConfig):
|
||||
can be used to control the model outputs. Read the
|
||||
documentation from [`PreTrainedConfig`] for more information.
|
||||
|
||||
Args:
|
||||
Args:
|
||||
vocab_size (`int`, *optional*, defaults to 100352):
|
||||
Vocabulary size of the OlmoHybrid model. Defines
|
||||
the number of different tokens that can be
|
||||
@@ -159,6 +158,7 @@ class OlmoHybridConfig(PretrainedConfig):
|
||||
>>> model = OlmoHybridModel(configuration)
|
||||
>>> configuration = model.config
|
||||
```
|
||||
|
||||
"""
|
||||
|
||||
model_type = "olmo_hybrid"
|
||||
|
||||
@@ -14,6 +14,7 @@ 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).
|
||||
|
||||
Args:
|
||||
hidden_size: Dimension of the hidden representations.
|
||||
intermediate_size: Dimension of the SwiGLU representations.
|
||||
@@ -29,6 +30,7 @@ class AIMv2Config(PretrainedConfig):
|
||||
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`].
|
||||
|
||||
"""
|
||||
|
||||
model_type: str = "aimv2"
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
# 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.
|
||||
"""Qwen3.5 model configuration"""
|
||||
"""Qwen3.5 model configuration."""
|
||||
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
# 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.
|
||||
"""Qwen3.5-MoE model configuration"""
|
||||
"""Qwen3.5-MoE model configuration."""
|
||||
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
# 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.
|
||||
"""Qwen3-Next model configuration"""
|
||||
"""Qwen3-Next model configuration."""
|
||||
|
||||
from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.utils import logging
|
||||
@@ -23,8 +23,7 @@ logger = logging.get_logger(__name__)
|
||||
|
||||
|
||||
class Qwen3NextConfig(PretrainedConfig):
|
||||
r"""
|
||||
This is the configuration class to store the configuration of a [`Qwen3NextModel`]. It is used to instantiate a
|
||||
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).
|
||||
@@ -157,6 +156,7 @@ class Qwen3NextConfig(PretrainedConfig):
|
||||
>>> # Accessing the model configuration
|
||||
>>> configuration = model.config
|
||||
```
|
||||
|
||||
""" # noqa: E501
|
||||
|
||||
model_type = "qwen3_next"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
"""Radio vision model configuration"""
|
||||
"""Radio vision model configuration."""
|
||||
|
||||
from typing import Any
|
||||
|
||||
@@ -21,8 +21,7 @@ OPENAI_CLIP_STD = (0.26862954, 0.26130258, 0.27577711)
|
||||
|
||||
|
||||
class RadioConfig(PretrainedConfig):
|
||||
r"""
|
||||
This is the configuration class to store the configuration of a Radio
|
||||
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.
|
||||
|
||||
@@ -55,6 +54,7 @@ class RadioConfig(PretrainedConfig):
|
||||
dedicated video patch embedder (3*T*P*P -> hidden) separate from the
|
||||
image embedder (3*P*P -> hidden). When False, a single embedder with
|
||||
input size 3*T*P*P is used for both (images are duplicated T times).
|
||||
|
||||
"""
|
||||
|
||||
model_type = "radio"
|
||||
|
||||
@@ -14,8 +14,7 @@ def register_speculator(name):
|
||||
|
||||
@register_speculator("eagle3")
|
||||
def update_eagle3(config_dict: dict, pre_trained_config: dict) -> None:
|
||||
"""
|
||||
Apply Eagle-3 specific configuration transformations to the `dict` used to
|
||||
"""Apply Eagle-3 specific configuration transformations to the `dict` used to
|
||||
construct the Transformers PreTrainedConfig.
|
||||
|
||||
Eagle-3 specific fields:
|
||||
@@ -28,7 +27,6 @@ def update_eagle3(config_dict: dict, pre_trained_config: dict) -> None:
|
||||
provide intermediate hidden states that help the drafter make better
|
||||
predictions. This is the standard field used in Eagle3 checkpoints.
|
||||
"""
|
||||
|
||||
pre_trained_config["draft_vocab_size"] = config_dict.get("draft_vocab_size")
|
||||
if config_dict.get("target_hidden_size") is not None:
|
||||
pre_trained_config["target_hidden_size"] = config_dict["target_hidden_size"]
|
||||
@@ -54,8 +52,7 @@ def update_eagle3(config_dict: dict, pre_trained_config: dict) -> None:
|
||||
|
||||
@register_speculator("peagle")
|
||||
def update_peagle(config_dict: dict, pre_trained_config: dict) -> None:
|
||||
"""
|
||||
Apply PEagle (Parallel Eagle) specific configuration transformations to
|
||||
"""Apply PEagle (Parallel Eagle) specific configuration transformations to
|
||||
the `dict` used to construct the Transformers PreTrainedConfig.
|
||||
|
||||
PEagle specific fields:
|
||||
@@ -92,8 +89,7 @@ def update_peagle(config_dict: dict, pre_trained_config: dict) -> None:
|
||||
|
||||
@register_speculator("dflash")
|
||||
def update_dflash(config_dict: dict, pre_trained_config: dict) -> None:
|
||||
"""
|
||||
Apply DFlash specific configuration transformations to the `dict` used to
|
||||
"""Apply DFlash specific configuration transformations to the `dict` used to
|
||||
construct the Transformers PreTrainedConfig.
|
||||
|
||||
DFlash specific fields:
|
||||
@@ -132,8 +128,7 @@ def update_dflash(config_dict: dict, pre_trained_config: dict) -> None:
|
||||
|
||||
@register_speculator("dflash2")
|
||||
def update_dflash2(config_dict: dict, pre_trained_config: dict) -> None:
|
||||
"""
|
||||
Apply DFlash2 specific configuration transformations to the `dict` used
|
||||
"""Apply DFlash2 specific configuration transformations to the `dict` used
|
||||
to construct the Transformers PreTrainedConfig.
|
||||
|
||||
DFlash2 extends DFlash with a grouped convolution layer and a
|
||||
@@ -156,8 +151,7 @@ def update_dflash2(config_dict: dict, pre_trained_config: dict) -> None:
|
||||
|
||||
@register_speculator("dspark")
|
||||
def update_dspark(config_dict: dict, pre_trained_config: dict) -> None:
|
||||
"""
|
||||
Apply DSpark specific configuration transformations to the `dict` used to
|
||||
"""Apply DSpark specific configuration transformations to the `dict` used to
|
||||
construct the Transformers PreTrainedConfig.
|
||||
|
||||
DSpark extends DFlash with a Markov logit-bias head, reusing the same
|
||||
|
||||
@@ -47,9 +47,7 @@ class SpeculatorsConfig(PretrainedConfig):
|
||||
def extract_transformers_pre_trained_config(
|
||||
cls, config_dict: dict[str, Any]
|
||||
) -> dict[str, Any]:
|
||||
"""
|
||||
Extract standard Transformers PreTrainedConfig config from speculators config.
|
||||
"""
|
||||
"""Extract the Transformers `PreTrainedConfig` from a speculators config."""
|
||||
speculators_model_type = config_dict.get("speculators_model_type")
|
||||
if speculators_model_type not in SUPPORTED_SPECULATORS_TYPES:
|
||||
raise ValueError(
|
||||
@@ -99,8 +97,7 @@ class SpeculatorsConfig(PretrainedConfig):
|
||||
def build_vllm_speculative_config(
|
||||
cls, config_dict: dict[str, Any]
|
||||
) -> dict[str, Any]:
|
||||
"""
|
||||
Build vLLM-compatible speculative configuration from speculators format.
|
||||
"""Build vLLM-compatible speculative configuration from speculators format.
|
||||
|
||||
This method extracts and transforms speculative configuration from the
|
||||
speculators format into the structure expected by vLLM.
|
||||
@@ -110,6 +107,7 @@ class SpeculatorsConfig(PretrainedConfig):
|
||||
|
||||
Returns:
|
||||
Dictionary with vLLM-compatible speculative configuration
|
||||
|
||||
"""
|
||||
# Extract speculators configuration
|
||||
spec_config = config_dict["speculators_config"]
|
||||
|
||||
@@ -8,8 +8,7 @@ import transformers
|
||||
|
||||
|
||||
class UltravoxConfig(transformers.PretrainedConfig):
|
||||
r"""
|
||||
This is the configuration class to store the configuration of a
|
||||
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.
|
||||
@@ -41,6 +40,7 @@ class UltravoxConfig(transformers.PretrainedConfig):
|
||||
Whether to apply layer normalization at the middle of the
|
||||
projector or at the end. Versions v0.4.1 and below
|
||||
use `False`, but v0.5 and above use `True`.
|
||||
|
||||
"""
|
||||
|
||||
model_type = "ultravox"
|
||||
|
||||
Reference in New Issue
Block a user