Skip to content

Commit c9decdb

Browse files
authored
fix
1 parent f5cbcc1 commit c9decdb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lightllm/models/deepseek2/infer_struct.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,7 @@ def __init__(self):
1010

1111
def init_some_extra_state(self, model, input_ids: torch.Tensor):
1212
super().init_some_extra_state(model, input_ids)
13-
self.kv_starts = torch.cat([self.b_start_loc, self.b_start_loc[-1:] + self.b_seq_len[-1:]], dim=0)
13+
# 只有 decode 阶段使用 ppl 的优化算子才会有这个管理变量
14+
if not self.is_prefill:
15+
self.kv_starts = torch.cat([self.b_start_loc, self.b_start_loc[-1:] + self.b_seq_len[-1:]], dim=0)
1416
return

0 commit comments

Comments
 (0)