fix data racing due to mutable reference using deepcopy (#1255)
This commit is contained in:
@@ -18,8 +18,9 @@ The definition of objects transfered between different
|
||||
processes (TokenizerManager, DetokenizerManager, Controller).
|
||||
"""
|
||||
|
||||
import copy
|
||||
import uuid
|
||||
from dataclasses import dataclass
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Dict, List, Optional, Union
|
||||
|
||||
from sglang.srt.managers.schedule_batch import BaseFinishReason
|
||||
@@ -249,6 +250,10 @@ class BatchTokenIDOut:
|
||||
meta_info: List[Dict]
|
||||
finished_reason: List[BaseFinishReason]
|
||||
|
||||
def __post_init__(self):
|
||||
# deepcopy meta_info to avoid modification in place
|
||||
self.meta_info = copy.deepcopy(self.meta_info)
|
||||
|
||||
|
||||
@dataclass
|
||||
class BatchStrOut:
|
||||
|
||||
Reference in New Issue
Block a user