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

This commit is contained in:
Zhiqiang Xie authored and GitHub committed 2024-08-28 18:57:54 -07:00
1 parent 6c34d6339c
commit 8153168c96
1 file changed
+6 -1
+6 -1
View File
@@ -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: