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
0af3abe3
Unverified
Commit
0af3abe3
authored
Sep 03, 2024
by
Woosuk Kwon
Committed by
GitHub
Sep 03, 2024
Browse files
[TPU][Bugfix] Fix next_token_ids shape (#8128)
parent
f1575dc9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
vllm/worker/tpu_model_runner.py
vllm/worker/tpu_model_runner.py
+4
-1
No files found.
vllm/worker/tpu_model_runner.py
View file @
0af3abe3
...
...
@@ -601,7 +601,7 @@ class TPUModelRunner(ModelRunnerBase[ModelInputForTPU]):
batch_idx
+=
1
else
:
for
seq_id
in
seq_ids
:
next_token_id
=
next_token_ids
[
batch_idx
]
[
0
]
next_token_id
=
next_token_ids
[
batch_idx
]
seq_outputs
.
append
(
SequenceOutput
(
seq_id
,
next_token_id
,
{
next_token_id
:
zero_logprob
}))
...
...
@@ -722,6 +722,9 @@ class ModelWrapper(TorchCompileWrapperWithCustomDispacther):
sampled_token_ids
=
torch
.
multinomial
(
probs
,
num_samples
,
replacement
=
True
)
if
num_samples
==
1
:
argmax_token_ids
=
argmax_token_ids
.
squeeze
(
dim
=-
1
)
sampled_token_ids
=
sampled_token_ids
.
squeeze
(
dim
=-
1
)
next_token_ids
=
torch
.
where
(
t
!=
0
,
sampled_token_ids
,
argmax_token_ids
)
return
next_token_ids
...
...
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