Update deprecated type hinting in vllm/transformers_utils (#18058)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
Harry Mellor
2025-05-13 04:34:37 -07:00
committed by GitHub
parent ff334ca1cd
commit 8c946cecca
17 changed files with 98 additions and 102 deletions
+5 -5
View File
@@ -6,7 +6,7 @@ import os
import time
from functools import cache
from pathlib import Path
from typing import Any, Callable, Dict, Literal, Optional, Type, Union
from typing import Any, Callable, Literal, Optional, Union
import huggingface_hub
from huggingface_hub import hf_hub_download
@@ -55,11 +55,11 @@ HF_TOKEN = os.getenv('HF_TOKEN', None)
logger = init_logger(__name__)
_CONFIG_REGISTRY_OVERRIDE_HF: Dict[str, Type[PretrainedConfig]] = {
_CONFIG_REGISTRY_OVERRIDE_HF: dict[str, type[PretrainedConfig]] = {
"mllama": MllamaConfig
}
_CONFIG_REGISTRY: Dict[str, Type[PretrainedConfig]] = {
_CONFIG_REGISTRY: dict[str, type[PretrainedConfig]] = {
"chatglm": ChatGLMConfig,
"cohere2": Cohere2Config,
"dbrx": DbrxConfig,
@@ -199,7 +199,7 @@ def patch_rope_scaling(config: PretrainedConfig) -> None:
patch_rope_scaling_dict(rope_scaling)
def patch_rope_scaling_dict(rope_scaling: Dict[str, Any]) -> None:
def patch_rope_scaling_dict(rope_scaling: dict[str, Any]) -> None:
if "rope_type" in rope_scaling and "type" in rope_scaling:
rope_type = rope_scaling["rope_type"]
rope_type_legacy = rope_scaling["type"]
@@ -748,7 +748,7 @@ def get_hf_image_processor_config(
hf_token: Optional[Union[bool, str]] = None,
revision: Optional[str] = None,
**kwargs,
) -> Dict[str, Any]:
) -> dict[str, Any]:
# ModelScope does not provide an interface for image_processor
if VLLM_USE_MODELSCOPE:
return dict()