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
ef6098ec
Commit
ef6098ec
authored
Feb 24, 2023
by
Woosuk Kwon
Browse files
Merge pre_step and step
parent
53f70e73
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
13 deletions
+4
-13
cacheflow/master/scheduler.py
cacheflow/master/scheduler.py
+4
-13
No files found.
cacheflow/master/scheduler.py
View file @
ef6098ec
...
...
@@ -93,13 +93,13 @@ class Scheduler:
seq
.
status
=
SequenceStatus
.
SWAPPED
self
.
swapped
.
append
(
seq_group
)
def
pre_
step
(
self
)
->
None
:
def
step
(
self
)
->
None
:
# Blocks that need to be swaped or copied before model execution.
blocks_to_swap_in
:
Dict
[
int
,
int
]
=
{}
blocks_to_swap_out
:
Dict
[
int
,
int
]
=
{}
blocks_to_copy
:
Dict
[
int
,
int
]
=
{}
# 1.
Prepar
e new slots for the running sequences.
# 1.
Reserv
e new slots for the running sequences.
# NOTE: Here we implicitly assume FCFS scheduling.
# That is, the most recently added sequence group is the first
# to be swapped out.
...
...
@@ -159,20 +159,11 @@ class Scheduler:
else
:
self
.
pending
.
clear
()
# Execute step.
self
.
step
(
blocks_to_swap_in
,
blocks_to_swap_out
,
blocks_to_copy
)
def
step
(
self
,
blocks_to_swap_in
:
Dict
[
int
,
int
],
blocks_to_swap_out
:
Dict
[
int
,
int
],
blocks_to_copy
:
Dict
[
int
,
int
],
)
->
None
:
# Ensure that swap-in and swap-out never happen at the same timestep.
if
blocks_to_swap_in
:
assert
not
blocks_to_swap_out
# Create input data structures.
#
4.
Create input data structures.
prompt_tokens
:
Dict
[
int
,
List
[
int
]]
=
{}
generation_tokens
:
Dict
[
int
,
int
]
=
{}
context_lens
:
Dict
[
int
,
int
]
=
{}
...
...
@@ -195,7 +186,7 @@ class Scheduler:
generation_tokens
[
seq_id
]
=
seq
.
get_token_ids
()[
-
1
]
context_lens
[
seq_id
]
=
seq
.
get_len
()
# Execute the first stage of the pipeline.
#
5.
Execute the first stage of the pipeline.
self
.
controllers
[
0
].
execute_stage
(
prompt_tokens
,
generation_tokens
,
...
...
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