Skip to content

Commit b1dd9e6

Browse files
committed
fix kv_cache_manager.prepare_dummy_resources
Signed-off-by: Fanrong Li <[email protected]>
1 parent 900323f commit b1dd9e6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tensorrt_llm/_torch/pyexecutor/resource_manager.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,11 @@ def prepare_resources(self, scheduled_batch: ScheduledRequests):
325325
def prepare_dummy_resources(self, dummy_requests: List[LlmRequest]):
326326
beam_width = 1
327327
for req in dummy_requests:
328-
self.impl.add_sequence(req.py_request_id, req.py_prompt_len + 1,
329-
beam_width, req)
328+
token_num = req.py_prompt_len
329+
if req.state == LlmRequestState.GENERATION_IN_PROGRESS:
330+
token_num += 1
331+
self.impl.add_sequence(req.py_request_id, token_num, beam_width,
332+
req)
330333
for _ in range(self.num_extra_kv_tokens):
331334
self.impl.add_token(req.py_request_id)
332335
for _ in range(len(req.py_draft_tokens)):

0 commit comments

Comments
 (0)