[Fix] Reset output_ids for requests with input_embeds during retraction (#14110)

This commit is contained in:
Kazami Michiru
2026-03-12 03:42:21 +08:00
committed by GitHub
parent 7b44bc923e
commit e6a6cd1f0c

View File

@@ -1121,6 +1121,14 @@ class Req(ReqDllmMixin):
self.extend_batch_idx = 0
self.decode_batch_idx = 0
# When using input_embeds, we cannot easily mix the original input embeddings
# with the newly generated output token IDs during re-prefill of retracted request.
# output_ids will have no use, but will lead to wrong size cache indexes.
# Therefore, we discard the generated output_ids and restart prefill and generation
# to ensure shape consistency in KV cache.
if self.input_embeds is not None:
self.output_ids = []
def offload_kv_cache(self, req_to_token_pool, token_to_kv_pool_allocator):
token_indices = req_to_token_pool.req_to_token[
self.req_pool_idx, : self.seqlen - 1