fix: page cache 分配失败越界崩溃 + 长度超限终止

- astrai/inference/scheduler.py: add_task 增加 max_seq_len 检查,超限时直接发 STOP 信号终止
- astrai/inference/scheduler.py: _maybe_alloc_page 返回 bool,alloc 失败时标记 ABORTED + 发 STOP
- astrai/inference/scheduler.py: _execute_decode 过滤分配失败任务,避免 page_table 越界
- astrai/inference/scheduler.py: _remove_finished_tasks 清理 ABORTED 任务并释放 pages
- astrai/inference/scheduler.py: _execute_prefill input_mask 改为覆盖全部 prompt_len
- astrai/model/transformer.py: seq_mask is None 分支补全 start_pos + seq_len 列
This commit is contained in:
2026-05-10 20:14:38 +08:00
parent c95ace41aa
commit a3c8296135
2 changed files with 34 additions and 8 deletions
+3 -1
View File
@@ -29,7 +29,9 @@ def process_attention_mask(
if seq_mask is None:
if start_pos != 0:
seq_mask = torch.ones((1, start_pos + seq_len), dtype=torch.bool, device=device)
seq_mask = torch.ones(
(1, start_pos + seq_len), dtype=torch.bool, device=device
)
else:
return None