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
d54990da
Unverified
Commit
d54990da
authored
Mar 02, 2025
by
Chen Zhang
Committed by
GitHub
Mar 01, 2025
Browse files
[v1] Add `__repr__` to KVCacheBlock to avoid recursive print (#14081)
parent
b9f1d429
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
vllm/v1/core/kv_cache_utils.py
vllm/v1/core/kv_cache_utils.py
+13
-0
No files found.
vllm/v1/core/kv_cache_utils.py
View file @
d54990da
...
...
@@ -128,6 +128,19 @@ class KVCacheBlock:
"""Reset the block hash when the block is evicted."""
self
.
_block_hash
=
None
def
__repr__
(
self
)
->
str
:
# Use block_id instead of KVCacheBlock object to avoid calling __repr__
# on KVCacheBlock object recursively.
prev_block_id
=
self
.
prev_free_block
.
block_id
\
if
self
.
prev_free_block
else
None
next_block_id
=
self
.
next_free_block
.
block_id
\
if
self
.
next_free_block
else
None
return
(
f
"KVCacheBlock(block_id=
{
self
.
block_id
}
, "
f
"ref_cnt=
{
self
.
ref_cnt
}
, "
f
"_block_hash=
{
self
.
_block_hash
}
, "
f
"prev_free_block=
{
prev_block_id
}
, "
f
"next_free_block=
{
next_block_id
}
)"
)
class
FreeKVCacheBlockQueue
:
"""This class organizes a list of KVCacheBlock objects to a doubly linked
...
...
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