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
f1bddbd8
Unverified
Commit
f1bddbd8
authored
Aug 30, 2025
by
Cyrus Leung
Committed by
GitHub
Aug 30, 2025
Browse files
[Core] Cleanup TPU model runner for MM (#23894)
Signed-off-by:
DarkLight1337
<
tlleungac@connect.ust.hk
>
parent
9748c519
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
31 deletions
+1
-31
vllm/v1/worker/tpu_model_runner.py
vllm/v1/worker/tpu_model_runner.py
+1
-31
No files found.
vllm/v1/worker/tpu_model_runner.py
View file @
f1bddbd8
...
...
@@ -808,31 +808,6 @@ class TPUModelRunner(LoRAModelRunnerMixin, KVConnectorModelRunnerMixin):
return
per_layer_attn_metadata
,
logits_indices
,
padded_num_reqs
,
\
num_reqs
,
end_index
def
_scatter_placeholders
(
self
,
embeds
:
torch
.
Tensor
,
is_embed
:
Optional
[
torch
.
Tensor
],
)
->
torch
.
Tensor
:
if
is_embed
is
None
:
return
embeds
placeholders
=
embeds
.
new_full
(
(
is_embed
.
shape
[
0
],
embeds
.
shape
[
-
1
]),
fill_value
=
torch
.
nan
,
)
placeholders
[
is_embed
]
=
embeds
return
placeholders
def
_gather_placeholders
(
self
,
placeholders
:
torch
.
Tensor
,
is_embed
:
Optional
[
torch
.
Tensor
],
)
->
torch
.
Tensor
:
if
is_embed
is
None
:
return
placeholders
return
placeholders
[
is_embed
]
def
_execute_mm_encoder
(
self
,
scheduler_output
:
"SchedulerOutput"
):
scheduled_encoder_inputs
=
scheduler_output
.
scheduled_encoder_inputs
if
not
scheduled_encoder_inputs
:
...
...
@@ -892,12 +867,7 @@ class TPUModelRunner(LoRAModelRunnerMixin, KVConnectorModelRunnerMixin):
# NOTE (NickLucche) here we diverge from logic in other runners, as we
# assume to only have whole mm items to process. Hence we avoid the
# intrinsic dynamism that `scatter_mm_placeholders` introduces.
for
(
mm_hash
,
pos_info
),
output
in
zip
(
mm_hashes_pos
,
encoder_outputs
,
):
if
req_id
not
in
self
.
encoder_cache
:
self
.
encoder_cache
[
req_id
]
=
{}
for
(
mm_hash
,
pos_info
),
output
in
zip
(
mm_hashes_pos
,
encoder_outputs
):
assert
pos_info
.
is_embed
is
None
,
"Expected all positions to be"
\
" contiguous and embeddings."
self
.
encoder_cache
[
mm_hash
]
=
output
...
...
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