Unverified Commit 8153168c authored by Zhiqiang Xie's avatar Zhiqiang Xie Committed by GitHub
Browse files

fix data racing due to mutable reference using deepcopy (#1255)

parent 6c34d633
......@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment