Skip to content

Commit 6167c0e

Browse files
zhangyuygss开哲
and
开哲
authored
[Bugfix][Core] add seq_id_to_seq_group clearing to avoid memory leak when s… (#16472)
Signed-off-by: 开哲 <kaizhe.zy@alibaba-inc.com> Co-authored-by: 开哲 <kaizhe.zy@alibaba-inc.com>
1 parent ed2e464 commit 6167c0e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

vllm/outputs.py

+7
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ def from_seq_group(
179179
group.finish_seq(seq_group)
180180
if assembled_seq_group is None:
181181
return None
182+
183+
# clear finished seq in seq_id_to_seq_group
184+
if len(group.to_be_finished) == 0:
185+
for sub_request_id in list(group.seq_id_to_index.keys()):
186+
if sub_request_id in seq_id_to_seq_group:
187+
del seq_id_to_seq_group[sub_request_id]
188+
182189
return cls.from_seq_group(assembled_seq_group, use_cache,
183190
seq_id_to_seq_group)
184191

0 commit comments

Comments
 (0)