Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the possible bug of decode out of memory #36

Merged
merged 15 commits into from
Jan 19, 2024
Prev Previous commit
Next Next commit
remove old
  • Loading branch information
hnyls2002 committed Jan 18, 2024
commit ae2d1625de883479b550dc48d1a2021f32181443
15 changes: 3 additions & 12 deletions python/sglang/srt/managers/router/infer_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,6 @@ def suspend_for_decode(self):
reverse=True,
)

for i in range(len(self.reqs)):
print(
f"input: {len(self.reqs[i].input_ids)}, output: {len(self.reqs[i].output_ids)}"
)

suspended_reqs = []
seq_lens_np = self.seq_lens.cpu().numpy()
req_pool_indices_np = self.req_pool_indices.cpu().numpy()
Expand Down Expand Up @@ -289,13 +284,9 @@ def prepare_for_decode(self, input_ids=None):
self.out_cache_loc = self.token_to_kv_pool.alloc(bs)

if self.out_cache_loc is None:
self.tree_cache.evict(bs, self.token_to_kv_pool.free)
self.out_cache_loc = self.token_to_kv_pool.alloc(bs)

if self.out_cache_loc is None:
print("Decode out of memory.")
self.tree_cache.pretty_print()
exit()
print("Decode out of memory. This should nerver happen.")
self.tree_cache.pretty_print()
exit()

self.out_cache_cont_start = None
self.out_cache_cont_end = None
Expand Down