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
7c01f706
Unverified
Commit
7c01f706
authored
Jun 29, 2024
by
Antoni Baum
Committed by
GitHub
Jun 29, 2024
Browse files
[Core] Optimize `SequenceStatus.is_finished` by switching to IntEnum (#5974)
parent
51e971d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
14 deletions
+11
-14
vllm/sequence.py
vllm/sequence.py
+11
-14
No files found.
vllm/sequence.py
View file @
7c01f706
...
@@ -39,24 +39,21 @@ PromptLogprobs = List[Optional[Dict[int, Logprob]]]
...
@@ -39,24 +39,21 @@ PromptLogprobs = List[Optional[Dict[int, Logprob]]]
SampleLogprobs
=
List
[
Dict
[
int
,
Logprob
]]
SampleLogprobs
=
List
[
Dict
[
int
,
Logprob
]]
class
SequenceStatus
(
enum
.
Enum
):
class
SequenceStatus
(
enum
.
Int
Enum
):
"""Status of a sequence."""
"""Status of a sequence."""
WAITING
=
enum
.
auto
()
WAITING
=
0
RUNNING
=
enum
.
auto
()
RUNNING
=
1
SWAPPED
=
enum
.
auto
()
SWAPPED
=
2
FINISHED_STOPPED
=
enum
.
auto
()
# Note: anything after SWAPPED (2) will be considered
FINISHED_LENGTH_CAPPED
=
enum
.
auto
()
# as a finished status.
FINISHED_ABORTED
=
enum
.
auto
()
FINISHED_STOPPED
=
3
FINISHED_IGNORED
=
enum
.
auto
()
FINISHED_LENGTH_CAPPED
=
4
FINISHED_ABORTED
=
5
FINISHED_IGNORED
=
6
@
staticmethod
@
staticmethod
def
is_finished
(
status
:
"SequenceStatus"
)
->
bool
:
def
is_finished
(
status
:
"SequenceStatus"
)
->
bool
:
return
status
in
[
return
status
>
SequenceStatus
.
SWAPPED
SequenceStatus
.
FINISHED_STOPPED
,
SequenceStatus
.
FINISHED_LENGTH_CAPPED
,
SequenceStatus
.
FINISHED_ABORTED
,
SequenceStatus
.
FINISHED_IGNORED
,
]
@
staticmethod
@
staticmethod
def
get_finished_reason
(
status
:
"SequenceStatus"
)
->
Union
[
str
,
None
]:
def
get_finished_reason
(
status
:
"SequenceStatus"
)
->
Union
[
str
,
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