mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-15 07:24:57 +08:00
[Core] Avoid repeated len(block_token_ids) check in hash_request_tokens (#21781)
Signed-off-by: linzebing <linzebing1995@gmail.com>
This commit is contained in:
parent
b4e081cb15
commit
e0f63e4a35
@ -567,12 +567,10 @@ def hash_request_tokens(hash_function: Any, block_size: int,
|
|||||||
|
|
||||||
ret = []
|
ret = []
|
||||||
parent_block_hash_value = None
|
parent_block_hash_value = None
|
||||||
for start in range(0, len(token_ids), block_size):
|
# Only full blocks will be hashed
|
||||||
|
for start in range(0, len(token_ids) - block_size + 1, block_size):
|
||||||
end = start + block_size
|
end = start + block_size
|
||||||
block_token_ids = token_ids[start:end]
|
block_token_ids = token_ids[start:end]
|
||||||
# Do not hash the block if it is not full.
|
|
||||||
if len(block_token_ids) < block_size:
|
|
||||||
break
|
|
||||||
|
|
||||||
if req_need_extra_keys:
|
if req_need_extra_keys:
|
||||||
# MM and LoRA requests need extra keys for block-hash computation.
|
# MM and LoRA requests need extra keys for block-hash computation.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user