add lora name as non breaking change

Signed-off-by: Sage Ahrac <sagiahrak@gmail.com>
This commit is contained in:
Sage Ahrac 2025-12-16 20:33:55 +02:00
parent ec3b890c14
commit a86ef76c15
No known key found for this signature in database
6 changed files with 12 additions and 4 deletions

View File

@ -28,8 +28,9 @@ class BlockStored(KVCacheEvent):
parent_block_hash: ExternalBlockHash | None
token_ids: list[int]
block_size: int
lora_name: str | None
lora_id: int | None
medium: str | None
lora_name: str | None
class BlockRemoved(KVCacheEvent):

View File

@ -635,6 +635,7 @@ def test_kv_cache_events(
"Block size should be the same as the block size"
)
assert event.parent_block_hash is None, "Parent block hash should be None"
assert event.lora_id is None, "Lora id should be None"
assert event.lora_name is None, "Lora name should be None"
assert len(event.token_ids) == num_blocks * block_size, (
"Token ids should be the same as the custom tokens"

View File

@ -527,6 +527,7 @@ def test_offloading_connector(request_runner):
assert event.medium == "A"
assert event.token_ids == []
assert event.parent_block_hash is None
assert event.lora_id is None
assert event.lora_name is None
event = events[1]
assert isinstance(event, BlockRemoved)

View File

@ -51,8 +51,9 @@ class BlockStored(KVCacheEvent):
parent_block_hash: ExternalBlockHash | None
token_ids: list[int]
block_size: int
lora_name: str | None
lora_id: int | None
medium: str | None
lora_name: str | None
def __hash__(self) -> int:
return hash(

View File

@ -402,9 +402,10 @@ class OffloadingConnectorScheduler:
block_hashes=event.block_hashes,
parent_block_hash=None,
token_ids=[],
lora_name=None,
lora_id=None,
block_size=event.block_size,
medium=event.medium,
lora_name=None,
)

View File

@ -284,10 +284,13 @@ class BlockPool:
num_cached_blocks * block_size : num_full_blocks * block_size
],
block_size=block_size,
lora_name=request.lora_request.name
lora_id=request.lora_request.adapter_id
if request.lora_request
else None,
medium=MEDIUM_GPU,
lora_name=request.lora_request.name
if request.lora_request
else None,
)
)