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
2179e4f4
"git@developer.sourcefind.cn:change/sglang.git" did not exist on "ae7ee01a8e59f755d47426c4b08641053b765a89"
Unverified
Commit
2179e4f4
authored
Jul 08, 2023
by
Lily Liu
Committed by
GitHub
Jul 08, 2023
Browse files
avoid python list copy in sequence initialization (#401)
parent
a945fcc2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
vllm/sequence.py
vllm/sequence.py
+5
-3
No files found.
vllm/sequence.py
View file @
2179e4f4
...
...
@@ -127,7 +127,8 @@ class Sequence:
self
.
logical_token_blocks
.
append
(
block
)
def
_append_tokens_to_blocks
(
self
,
token_ids
:
List
[
int
])
->
None
:
while
token_ids
:
cursor
=
0
while
cursor
<
len
(
token_ids
):
if
not
self
.
logical_token_blocks
:
self
.
_append_logical_block
()
...
...
@@ -137,8 +138,9 @@ class Sequence:
last_block
=
self
.
logical_token_blocks
[
-
1
]
num_empty_slots
=
last_block
.
get_num_empty_slots
()
last_block
.
append_tokens
(
token_ids
[:
num_empty_slots
])
token_ids
=
token_ids
[
num_empty_slots
:]
last_block
.
append_tokens
(
token_ids
[
cursor
:
cursor
+
num_empty_slots
])
cursor
+=
num_empty_slots
def
append_token_id
(
self
,
...
...
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