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
af16c050
Commit
af16c050
authored
Feb 23, 2023
by
Woosuk Kwon
Browse files
Add get_len
parent
d0945122
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
cacheflow/sequence.py
cacheflow/sequence.py
+3
-0
No files found.
cacheflow/sequence.py
View file @
af16c050
...
@@ -49,6 +49,9 @@ class Sequence:
...
@@ -49,6 +49,9 @@ class Sequence:
last_block
.
append
(
token_ids
[:
num_empty_slots
])
last_block
.
append
(
token_ids
[:
num_empty_slots
])
token_ids
=
token_ids
[
num_empty_slots
:]
token_ids
=
token_ids
[
num_empty_slots
:]
def
get_len
(
self
)
->
int
:
return
sum
(
block
.
num_tokens
for
block
in
self
.
logical_token_blocks
)
def
get_token_ids
(
self
)
->
List
[
int
]:
def
get_token_ids
(
self
)
->
List
[
int
]:
token_ids
:
List
[
int
]
=
[]
token_ids
:
List
[
int
]
=
[]
for
block
in
self
.
logical_token_blocks
:
for
block
in
self
.
logical_token_blocks
:
...
...
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