File tree Expand file tree Collapse file tree 1 file changed +11
-14
lines changed Expand file tree Collapse file tree 1 file changed +11
-14
lines changed Original file line number Diff line number Diff line change @@ -39,24 +39,21 @@ class Logprob:
39
39
SampleLogprobs = List [Dict [int , Logprob ]]
40
40
41
41
42
- class SequenceStatus (enum .Enum ):
42
+ class SequenceStatus (enum .IntEnum ):
43
43
"""Status of a sequence."""
44
- WAITING = enum .auto ()
45
- RUNNING = enum .auto ()
46
- SWAPPED = enum .auto ()
47
- FINISHED_STOPPED = enum .auto ()
48
- FINISHED_LENGTH_CAPPED = enum .auto ()
49
- FINISHED_ABORTED = enum .auto ()
50
- FINISHED_IGNORED = enum .auto ()
44
+ WAITING = 0
45
+ RUNNING = 1
46
+ SWAPPED = 2
47
+ # Note: anything after SWAPPED (2) will be considered
48
+ # as a finished status.
49
+ FINISHED_STOPPED = 3
50
+ FINISHED_LENGTH_CAPPED = 4
51
+ FINISHED_ABORTED = 5
52
+ FINISHED_IGNORED = 6
51
53
52
54
@staticmethod
53
55
def is_finished (status : "SequenceStatus" ) -> bool :
54
- return status in [
55
- SequenceStatus .FINISHED_STOPPED ,
56
- SequenceStatus .FINISHED_LENGTH_CAPPED ,
57
- SequenceStatus .FINISHED_ABORTED ,
58
- SequenceStatus .FINISHED_IGNORED ,
59
- ]
56
+ return status > SequenceStatus .SWAPPED
60
57
61
58
@staticmethod
62
59
def get_finished_reason (status : "SequenceStatus" ) -> Union [str , None ]:
You can’t perform that action at this time.
0 commit comments