Skip to content

Commit 692f3ad

Browse files
committed
resolve comments
1 parent 1dd4169 commit 692f3ad

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

eval_protocol/pytest/priority_scheduler.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import asyncio
2+
import copy
23
import logging
34
import os
45
import time
@@ -261,13 +262,13 @@ async def _run_eval(rows_to_eval: Union[EvaluationRow, List[EvaluationRow]]):
261262

262263
# Inject Speculation History into config.completion_params (use snapshot from when task was scheduled)
263264
if ENABLE_SPECULATION and task.history_snapshot:
264-
# Deep copy completion_params to avoid mutating shared config
265-
cp = dict(sample_state.config.completion_params) if sample_state.config.completion_params else {}
265+
# Deep copy to avoid concurrent mutation of shared nested dicts
266+
cp = copy.deepcopy(sample_state.config.completion_params) if sample_state.config.completion_params else {}
266267
max_tokens = cp.get("max_tokens", 2048)
267268
if "extra_body" not in cp:
268269
cp["extra_body"] = {}
269270

270-
cp["extra_body"]["prediction"] = " ".join(task.history_snapshot)[:max_tokens]
271+
cp["extra_body"]["prediction"] = {"type": "content", "content": " ".join(task.history_snapshot)[:max_tokens]}
271272

272273
# Create a new config with the modified completion_params (copy all fields)
273274
base_config = sample_state.config

0 commit comments

Comments
 (0)