Bump prime-rl to trinity-dsv41: upstream main, PR #4057 (DeepSeek V4.1 Flash) with the engram port onto the shared n-gram module, and renderers tracking its trinity-dsv41 branch (v0.2.0 + the Hermes parser). Port the envs to the current verifiers v1 API, rl.toml to the new config schema (IPO loss kept as the new default), and bootstrap/launch/prepare scripts to the new layout. Decensor now runs DecensorEnv: the simulated user writes reviewed follow-ups up to each row's target_turns and every assistant turn is judged. Earlier runs trained on the first turn only. tests/test_multiturn_env.py drives the full loop against a mock endpoint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
from __future__ import annotations
|
|
|
|
import verifiers.v1 as vf
|
|
|
|
from decensor_v1.taskset import DecensorTasksetConfig
|
|
from decensor_v1.user import DecensorUser
|
|
|
|
|
|
class DecensorEnvConfig(vf.EnvConfig):
|
|
taskset: DecensorTasksetConfig = DecensorTasksetConfig(id="decensor-v1")
|
|
assistant: vf.AgentConfig = vf.AgentConfig(
|
|
harness={"id": "null"},
|
|
runtime={"type": "subprocess"},
|
|
max_turns=6,
|
|
)
|
|
|
|
|
|
class DecensorEnv(vf.Env[DecensorEnvConfig]):
|
|
async def run(self, task: vf.Task, agents: vf.Agents) -> None:
|
|
async with agents.assistant.interaction(task) as assistant:
|
|
simulator = DecensorUser()
|
|
simulator.config = task.config.user
|
|
simulator.state = assistant.trace.state
|
|
|
|
simulator.state.target_turns = max(1, int(task.data.target_turns))
|
|
await simulator.setup_task(task.data)
|
|
|
|
segment = await assistant.turn()
|
|
while not segment.terminated:
|
|
completed = assistant.trace.num_turns
|
|
if completed >= simulator.state.target_turns:
|
|
simulator.state.user_done = True
|
|
break
|
|
|
|
follow_up = await simulator.respond(segment.last_reply)
|
|
if not follow_up:
|
|
break
|
|
segment = await assistant.turn(follow_up)
|
|
|
|
|
|
__all__ = ["DecensorEnv"]
|