Skip to content

Commit

Permalink
[Typing] Fix Sequence type GenericAlias only available after Python 3…
Browse files Browse the repository at this point in the history
….9. (#4092)
  • Loading branch information
rkooo567 authored Apr 15, 2024
1 parent 4695397 commit 37e84a4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions vllm/core/block_manager_v1.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion vllm/core/block_manager_v2.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion vllm/core/interfaces.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
7 changes: 4 additions & 3 deletions vllm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
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
Expand Down Expand Up @@ -51,7 +52,7 @@ def reset(self) -> None:
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:
Expand Down

0 comments on commit 37e84a4

Please sign in to comment.