[sgl] view could hold the memory too long and introduced large memory (#19109)
This commit is contained in:
@@ -119,7 +119,14 @@ class SchedulerOutputProcessorMixin:
|
|||||||
for k, v in logits_output.customized_info.items():
|
for k, v in logits_output.customized_info.items():
|
||||||
if k not in req.customized_info:
|
if k not in req.customized_info:
|
||||||
req.customized_info[k] = []
|
req.customized_info[k] = []
|
||||||
req.customized_info[k].append(v[i])
|
# Copy the element so it doesn't retain the entire batch
|
||||||
|
# tensor/array via a view reference.
|
||||||
|
elem = v[i]
|
||||||
|
if isinstance(elem, torch.Tensor):
|
||||||
|
elem = elem.clone()
|
||||||
|
elif hasattr(elem, "copy") and callable(elem.copy):
|
||||||
|
elem = elem.copy()
|
||||||
|
req.customized_info[k].append(elem)
|
||||||
|
|
||||||
def process_batch_result_prefill(
|
def process_batch_result_prefill(
|
||||||
self: Scheduler,
|
self: Scheduler,
|
||||||
|
|||||||
Reference in New Issue
Block a user