diff --git a/vllm/core/block_manager_v1.py b/vllm/core/block_manager_v1.py index e391a3b1e5a33..be093922b84f2 100644 --- a/vllm/core/block_manager_v1.py +++ b/vllm/core/block_manager_v1.py @@ -1,9 +1,10 @@ """A block manager that manages token blocks.""" from abc import ABC, abstractmethod -from collections.abc import Sequence as GenericSequence from itertools import count, takewhile from os.path import commonprefix -from typing import Dict, List, Optional, Set +from typing import Dict, List, Optional +from typing import Sequence as GenericSequence +from typing import Set from vllm.block import BlockTable, PhysicalTokenBlock from vllm.core.evictor import EvictionPolicy, Evictor, make_evictor diff --git a/vllm/core/block_manager_v2.py b/vllm/core/block_manager_v2.py index 19f0cf415eb34..6339a6baf4161 100644 --- a/vllm/core/block_manager_v2.py +++ b/vllm/core/block_manager_v2.py @@ -1,6 +1,6 @@ """A block manager that manages token blocks.""" -from collections.abc import Sequence as GenericSequence from typing import Dict, List, Optional +from typing import Sequence as GenericSequence from vllm.core.block.block_table import BlockTable from vllm.core.block.cpu_gpu_block_allocator import CpuGpuBlockAllocator diff --git a/vllm/core/interfaces.py b/vllm/core/interfaces.py index c1f68a2e891bf..56c2c5995c38b 100644 --- a/vllm/core/interfaces.py +++ b/vllm/core/interfaces.py @@ -1,7 +1,7 @@ import enum from abc import ABC, abstractmethod -from collections.abc import Sequence as GenericSequence from typing import Dict, List +from typing import Sequence as GenericSequence from vllm.sequence import Sequence, SequenceGroup diff --git a/vllm/utils.py b/vllm/utils.py index 4c0dc9ca729a9..aad62516ad1b9 100644 --- a/vllm/utils.py +++ b/vllm/utils.py @@ -6,11 +6,12 @@ import socket import subprocess import uuid import warnings -from collections import OrderedDict, defaultdict +from collections import defaultdict from functools import lru_cache, partial from platform import uname from typing import (Any, AsyncIterator, Awaitable, Callable, Dict, Generic, - Hashable, List, Optional, Tuple, TypeVar, Union) + Hashable, List, Optional, OrderedDict, Tuple, TypeVar, + Union) import psutil import torch @@ -51,7 +52,7 @@ class Counter: class LRUCache(Generic[T]): def __init__(self, capacity: int): - self.cache = OrderedDict[Hashable, T]() + self.cache: OrderedDict[Hashable, T] = OrderedDict() self.capacity = capacity def __contains__(self, key: Hashable) -> bool: