mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2026-03-16 14:07:13 +08:00
[Refactor] Refactor import utils (#20269)
Signed-off-by: yewentao256 <zhyanwentao@126.com>
This commit is contained in:
parent
9290de5667
commit
e81fbefe8a
@ -76,7 +76,7 @@ line-length = 80
|
|||||||
"vllm/spec_decode/**/*.py" = ["UP006", "UP035"]
|
"vllm/spec_decode/**/*.py" = ["UP006", "UP035"]
|
||||||
"vllm/worker/**/*.py" = ["UP006", "UP035"]
|
"vllm/worker/**/*.py" = ["UP006", "UP035"]
|
||||||
# Python 3.8 typing - skip utils for ROCm
|
# Python 3.8 typing - skip utils for ROCm
|
||||||
"vllm/utils.py" = ["UP006", "UP035"]
|
"vllm/utils/__init__.py" = ["UP006", "UP035"]
|
||||||
|
|
||||||
[tool.ruff.lint]
|
[tool.ruff.lint]
|
||||||
select = [
|
select = [
|
||||||
|
|||||||
@ -25,7 +25,7 @@ infiles += [
|
|||||||
infiles += [
|
infiles += [
|
||||||
"vllm/model_executor/layers/sampler.py",
|
"vllm/model_executor/layers/sampler.py",
|
||||||
"vllm/sampling_params.py",
|
"vllm/sampling_params.py",
|
||||||
"vllm/utils.py",
|
"vllm/utils/__init__.py",
|
||||||
]
|
]
|
||||||
|
|
||||||
setup(ext_modules=cythonize(infiles,
|
setup(ext_modules=cythonize(infiles,
|
||||||
|
|||||||
@ -26,7 +26,6 @@ except ImportError:
|
|||||||
# add to this list if absolutely necessary and after careful security review.
|
# add to this list if absolutely necessary and after careful security review.
|
||||||
ALLOWED_FILES = set([
|
ALLOWED_FILES = set([
|
||||||
# pickle
|
# pickle
|
||||||
'vllm/utils.py',
|
|
||||||
'vllm/v1/serial_utils.py',
|
'vllm/v1/serial_utils.py',
|
||||||
'vllm/v1/executor/multiproc_executor.py',
|
'vllm/v1/executor/multiproc_executor.py',
|
||||||
'vllm/multimodal/hasher.py',
|
'vllm/multimodal/hasher.py',
|
||||||
@ -54,7 +53,7 @@ ALLOWED_FILES = set([
|
|||||||
'vllm/entrypoints/llm.py',
|
'vllm/entrypoints/llm.py',
|
||||||
'tests/utils.py',
|
'tests/utils.py',
|
||||||
# pickle and cloudpickle
|
# pickle and cloudpickle
|
||||||
'vllm/utils.py',
|
'vllm/utils/__init__.py',
|
||||||
'vllm/v1/serial_utils.py',
|
'vllm/v1/serial_utils.py',
|
||||||
'vllm/v1/executor/multiproc_executor.py',
|
'vllm/v1/executor/multiproc_executor.py',
|
||||||
'vllm/transformers_utils/config.py',
|
'vllm/transformers_utils/config.py',
|
||||||
|
|||||||
@ -39,14 +39,14 @@ from argparse import (Action, ArgumentDefaultsHelpFormatter, ArgumentParser,
|
|||||||
from asyncio import FIRST_COMPLETED, AbstractEventLoop, Task
|
from asyncio import FIRST_COMPLETED, AbstractEventLoop, Task
|
||||||
from collections import UserDict, defaultdict
|
from collections import UserDict, defaultdict
|
||||||
from collections.abc import (AsyncGenerator, Awaitable, Collection, Generator,
|
from collections.abc import (AsyncGenerator, Awaitable, Collection, Generator,
|
||||||
Hashable, Iterable, Iterator, KeysView, Mapping)
|
Hashable, Iterable, Iterator, KeysView, Mapping,
|
||||||
|
Sequence)
|
||||||
from concurrent.futures.process import ProcessPoolExecutor
|
from concurrent.futures.process import ProcessPoolExecutor
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from functools import cache, lru_cache, partial, wraps
|
from functools import cache, lru_cache, partial, wraps
|
||||||
from types import MappingProxyType
|
from types import MappingProxyType
|
||||||
from typing import (TYPE_CHECKING, Any, Callable, Generic, Literal, NamedTuple,
|
from typing import (TYPE_CHECKING, Any, Callable, Generic, Literal, NamedTuple,
|
||||||
Optional, Sequence, Tuple, Type, TypeVar, Union, cast,
|
Optional, TypeVar, Union, cast, overload)
|
||||||
overload)
|
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
@ -1921,9 +1921,9 @@ class LazyDict(Mapping[str, T], Generic[T]):
|
|||||||
return len(self._factory)
|
return len(self._factory)
|
||||||
|
|
||||||
|
|
||||||
class ClassRegistry(UserDict[Type[T], _V]):
|
class ClassRegistry(UserDict[type[T], _V]):
|
||||||
|
|
||||||
def __getitem__(self, key: Type[T]) -> _V:
|
def __getitem__(self, key: type[T]) -> _V:
|
||||||
for cls in key.mro():
|
for cls in key.mro():
|
||||||
if cls in self.data:
|
if cls in self.data:
|
||||||
return self.data[cls]
|
return self.data[cls]
|
||||||
@ -2234,7 +2234,7 @@ def direct_register_custom_op(
|
|||||||
fake_impl: Optional[Callable] = None,
|
fake_impl: Optional[Callable] = None,
|
||||||
target_lib: Optional[Library] = None,
|
target_lib: Optional[Library] = None,
|
||||||
dispatch_key: str = "CUDA",
|
dispatch_key: str = "CUDA",
|
||||||
tags: Tuple[torch.Tag, ...] = (),
|
tags: tuple[torch.Tag, ...] = (),
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
`torch.library.custom_op` can have significant overhead because it
|
`torch.library.custom_op` can have significant overhead because it
|
||||||
@ -2489,7 +2489,7 @@ def get_exception_traceback():
|
|||||||
return err_str
|
return err_str
|
||||||
|
|
||||||
|
|
||||||
def split_zmq_path(path: str) -> Tuple[str, str, str]:
|
def split_zmq_path(path: str) -> tuple[str, str, str]:
|
||||||
"""Split a zmq path into its parts."""
|
"""Split a zmq path into its parts."""
|
||||||
parsed = urlparse(path)
|
parsed = urlparse(path)
|
||||||
if not parsed.scheme:
|
if not parsed.scheme:
|
||||||
Loading…
x
Reference in New Issue
Block a user