Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
2f171176
Unverified
Commit
2f171176
authored
Sep 25, 2025
by
Cyrus Leung
Committed by
GitHub
Sep 25, 2025
Browse files
[mypy] Fix wrong type annotations related to tuple (#25660)
Signed-off-by:
DarkLight1337
<
tlleungac@connect.ust.hk
>
parent
1e9a77e0
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
25 additions
and
20 deletions
+25
-20
benchmarks/kernels/benchmark_lora.py
benchmarks/kernels/benchmark_lora.py
+4
-4
tests/engine/test_arg_utils.py
tests/engine/test_arg_utils.py
+3
-0
tests/kernels/core/test_pos_encoding.py
tests/kernels/core/test_pos_encoding.py
+1
-1
tests/kernels/test_onednn.py
tests/kernels/test_onednn.py
+2
-2
tests/models/multimodal/generation/vlm_utils/types.py
tests/models/multimodal/generation/vlm_utils/types.py
+6
-6
tests/v1/sample/test_sampler.py
tests/v1/sample/test_sampler.py
+5
-3
tests/v1/spec_decode/test_eagle.py
tests/v1/spec_decode/test_eagle.py
+1
-1
vllm/distributed/device_communicators/ray_communicator.py
vllm/distributed/device_communicators/ray_communicator.py
+1
-1
vllm/logits_process.py
vllm/logits_process.py
+2
-2
No files found.
benchmarks/kernels/benchmark_lora.py
View file @
2f171176
...
...
@@ -79,9 +79,9 @@ def make_rand_lora_weight_tensor(
def
make_rand_tensors
(
a_shape
:
tuple
[
int
],
b_shape
:
tuple
[
int
],
c_shape
:
tuple
[
int
],
a_shape
:
tuple
[
int
,
...
],
b_shape
:
tuple
[
int
,
...
],
c_shape
:
tuple
[
int
,
...
],
a_dtype
:
torch
.
dtype
,
b_dtype
:
torch
.
dtype
,
c_dtype
:
torch
.
dtype
,
...
...
@@ -243,7 +243,7 @@ class OpType(Enum):
lora_rank
:
int
,
num_loras
:
int
,
num_slices
:
int
,
)
->
tuple
[
tuple
[
int
],
tuple
[
int
],
tuple
[
int
]]:
)
->
tuple
[
tuple
[
int
,
...
],
tuple
[
int
,
...
],
tuple
[
int
,
...
]]:
"""
Given num_slices, return the shapes of the A, B, and C matrices
in A x B = C, for the op_type
...
...
tests/engine/test_arg_utils.py
View file @
2f171176
...
...
@@ -50,8 +50,11 @@ def test_is_type(type_hint, type, expected):
@
pytest
.
mark
.
parametrize
((
"type_hints"
,
"type"
,
"expected"
),
[
({
float
,
int
},
int
,
True
),
({
int
,
tuple
},
int
,
True
),
({
int
,
tuple
[
int
]},
int
,
True
),
({
int
,
tuple
[
int
,
...]},
int
,
True
),
({
int
,
tuple
[
int
]},
float
,
False
),
({
int
,
tuple
[
int
,
...]},
float
,
False
),
({
str
,
Literal
[
"x"
,
"y"
]},
Literal
,
True
),
])
def
test_contains_type
(
type_hints
,
type
,
expected
):
...
...
tests/kernels/core/test_pos_encoding.py
View file @
2f171176
...
...
@@ -60,7 +60,7 @@ TENSORS_SHAPES_FN = [
@
torch
.
inference_mode
()
def
test_rotary_embedding
(
is_neox_style
:
bool
,
tensor_shape_fn
:
Callable
[[
int
,
int
,
int
,
int
],
tuple
[
int
]],
tensor_shape_fn
:
Callable
[[
int
,
int
,
int
,
int
],
tuple
[
int
,
...
]],
batch_size
:
int
,
seq_len
:
int
,
num_heads
:
int
,
...
...
tests/kernels/test_onednn.py
View file @
2f171176
...
...
@@ -165,7 +165,7 @@ def onednn_gemm_test_helper(primitive_cache_size: int,
def
test_onednn_int8_scaled_gemm
(
n
:
int
,
k
:
int
,
m_list
:
tuple
[
int
],
m_list
:
tuple
[
int
,
...
],
per_tensor_a_scale
:
bool
,
per_tensor_b_scale
:
bool
,
use_bias
:
bool
,
...
...
@@ -196,7 +196,7 @@ def test_onednn_int8_scaled_gemm(
def
test_onednn_gemm
(
n
:
int
,
k
:
int
,
m_list
:
tuple
[
int
],
m_list
:
tuple
[
int
,
...
],
use_bias
:
bool
,
use_stride
:
bool
,
dtype
:
torch
.
dtype
,
...
...
tests/models/multimodal/generation/vlm_utils/types.py
View file @
2f171176
...
...
@@ -101,7 +101,7 @@ class VLMTestInfo(NamedTuple):
# Function for converting ImageAssets to image embeddings;
# We need to define this explicitly for embedding tests
convert_assets_to_embeddings
:
Optional
[
Callable
[[
ImageTestAssets
],
torch
.
Tensor
]]
=
None
list
[
torch
.
Tensor
]]
]
=
None
# Exposed options for vLLM runner; we change these in a several tests,
# but the defaults are derived from VllmRunner & the engine defaults
...
...
@@ -137,12 +137,12 @@ class VLMTestInfo(NamedTuple):
# Default expandable params per test; these defaults can be overridden in
# instances of this object; the complete set of test cases for the model
# is all combinations of .models + all fields below
max_tokens
:
Union
[
int
,
tuple
[
int
]]
=
128
num_logprobs
:
Union
[
int
,
tuple
[
int
]]
=
5
dtype
:
Union
[
str
,
Union
[
list
[
str
],
tuple
[
str
,
...]]]
=
"auto"
distributed_executor_backend
:
Optional
[
Union
[
str
,
Iterable
[
str
]]
]
=
None
max_tokens
:
int
=
128
num_logprobs
:
int
=
5
dtype
:
str
=
"auto"
distributed_executor_backend
:
Optional
[
str
]
=
None
# Only expanded in video tests
num_video_frames
:
Union
[
int
,
tuple
[
int
]]
=
16
num_video_frames
:
int
=
16
# Fixed image sizes / image size factors; most tests use image_size_factors
# The values provided for these two fields will be stacked and expanded
...
...
tests/v1/sample/test_sampler.py
View file @
2f171176
...
...
@@ -72,8 +72,10 @@ def _create_allowed_token_ids(
def
_create_bad_words_token_ids
(
batch_size
:
int
,
vocab_size
:
int
,
bad_words_lengths
:
list
[
tuple
[
int
]])
->
dict
[
int
,
list
[
list
[
int
]]]:
batch_size
:
int
,
vocab_size
:
int
,
bad_words_lengths
:
tuple
[
int
,
...],
)
->
dict
[
int
,
list
[
list
[
int
]]]:
bad_words_token_ids
=
{}
for
batch_idx
in
range
(
batch_size
):
token_ids_single_batch
=
[]
...
...
@@ -402,7 +404,7 @@ def test_sampler_allowed_token_ids(device: str, batch_size: int,
@
pytest
.
mark
.
parametrize
(
"batch_size"
,
[
1
,
2
,
32
])
@
pytest
.
mark
.
parametrize
(
"bad_words_lengths"
,
[(
1
,
),
(
1
,
3
),
(
2
,
2
)])
def
test_sampler_bad_words
(
device
:
str
,
batch_size
:
int
,
bad_words_lengths
:
list
[
tuple
[
int
]
]):
bad_words_lengths
:
tuple
[
int
,
...
]):
"""
Test to verify that when the bad words restriction is present, tokens
are penalized based on their match with the bad words.
...
...
tests/v1/spec_decode/test_eagle.py
View file @
2f171176
...
...
@@ -30,7 +30,7 @@ eagle3_dir = "yuhuili/EAGLE3-LLaMA3.1-Instruct-8B"
def
_create_proposer
(
method
:
str
,
num_speculative_tokens
:
int
,
speculative_token_tree
:
Optional
[
list
[
tuple
[
int
]]]
=
None
,
speculative_token_tree
:
Optional
[
list
[
tuple
[
int
,
...
]]]
=
None
,
)
->
EagleProposer
:
model_config
=
ModelConfig
(
model
=
model_dir
,
runner
=
"generate"
,
...
...
vllm/distributed/device_communicators/ray_communicator.py
View file @
2f171176
...
...
@@ -178,7 +178,7 @@ class RayPPCommunicator(Communicator):
def
recv
(
self
,
shape
:
tuple
[
int
],
shape
:
tuple
[
int
,
...
],
dtype
:
"torch.dtype"
,
peer_rank
:
int
,
allocator
:
TorchTensorAllocator
,
...
...
vllm/logits_process.py
View file @
2f171176
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from
collections.abc
import
Sequence
from
typing
import
Callable
,
Union
import
torch
...
...
@@ -55,7 +55,7 @@ class NoBadWordsLogitsProcessor:
def
__call__
(
self
,
past_tokens_ids
:
Union
[
list
[
int
],
tupl
e
[
int
]
]
,
past_tokens_ids
:
Sequenc
e
[
int
],
logits
:
torch
.
FloatTensor
,
)
->
torch
.
Tensor
:
if
self
.
word_bias
is
None
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment