Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
norm
vllm
Commits
f029ef94
Unverified
Commit
f029ef94
authored
Sep 18, 2023
by
Zhuohan Li
Committed by
GitHub
Sep 18, 2023
Browse files
Fix get_max_num_running_seqs for waiting and swapped seq groups (#1068)
parent
95592fa0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
vllm/sequence.py
vllm/sequence.py
+13
-2
No files found.
vllm/sequence.py
View file @
f029ef94
...
@@ -250,8 +250,8 @@ class SequenceGroup:
...
@@ -250,8 +250,8 @@ class SequenceGroup:
# generation stage, we will have `best_of` sequences running.
# generation stage, we will have `best_of` sequences running.
return
self
.
sampling_params
.
best_of
return
self
.
sampling_params
.
best_of
# At sampling stages, return the number of actual sequences
# At sampling stages, return the number of actual sequences
#
running
.
#
that are not finished yet
.
return
self
.
num_
seqs
(
status
=
SequenceStatus
.
RUNNING
)
return
self
.
num_
unfinished_seqs
(
)
def
get_seqs
(
def
get_seqs
(
self
,
self
,
...
@@ -264,12 +264,23 @@ class SequenceGroup:
...
@@ -264,12 +264,23 @@ class SequenceGroup:
seq
for
seq
in
self
.
seqs_dict
.
values
()
if
seq
.
status
==
status
seq
for
seq
in
self
.
seqs_dict
.
values
()
if
seq
.
status
==
status
]
]
def
get_unfinished_seqs
(
self
)
->
List
[
Sequence
]:
return
[
seq
for
seq
in
self
.
seqs_dict
.
values
()
if
not
seq
.
is_finished
()
]
def
get_finished_seqs
(
self
)
->
List
[
Sequence
]:
def
get_finished_seqs
(
self
)
->
List
[
Sequence
]:
return
[
seq
for
seq
in
self
.
seqs_dict
.
values
()
if
seq
.
is_finished
()]
return
[
seq
for
seq
in
self
.
seqs_dict
.
values
()
if
seq
.
is_finished
()]
def
num_seqs
(
self
,
status
:
Optional
[
SequenceStatus
]
=
None
)
->
int
:
def
num_seqs
(
self
,
status
:
Optional
[
SequenceStatus
]
=
None
)
->
int
:
return
len
(
self
.
get_seqs
(
status
))
return
len
(
self
.
get_seqs
(
status
))
def
num_unfinished_seqs
(
self
)
->
int
:
return
len
(
self
.
get_unfinished_seqs
())
def
num_finished_seqs
(
self
)
->
int
:
return
len
(
self
.
get_finished_seqs
())
def
find
(
self
,
seq_id
:
int
)
->
Sequence
:
def
find
(
self
,
seq_id
:
int
)
->
Sequence
:
if
seq_id
not
in
self
.
seqs_dict
:
if
seq_id
not
in
self
.
seqs_dict
:
raise
ValueError
(
f
"Sequence
{
seq_id
}
not found."
)
raise
ValueError
(
f
"Sequence
{
seq_id
}
not found."
)
...
...
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