[CI] Ignore ruff D209, rejoin the docstrings it split, and silence incompatible-rule warnings (#57212)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
1085b64425
commit
651a88c09a
@@ -539,8 +539,7 @@ def register_config_parser(config_format: str):
|
||||
|
||||
def set_default_rope_theta(config: PretrainedConfig, default_theta: float) -> None:
|
||||
"""Some models may have no rope_theta in their config but still use RoPE.
|
||||
This function sets a default rope_theta if it's missing.
|
||||
"""
|
||||
This function sets a default rope_theta if it's missing."""
|
||||
if getattr(config, "rope_parameters", None) is None:
|
||||
config.rope_parameters = {"rope_type": "default"}
|
||||
if "rope_theta" not in config.rope_parameters:
|
||||
@@ -549,8 +548,7 @@ def set_default_rope_theta(config: PretrainedConfig, default_theta: float) -> No
|
||||
|
||||
def patch_legacy_rope_type(rope_parameters: dict[str, Any] | None) -> None:
|
||||
"""Patch legacy RoPE type fields for backwards compatibility with
|
||||
older custom models which would otherwise fail to load.
|
||||
"""
|
||||
older custom models which would otherwise fail to load."""
|
||||
# No RoPE parameters to patch
|
||||
if rope_parameters is None:
|
||||
return
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
# 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
|
||||
|
||||
|
||||
@@ -37,8 +37,7 @@ def _transformers_v4_compatibility_import():
|
||||
subset of `ProcessorChatTemplateKwargs` as defined in Transformers v4.
|
||||
In Transformers v5 these were merged into `ProcessorChatTemplateKwargs` and
|
||||
`ChatTemplateLoadKwargs` was removed. For backward compatibility, we add an alias
|
||||
for `ChatTemplateLoadKwargs` if it doesn't exist.
|
||||
"""
|
||||
for `ChatTemplateLoadKwargs` if it doesn't exist."""
|
||||
old_import = getattr(processing_utils, "ChatTemplateLoadKwargs", None)
|
||||
new_import = getattr(processing_utils, "ProcessorChatTemplateKwargs", None)
|
||||
if old_import is None and new_import is not None:
|
||||
@@ -53,8 +52,7 @@ def _transformers_v4_compatibility_init() -> Any:
|
||||
processor instance before calling the original `ProcessorMixin.__init__`.
|
||||
|
||||
This can be removed if `Molmo2ForConditionalGeneration` is upstreamed to
|
||||
Transformers.
|
||||
"""
|
||||
Transformers."""
|
||||
if hasattr(ProcessorMixin.__init__, "_vllm_patched"):
|
||||
return
|
||||
|
||||
@@ -397,8 +395,7 @@ def get_feature_extractor(
|
||||
**kwargs: Any,
|
||||
):
|
||||
"""Load an audio feature extractor for the given model name
|
||||
via HuggingFace.
|
||||
"""
|
||||
via HuggingFace."""
|
||||
try:
|
||||
processor_name = convert_model_repo_to_path(processor_name)
|
||||
feature_extractor = AutoFeatureExtractor.from_pretrained(
|
||||
|
||||
@@ -537,8 +537,7 @@ class CohereASRFeatureExtractor(SequenceFeatureExtractor):
|
||||
|
||||
class CohereASRProcessor(ProcessorMixin):
|
||||
"""HF-compatible processor combining CohereASRFeatureExtractor and a
|
||||
tokenizer.
|
||||
"""
|
||||
tokenizer."""
|
||||
|
||||
feature_extractor_class = "CohereASRFeatureExtractor"
|
||||
tokenizer_class = "AutoTokenizer"
|
||||
|
||||
@@ -261,8 +261,7 @@ def _resize_or_pad(
|
||||
allow_upscale: bool = False,
|
||||
) -> torch.Tensor:
|
||||
"""Resize onto the aligned canvas, or keep the aspect ratio and
|
||||
zero-pad the right/bottom sides (``resize_mode="pad"``).
|
||||
"""
|
||||
zero-pad the right/bottom sides (``resize_mode="pad"``)."""
|
||||
height, width = stacked_images.shape[-2:]
|
||||
|
||||
if resize_mode == "resize":
|
||||
@@ -308,8 +307,7 @@ def _pixel_budget(
|
||||
) -> tuple[int, int]:
|
||||
"""(min_pixels, max_pixels) from the token bounds of
|
||||
``processor_config.json``; one vision token covers
|
||||
``temporal_patch_size * (patch_size * merge_size) ** 2`` pixels.
|
||||
"""
|
||||
``temporal_patch_size * (patch_size * merge_size) ** 2`` pixels."""
|
||||
if min_image_tokens is None or max_image_tokens is None:
|
||||
raise ValueError(
|
||||
"min_image_tokens and max_image_tokens must be provided by "
|
||||
|
||||
@@ -116,8 +116,7 @@ def parse_safetensors_file_metadata(path: str | PathLike) -> dict[str, Any]:
|
||||
|
||||
def convert_model_repo_to_path(model_repo: str) -> str:
|
||||
"""When VLLM_USE_MODELSCOPE is True convert a model
|
||||
repository string to a Path str.
|
||||
"""
|
||||
repository string to a Path str."""
|
||||
if not envs.VLLM_USE_MODELSCOPE or Path(model_repo).exists():
|
||||
return model_repo
|
||||
from modelscope.utils.file_utils import get_model_cache_root
|
||||
|
||||
Reference in New Issue
Block a user