Files
carstenandClaude Opus 5.5 609e832572 Move to current prime-rl, verifiers and renderers; DeepSeek V4.1 support
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>
2026-11-13 14:39:44 +00:00

55 lines
2.2 KiB
Python

"""Validate configs/rl.toml and prewarm every train/eval taskset loader, without rollouts.
Loads each source's taskset exactly as the orchestrator does
(`vf.load_taskset(env.taskset).select(source.select)`, materialized), and checks the task
keys are unique, which the orchestrator's task sampler requires.
Usage (from the repo root): uv run --project prime-rl --no-sync python scripts/prepare_data.py
"""
import gc
import json
import os
import tempfile
from collections import Counter
from pathlib import Path
import verifiers.v1 as vf
from prime_rl.configs.rl import RLConfig
from pydantic_config import cli
assert os.environ.get("PYTHONHASHSEED") == "0", "run with PYTHONHASHSEED=0 to match training"
# No judge requests are made while loading; an unreachable URL keeps it that way.
text = Path("configs/rl.toml").read_text().replace("${JUDGE_BASE_URL}", "http://127.0.0.1:19999/v1")
with tempfile.NamedTemporaryFile("w", suffix=".toml") as rendered:
rendered.write(text)
rendered.flush()
config = cli(RLConfig, args=["@", rendered.name])
assert config.deployment.num_train_gpus == 2
assert config.deployment.num_infer_gpus == 6
vllm = config.inference.vllm
assert (vllm.tensor_parallel_size, vllm.data_parallel_size) == (2, 3)
assert config.trainer.model.optimization_dtype == "float32"
assert config.trainer.model.reduce_dtype == "float32"
print("CONFIG_VALID", flush=True)
for split, source in config.orchestrator.env_sources:
print("LOADING", split, source.resolved_name, flush=True)
taskset = vf.load_taskset(source.env.taskset).select(source.select)
tasks = list(taskset)
assert tasks, (split, source.resolved_name, "empty taskset")
duplicates = [key for key, count in Counter(task.key for task in tasks).items() if count > 1]
assert not duplicates, (split, source.resolved_name, f"{len(duplicates)} duplicate task keys")
subtasks = Counter(getattr(task.data, "subtask", "decensor") for task in tasks)
print(
json.dumps(
{"split": split, "environment": source.resolved_name, "rows": len(tasks), "subtasks": dict(subtasks)}
),
flush=True,
)
del tasks, taskset
gc.collect()
print("DATA_READY", flush=True)