Skip to content

Commit f352b79

Browse files
Minor Optimizations in Schedule Batch (#8724)
Co-authored-by: Suruchi Shah <[email protected]>
1 parent 6642e3a commit f352b79

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

python/sglang/srt/managers/schedule_batch.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import threading
3838
from enum import Enum, auto
3939
from http import HTTPStatus
40+
from itertools import chain
4041
from typing import TYPE_CHECKING, Any, List, Optional, Set, Tuple, Union
4142

4243
import numpy as np
@@ -1145,9 +1146,9 @@ def prepare_for_extend(self):
11451146
req_pool_indices_tensor = torch.tensor(req_pool_indices, dtype=torch.int64).to(
11461147
self.device, non_blocking=True
11471148
)
1148-
input_ids_tensor = torch.tensor(sum(input_ids, []), dtype=torch.int64).to(
1149-
self.device, non_blocking=True
1150-
)
1149+
input_ids_tensor = torch.tensor(
1150+
list(chain.from_iterable(input_ids)), dtype=torch.int64
1151+
).to(self.device, non_blocking=True)
11511152
seq_lens_tensor = torch.tensor(seq_lens, dtype=torch.int64).to(
11521153
self.device, non_blocking=True
11531154
)

0 commit comments

Comments
 (0)