Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90e9ae98bf | ||
|
|
67cdc55521 | ||
|
|
d3e478d732 | ||
|
|
d8698f4e53 |
@@ -69,6 +69,12 @@ jobs:
|
||||
- test: reverse_text
|
||||
runner: vm
|
||||
pytest_args: "tests/integration/test_reverse_text.py"
|
||||
- test: reverse_text_rl_opd
|
||||
runner: vm
|
||||
pytest_args: "tests/integration/test_reverse_text_rl_opd.py"
|
||||
- test: reverse_text_rl_sft
|
||||
runner: vm
|
||||
pytest_args: "tests/integration/test_reverse_text_rl_sft.py"
|
||||
- test: alphabet_sort
|
||||
runner: vm
|
||||
pytest_args: "tests/integration/test_alphabet_sort.py"
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
# Smoke test for the RL-entrypoint OPD (on-policy distillation) training mode.
|
||||
# The student inference deployment is launched by the rl entrypoint on GPU 0;
|
||||
# the teacher inference server is started externally by the test fixture (see
|
||||
# tests/integration/test_reverse_text_rl_opd.py) on the same GPU. Trainer
|
||||
# takes GPU 1. Training config mirrors `reverse_text/start.toml`.
|
||||
|
||||
max_steps = 5
|
||||
seq_len = 2048
|
||||
|
||||
[model]
|
||||
name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-SFT"
|
||||
|
||||
[wandb]
|
||||
project = "reverse-text-ci"
|
||||
name = "ci-rl-opd"
|
||||
|
||||
[orchestrator]
|
||||
training_mode = "opd"
|
||||
batch_size = 128
|
||||
rollouts_per_example = 16
|
||||
|
||||
[orchestrator.renderer]
|
||||
name = "qwen3"
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "reverse-text"
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 1
|
||||
num_examples = 16
|
||||
|
||||
[orchestrator.eval.sampling]
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
id = "reverse-text"
|
||||
|
||||
[orchestrator.teacher.model]
|
||||
name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL"
|
||||
|
||||
[orchestrator.teacher.client]
|
||||
base_url = ["http://localhost:8001/v1"]
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
|
||||
[inference]
|
||||
gpu_memory_utilization = 0.4
|
||||
@@ -0,0 +1,48 @@
|
||||
# Smoke test for the RL-entrypoint SFT (on-policy hard distillation) training
|
||||
# mode. The student inference deployment is launched by the rl entrypoint on
|
||||
# GPU 0; the teacher inference server is started externally by the test
|
||||
# fixture (see tests/integration/test_reverse_text_rl_sft.py) on the same GPU.
|
||||
# Trainer takes GPU 1. Training config mirrors `reverse_text/start.toml`.
|
||||
|
||||
max_steps = 5
|
||||
seq_len = 2048
|
||||
|
||||
[model]
|
||||
name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-SFT"
|
||||
|
||||
[wandb]
|
||||
project = "reverse-text-ci"
|
||||
name = "ci-rl-sft"
|
||||
|
||||
[orchestrator]
|
||||
training_mode = "sft"
|
||||
batch_size = 128
|
||||
rollouts_per_example = 16
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "reverse-text"
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 1
|
||||
num_examples = 16
|
||||
|
||||
[orchestrator.eval.sampling]
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
id = "reverse-text"
|
||||
|
||||
[orchestrator.teacher.model]
|
||||
name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL"
|
||||
|
||||
[orchestrator.teacher.client]
|
||||
base_url = ["http://localhost:8001/v1"]
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
|
||||
[inference]
|
||||
gpu_memory_utilization = 0.4
|
||||
Vendored
+1
-1
Submodule deps/pydantic-config updated: b6a2411e44...ab3a8e7d5d
@@ -6,10 +6,7 @@ readme = "README.md"
|
||||
requires-python = "~=3.12.0"
|
||||
dependencies = [
|
||||
"pydantic>=1.10.13",
|
||||
# The PyPI package named `pydantic-config` is a different project that
|
||||
# doesn't expose `BaseConfig` / `cli`. Pin to samsja's fork so plain
|
||||
# `pip install prime-rl-configs` (no uv workspace context) resolves it.
|
||||
"pydantic-config @ git+https://github.com/samsja/pydantic_config.git",
|
||||
"prime-pydantic-config>=0.3.0.dev80",
|
||||
# OrchestratorConfig validates renderer.name='auto' against
|
||||
# renderers.base.MODEL_RENDERER_MAP. Renderers itself is light; its only
|
||||
# weighty transitive (transformers) is lazy-imported via the validator,
|
||||
|
||||
+4
-4
@@ -42,8 +42,8 @@ dependencies = [
|
||||
rl = "prime_rl.entrypoints.rl:main"
|
||||
sft = "prime_rl.entrypoints.sft:main"
|
||||
inference = "prime_rl.entrypoints.inference:main"
|
||||
trainer = "prime_rl.trainer.rl.train:main"
|
||||
orchestrator = "prime_rl.orchestrator.orchestrator:main"
|
||||
trainer = "prime_rl.entrypoints.trainer:main"
|
||||
orchestrator = "prime_rl.entrypoints.orchestrator:main"
|
||||
env-server = "prime_rl.orchestrator.env_server.env_server:main"
|
||||
|
||||
[project.entry-points."vllm.general_plugins"]
|
||||
@@ -124,6 +124,7 @@ dev = [
|
||||
[tool.uv.workspace]
|
||||
members = [
|
||||
"packages/prime-rl-configs",
|
||||
"deps/pydantic-config",
|
||||
"deps/verifiers",
|
||||
"deps/renderers",
|
||||
"deps/verifiers/environments/alphabet_sort",
|
||||
@@ -186,7 +187,6 @@ prime-evals = false
|
||||
# Trusted git/URL sources pinned by rev or wheel URL (defensive: belt-and-suspenders)
|
||||
vllm-router = false
|
||||
dion = false
|
||||
pydantic-config = false
|
||||
deep-ep = false
|
||||
deep-gemm = false
|
||||
nixl-cu12 = false
|
||||
@@ -229,7 +229,7 @@ torchtitan = { git = "https://github.com/pytorch/torchtitan", rev = "a1fdd7e" }
|
||||
dion = { git = "https://github.com/samsja/dion.git", rev = "d891eeb" }
|
||||
transformers = { git = "https://github.com/huggingface/transformers.git", rev = "c1c3424" }
|
||||
flash-attn-4 = { git = "https://github.com/Dao-AILab/flash-attention.git", subdirectory = "flash_attn/cute", rev = "96bd151" }
|
||||
pydantic-config = { git = "https://github.com/samsja/pydantic_config.git", branch = "main" }
|
||||
prime-pydantic-config = { workspace = true }
|
||||
vllm-router = { url = "https://github.com/PrimeIntellect-ai/router/releases/download/v0.1.22/vllm_router-0.1.22-cp38-abi3-manylinux_2_28_x86_64.whl" }
|
||||
vllm = [
|
||||
{ url = "https://github.com/vllm-project/vllm/releases/download/v0.21.0/vllm-0.21.0+cu129-cp38-abi3-manylinux_2_34_x86_64.whl", marker = "platform_machine == 'x86_64'" },
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
"""Lightweight launcher for the orchestrator.
|
||||
|
||||
Defers heavy ML imports (verifiers, transformers, pandas, prime_rl.trainer.*)
|
||||
until after ``cli()`` parses CLI args, so ``orchestrator --help`` short-circuits
|
||||
in ``cli()`` and returns in ~0.5 s instead of ~9 s.
|
||||
|
||||
The actual orchestrator implementation lives in
|
||||
``prime_rl.orchestrator.orchestrator``, which is also runnable as
|
||||
``python -m prime_rl.orchestrator.orchestrator``.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
|
||||
from prime_rl.configs.orchestrator import OrchestratorConfig
|
||||
from prime_rl.utils.config import cli
|
||||
from prime_rl.utils.process import set_proc_title
|
||||
|
||||
|
||||
def main():
|
||||
set_proc_title("Orchestrator")
|
||||
config = cli(OrchestratorConfig)
|
||||
from prime_rl.orchestrator.orchestrator import orchestrate
|
||||
|
||||
asyncio.run(orchestrate(config))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -12,23 +12,18 @@ from threading import Event, Thread
|
||||
import pynvml
|
||||
import tomli_w
|
||||
|
||||
import prime_rl._compat # noqa: F401 — patch ring_flash_attn compat before transitive import
|
||||
from prime_rl.configs.rl import RLConfig
|
||||
from prime_rl.trainer.model import pre_download_model
|
||||
from prime_rl.utils.config import cli
|
||||
from prime_rl.utils.logger import get_logger, setup_logger
|
||||
from prime_rl.utils.pathing import (
|
||||
clean_future_steps,
|
||||
format_log_message,
|
||||
get_ckpt_dir,
|
||||
get_log_dir,
|
||||
resolve_latest_ckpt_step,
|
||||
validate_output_dir,
|
||||
)
|
||||
from prime_rl.utils.process import cleanup_processes, cleanup_threads, monitor_process, set_proc_title
|
||||
from prime_rl.utils.utils import (
|
||||
get_free_port,
|
||||
get_log_dir,
|
||||
)
|
||||
|
||||
RL_TOML = "rl.toml"
|
||||
RL_SBATCH = "rl.sbatch"
|
||||
@@ -275,6 +270,8 @@ def rl_local(config: RLConfig):
|
||||
monitor_threads.append(monitor_thread)
|
||||
|
||||
# Start training process
|
||||
from prime_rl.utils.utils import get_free_port
|
||||
|
||||
trainer_cmd = [
|
||||
"torchrun",
|
||||
"--role=trainer",
|
||||
@@ -544,6 +541,8 @@ def rl(config: RLConfig):
|
||||
clean_future_steps(config.output_dir, -1)
|
||||
|
||||
if not config.dry_run:
|
||||
from prime_rl.trainer.model import pre_download_model
|
||||
|
||||
pre_download_model(config.trainer.model.name)
|
||||
|
||||
if config.slurm is not None:
|
||||
|
||||
@@ -8,14 +8,11 @@ from threading import Event, Thread
|
||||
|
||||
import tomli_w
|
||||
|
||||
import prime_rl._compat # noqa: F401 — patch ring_flash_attn compat before transitive import
|
||||
from prime_rl.configs.sft import SFTConfig
|
||||
from prime_rl.trainer.model import pre_download_model
|
||||
from prime_rl.utils.config import cli
|
||||
from prime_rl.utils.logger import setup_logger
|
||||
from prime_rl.utils.pathing import format_log_message, get_config_dir, get_log_dir, validate_output_dir
|
||||
from prime_rl.utils.process import cleanup_processes, cleanup_threads, monitor_process, set_proc_title
|
||||
from prime_rl.utils.utils import get_free_port
|
||||
|
||||
SFT_TOML = "sft.toml"
|
||||
SFT_SBATCH = "sft.sbatch"
|
||||
@@ -115,6 +112,8 @@ def sft_local(config: SFTConfig):
|
||||
log_dir = config.output_dir / "logs"
|
||||
log_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
from prime_rl.utils.utils import get_free_port
|
||||
|
||||
trainer_cmd = [
|
||||
"torchrun",
|
||||
"--role=trainer",
|
||||
@@ -199,6 +198,8 @@ def sft(config: SFTConfig):
|
||||
config.output_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
if not config.dry_run:
|
||||
from prime_rl.trainer.model import pre_download_model
|
||||
|
||||
pre_download_model(config.model.name)
|
||||
|
||||
if config.slurm is not None:
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
"""Lightweight launcher for the RL trainer.
|
||||
|
||||
Defers heavy ML imports (torch, transformers, torchtitan, ring_flash_attn,
|
||||
prime_rl.trainer.*) until after ``cli()`` parses CLI args, so ``trainer --help``
|
||||
short-circuits in ``cli()`` and returns in ~0.5 s instead of ~10 s.
|
||||
|
||||
The actual training implementation lives in ``prime_rl.trainer.rl.train``,
|
||||
which is also runnable as ``python -m prime_rl.trainer.rl.train`` (used by
|
||||
the ``rl`` launcher under torchrun).
|
||||
"""
|
||||
|
||||
from prime_rl.configs.trainer import TrainerConfig
|
||||
from prime_rl.utils.config import cli
|
||||
from prime_rl.utils.process import set_proc_title
|
||||
|
||||
|
||||
def main():
|
||||
set_proc_title("Trainer")
|
||||
config = cli(TrainerConfig)
|
||||
from prime_rl.trainer.rl.train import train
|
||||
|
||||
train(config)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -20,7 +20,7 @@ pytestmark = [pytest.mark.gpu, pytest.mark.slow]
|
||||
|
||||
TIMEOUT = 15 * 60 # 15 minutes
|
||||
# Note: I would prefer 5% but massed compute A600s seem to be slower than hyperstack A600s (which is the baseline)
|
||||
METRIC_TOLERANCE = 0.1 # 10% tolerance for mfu, throughput, step_time
|
||||
METRIC_TOLERANCE = 0.15 # 15% tolerance for mfu, throughput, step_time
|
||||
MEMORY_TOLERANCE = 0.01 # 1% tolerance for peak memory
|
||||
TOKEN_CHUNK_SIZE = "1024"
|
||||
|
||||
|
||||
@@ -205,14 +205,14 @@ def start_orchestrator(
|
||||
run_dir.as_posix(),
|
||||
"--max-steps",
|
||||
str(max_steps),
|
||||
"--student.model.lora.name",
|
||||
"--model.lora.name",
|
||||
name,
|
||||
"--wandb.project",
|
||||
wandb_project,
|
||||
"--wandb.name",
|
||||
f"{wandb_name}-{proc_name}",
|
||||
]
|
||||
cmd.append("--student.client.base-url")
|
||||
cmd.append("--model.client.base-url")
|
||||
cmd.extend(INFERENCE_BASE_URLS)
|
||||
|
||||
with open(orch_log_dir / "orchestrator.log", "w") as f:
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
import os
|
||||
import signal
|
||||
import subprocess
|
||||
import time
|
||||
from pathlib import Path
|
||||
from typing import Callable, Generator
|
||||
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
from prime_rl.utils.process import cleanup_process
|
||||
from tests.conftest import ProcessResult
|
||||
from tests.utils import check_eval_avg_goes_up, check_no_error, strip_escape_codes
|
||||
|
||||
pytestmark = [pytest.mark.gpu, pytest.mark.slow]
|
||||
|
||||
TIMEOUT = 600 # 10 minutes
|
||||
TEACHER_PORT = 8001
|
||||
TEACHER_READY_TIMEOUT_S = 300
|
||||
|
||||
|
||||
def _wait_for_teacher(port: int, timeout_s: int) -> None:
|
||||
"""Block until the teacher inference server's /v1/models endpoint is reachable."""
|
||||
url = f"http://localhost:{port}/v1/models"
|
||||
deadline = time.time() + timeout_s
|
||||
while time.time() < deadline:
|
||||
try:
|
||||
r = httpx.get(url, timeout=2.0)
|
||||
if r.status_code == 200:
|
||||
return
|
||||
except (httpx.ConnectError, httpx.ReadTimeout):
|
||||
pass
|
||||
time.sleep(1.0)
|
||||
raise TimeoutError(f"Teacher inference server at {url} did not become ready within {timeout_s}s")
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def teacher_inference(output_dir: Path) -> Generator[subprocess.Popen, None, None]:
|
||||
"""Spawn a `uv run inference` teacher on GPU 0 (shared with the rl-launched
|
||||
student) at 40% gpu_memory_utilization. Tears down at module scope.
|
||||
"""
|
||||
# The rl entrypoint's --clean-output-dir wipes the rl output_dir on start,
|
||||
# so park the teacher log next to it instead of inside it.
|
||||
teacher_log_dir = output_dir.parent / f"{output_dir.name}_teacher"
|
||||
teacher_log_dir.mkdir(parents=True, exist_ok=True)
|
||||
log_path = teacher_log_dir / "teacher_inference.log"
|
||||
cmd = [
|
||||
"uv",
|
||||
"run",
|
||||
"inference",
|
||||
"--model.name",
|
||||
"PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL",
|
||||
"--server.port",
|
||||
str(TEACHER_PORT),
|
||||
"--gpu-memory-utilization",
|
||||
"0.4",
|
||||
]
|
||||
env = {**os.environ, "CUDA_VISIBLE_DEVICES": "0"}
|
||||
with open(log_path, "w") as log_file:
|
||||
proc = subprocess.Popen(cmd, env=env, stdout=log_file, stderr=log_file)
|
||||
try:
|
||||
_wait_for_teacher(TEACHER_PORT, TEACHER_READY_TIMEOUT_S)
|
||||
yield proc
|
||||
finally:
|
||||
cleanup_process(proc.pid, signal.SIGTERM)
|
||||
try:
|
||||
proc.wait(timeout=30)
|
||||
except subprocess.TimeoutExpired:
|
||||
cleanup_process(proc.pid, signal.SIGKILL)
|
||||
proc.wait()
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def wandb_name(branch_name: str) -> str:
|
||||
return f"test-reverse-text-rl-opd:{branch_name}"
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def rl_opd_process(
|
||||
teacher_inference,
|
||||
run_process: Callable[..., ProcessResult],
|
||||
output_dir: Path,
|
||||
wandb_project: str,
|
||||
wandb_name: str,
|
||||
) -> ProcessResult:
|
||||
"""Run the RL entrypoint with training_mode = "opd"; teacher_inference is
|
||||
a fixture-managed external vLLM at http://localhost:8001/v1."""
|
||||
cmd = [
|
||||
"uv",
|
||||
"run",
|
||||
"rl",
|
||||
"@",
|
||||
"configs/ci/integration/reverse_text_rl_opd/start.toml",
|
||||
"--clean-output-dir",
|
||||
"--wandb.project",
|
||||
wandb_project,
|
||||
"--wandb.name",
|
||||
wandb_name,
|
||||
"--output-dir",
|
||||
output_dir.as_posix(),
|
||||
]
|
||||
return run_process(cmd, timeout=TIMEOUT)
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def test_no_error(rl_opd_process: ProcessResult, output_dir: Path):
|
||||
check_no_error(rl_opd_process, output_dir)
|
||||
|
||||
|
||||
def test_eval_avg_goes_up(rl_opd_process: ProcessResult, test_no_error, output_dir: Path):
|
||||
with open(output_dir / "logs" / "orchestrator.log", "r") as f:
|
||||
orchestrator_stdout = strip_escape_codes(f.read()).splitlines()
|
||||
check_eval_avg_goes_up(orchestrator_stdout, env_name="reverse-text")
|
||||
@@ -0,0 +1,113 @@
|
||||
import os
|
||||
import signal
|
||||
import subprocess
|
||||
import time
|
||||
from pathlib import Path
|
||||
from typing import Callable, Generator
|
||||
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
from prime_rl.utils.process import cleanup_process
|
||||
from tests.conftest import ProcessResult
|
||||
from tests.utils import check_eval_avg_goes_up, check_no_error, strip_escape_codes
|
||||
|
||||
pytestmark = [pytest.mark.gpu, pytest.mark.slow]
|
||||
|
||||
TIMEOUT = 600 # 10 minutes
|
||||
TEACHER_PORT = 8001
|
||||
TEACHER_READY_TIMEOUT_S = 300
|
||||
|
||||
|
||||
def _wait_for_teacher(port: int, timeout_s: int) -> None:
|
||||
"""Block until the teacher inference server's /v1/models endpoint is reachable."""
|
||||
url = f"http://localhost:{port}/v1/models"
|
||||
deadline = time.time() + timeout_s
|
||||
while time.time() < deadline:
|
||||
try:
|
||||
r = httpx.get(url, timeout=2.0)
|
||||
if r.status_code == 200:
|
||||
return
|
||||
except (httpx.ConnectError, httpx.ReadTimeout):
|
||||
pass
|
||||
time.sleep(1.0)
|
||||
raise TimeoutError(f"Teacher inference server at {url} did not become ready within {timeout_s}s")
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def teacher_inference(output_dir: Path) -> Generator[subprocess.Popen, None, None]:
|
||||
"""Spawn a `uv run inference` teacher on GPU 0 (shared with the rl-launched
|
||||
student) at 40% gpu_memory_utilization. Tears down at module scope.
|
||||
"""
|
||||
# The rl entrypoint's --clean-output-dir wipes the rl output_dir on start,
|
||||
# so park the teacher log next to it instead of inside it.
|
||||
teacher_log_dir = output_dir.parent / f"{output_dir.name}_teacher"
|
||||
teacher_log_dir.mkdir(parents=True, exist_ok=True)
|
||||
log_path = teacher_log_dir / "teacher_inference.log"
|
||||
cmd = [
|
||||
"uv",
|
||||
"run",
|
||||
"inference",
|
||||
"--model.name",
|
||||
"PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL",
|
||||
"--server.port",
|
||||
str(TEACHER_PORT),
|
||||
"--gpu-memory-utilization",
|
||||
"0.4",
|
||||
]
|
||||
env = {**os.environ, "CUDA_VISIBLE_DEVICES": "0"}
|
||||
with open(log_path, "w") as log_file:
|
||||
proc = subprocess.Popen(cmd, env=env, stdout=log_file, stderr=log_file)
|
||||
try:
|
||||
_wait_for_teacher(TEACHER_PORT, TEACHER_READY_TIMEOUT_S)
|
||||
yield proc
|
||||
finally:
|
||||
cleanup_process(proc.pid, signal.SIGTERM)
|
||||
try:
|
||||
proc.wait(timeout=30)
|
||||
except subprocess.TimeoutExpired:
|
||||
cleanup_process(proc.pid, signal.SIGKILL)
|
||||
proc.wait()
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def wandb_name(branch_name: str) -> str:
|
||||
return f"test-reverse-text-rl-sft:{branch_name}"
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def rl_sft_process(
|
||||
teacher_inference,
|
||||
run_process: Callable[..., ProcessResult],
|
||||
output_dir: Path,
|
||||
wandb_project: str,
|
||||
wandb_name: str,
|
||||
) -> ProcessResult:
|
||||
"""Run the RL entrypoint with training_mode = "sft"; teacher_inference is
|
||||
a fixture-managed external vLLM at http://localhost:8001/v1."""
|
||||
cmd = [
|
||||
"uv",
|
||||
"run",
|
||||
"rl",
|
||||
"@",
|
||||
"configs/ci/integration/reverse_text_rl_sft/start.toml",
|
||||
"--clean-output-dir",
|
||||
"--wandb.project",
|
||||
wandb_project,
|
||||
"--wandb.name",
|
||||
wandb_name,
|
||||
"--output-dir",
|
||||
output_dir.as_posix(),
|
||||
]
|
||||
return run_process(cmd, timeout=TIMEOUT)
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def test_no_error(rl_sft_process: ProcessResult, output_dir: Path):
|
||||
check_no_error(rl_sft_process, output_dir)
|
||||
|
||||
|
||||
def test_eval_avg_goes_up(rl_sft_process: ProcessResult, test_no_error, output_dir: Path):
|
||||
with open(output_dir / "logs" / "orchestrator.log", "r") as f:
|
||||
orchestrator_stdout = strip_escape_codes(f.read()).splitlines()
|
||||
check_eval_avg_goes_up(orchestrator_stdout, env_name="reverse-text")
|
||||
@@ -107,6 +107,21 @@ def check_loss_goes_down(lines: list[str]):
|
||||
return check_number_goes_up_or_down(lines, go_up=False, pattern=r"Loss:\s*(\d+\.\d{4})")
|
||||
|
||||
|
||||
def check_eval_avg_goes_up(lines: list[str], env_name: str):
|
||||
"""Assert that the last `Evaluated {env_name} ... Avg@K=X.XXXX` line reports a
|
||||
higher score than the first one. Use for smoke tests with `interval = 1`
|
||||
evals."""
|
||||
pattern = rf"Evaluated {re.escape(env_name)} .*Avg@\d+=(\d+\.\d{{4}})"
|
||||
eval_lines = [line for line in lines if "SUCCESS" in line and re.search(pattern, line)]
|
||||
assert len(eval_lines) >= 2, f"Need at least 2 eval lines for {env_name!r}, found {len(eval_lines)}"
|
||||
start = float(re.search(pattern, eval_lines[0]).group(1))
|
||||
end = float(re.search(pattern, eval_lines[-1]).group(1))
|
||||
assert end > start, (
|
||||
f"Eval avg for {env_name!r} did not go up: first={start} last={end}\n"
|
||||
f"first line: {eval_lines[0]}\nlast line: {eval_lines[-1]}"
|
||||
)
|
||||
|
||||
|
||||
def check_reward_in_range(
|
||||
lines: list[str],
|
||||
step: int = -1,
|
||||
|
||||
@@ -15,7 +15,7 @@ conflicts = [[
|
||||
]]
|
||||
|
||||
[options]
|
||||
exclude-newer = "2026-05-11T22:34:17.526963383Z"
|
||||
exclude-newer = "0001-01-01T00:00:00Z" # This has no effect and is included for backwards compatibility when using relative exclude-newer values.
|
||||
exclude-newer-span = "P7D"
|
||||
|
||||
[options.exclude-newer-package]
|
||||
@@ -28,7 +28,6 @@ deep-ep = false
|
||||
flash-attn-3 = false
|
||||
prime-sandboxes = false
|
||||
prime-tunnel = false
|
||||
pydantic-config = false
|
||||
deep-gemm = false
|
||||
prime-evals = false
|
||||
prime = false
|
||||
@@ -57,6 +56,7 @@ members = [
|
||||
"opencode-math",
|
||||
"opencode-science",
|
||||
"opencode-swe",
|
||||
"prime-pydantic-config",
|
||||
"prime-rl",
|
||||
"prime-rl-configs",
|
||||
"renderers",
|
||||
@@ -3838,6 +3838,52 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/79/54/f3da8112d6ccb12c9662a5ab3de6b1495ca28ea2f889e15fe01ca538d636/prime_evals-0.2.2-py3-none-any.whl", hash = "sha256:f8f058d81819c1815203217a0c1c05defb3f8fe7f4eeb3befd2881251459f343", size = 13414, upload-time = "2026-05-14T23:07:50.351Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prime-pydantic-config"
|
||||
version = "0.3.0"
|
||||
source = { editable = "deps/pydantic-config" }
|
||||
dependencies = [
|
||||
{ name = "pydantic", marker = "(platform_machine != 'aarch64' and platform_machine != 'x86_64' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy') or (platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux') or (sys_platform != 'linux' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy')" },
|
||||
]
|
||||
|
||||
[package.optional-dependencies]
|
||||
all = [
|
||||
{ name = "pyyaml", marker = "(platform_machine != 'aarch64' and platform_machine != 'x86_64' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy') or (platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux') or (sys_platform != 'linux' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy')" },
|
||||
{ name = "tomli", marker = "(platform_machine != 'aarch64' and platform_machine != 'x86_64' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy') or (platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux') or (sys_platform != 'linux' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy')" },
|
||||
]
|
||||
toml = [
|
||||
{ name = "tomli", marker = "(platform_machine != 'aarch64' and platform_machine != 'x86_64' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy') or (platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux') or (sys_platform != 'linux' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy')" },
|
||||
]
|
||||
yaml = [
|
||||
{ name = "pyyaml", marker = "(platform_machine != 'aarch64' and platform_machine != 'x86_64' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy') or (platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux') or (sys_platform != 'linux' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy')" },
|
||||
]
|
||||
|
||||
[package.dev-dependencies]
|
||||
dev = [
|
||||
{ name = "pre-commit", marker = "(platform_machine != 'aarch64' and platform_machine != 'x86_64' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy') or (platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux') or (sys_platform != 'linux' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy')" },
|
||||
{ name = "pytest", marker = "(platform_machine != 'aarch64' and platform_machine != 'x86_64' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy') or (platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux') or (sys_platform != 'linux' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy')" },
|
||||
{ name = "rich", marker = "(platform_machine != 'aarch64' and platform_machine != 'x86_64' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy') or (platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux') or (sys_platform != 'linux' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy')" },
|
||||
{ name = "ruff", marker = "(platform_machine != 'aarch64' and platform_machine != 'x86_64' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy') or (platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux') or (sys_platform != 'linux' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy')" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "pydantic", specifier = ">=2.0.0" },
|
||||
{ name = "pyyaml", marker = "extra == 'all'" },
|
||||
{ name = "pyyaml", marker = "extra == 'yaml'" },
|
||||
{ name = "tomli", marker = "extra == 'all'" },
|
||||
{ name = "tomli", marker = "extra == 'toml'" },
|
||||
]
|
||||
provides-extras = ["yaml", "toml", "all"]
|
||||
|
||||
[package.metadata.requires-dev]
|
||||
dev = [
|
||||
{ name = "pre-commit", specifier = ">=3.0.0" },
|
||||
{ name = "pytest", specifier = ">=9.0.3" },
|
||||
{ name = "rich", specifier = ">=15.0.0" },
|
||||
{ name = "ruff", specifier = ">=0.12.1" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prime-rl"
|
||||
version = "0.4.0"
|
||||
@@ -4048,8 +4094,8 @@ name = "prime-rl-configs"
|
||||
version = "0.4.0"
|
||||
source = { editable = "packages/prime-rl-configs" }
|
||||
dependencies = [
|
||||
{ name = "prime-pydantic-config", marker = "(platform_machine != 'aarch64' and platform_machine != 'x86_64' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy') or (platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux') or (sys_platform != 'linux' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy')" },
|
||||
{ name = "pydantic", marker = "(platform_machine != 'aarch64' and platform_machine != 'x86_64' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy') or (platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux') or (sys_platform != 'linux' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy')" },
|
||||
{ name = "pydantic-config", marker = "(platform_machine != 'aarch64' and platform_machine != 'x86_64' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy') or (platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux') or (sys_platform != 'linux' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy')" },
|
||||
{ name = "renderers", marker = "(platform_machine != 'aarch64' and platform_machine != 'x86_64' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy') or (platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux') or (sys_platform != 'linux' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy')" },
|
||||
{ name = "tomli", marker = "(platform_machine != 'aarch64' and platform_machine != 'x86_64' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy') or (platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux') or (sys_platform != 'linux' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy')" },
|
||||
{ name = "tomli-w", marker = "(platform_machine != 'aarch64' and platform_machine != 'x86_64' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy') or (platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux') or (sys_platform != 'linux' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy')" },
|
||||
@@ -4057,8 +4103,8 @@ dependencies = [
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "prime-pydantic-config", editable = "deps/pydantic-config" },
|
||||
{ name = "pydantic", specifier = ">=1.10.13" },
|
||||
{ name = "pydantic-config", git = "https://github.com/samsja/pydantic_config.git?branch=main" },
|
||||
{ name = "renderers", editable = "deps/renderers" },
|
||||
{ name = "tomli", specifier = ">=2.2.1" },
|
||||
{ name = "tomli-w", specifier = ">=1.2.0" },
|
||||
@@ -4315,15 +4361,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/be/14/9ee71e3a183f76ff93e46b36157d6ddbf29ec2547b7d2c57931cd5d3aecc/pydantic_argparse-0.10.0-py3-none-any.whl", hash = "sha256:e317f001208d77a5600ece6f7ac78d768d8221a7d64a958980705e9630c2e299", size = 25265, upload-time = "2025-02-09T08:18:27.671Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pydantic-config"
|
||||
version = "0.3.0"
|
||||
source = { git = "https://github.com/samsja/pydantic_config.git?branch=main#73c1d84f7c359fa5fa3b7cfb946272352866efb7" }
|
||||
dependencies = [
|
||||
{ name = "pydantic", marker = "(platform_machine != 'aarch64' and platform_machine != 'x86_64' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy') or (platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux') or (sys_platform != 'linux' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy')" },
|
||||
{ name = "tyro", marker = "(platform_machine != 'aarch64' and platform_machine != 'x86_64' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy') or (platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux') or (sys_platform != 'linux' and extra == 'extra-9-verifiers-openenv' and extra == 'group-9-verifiers-policy')" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pydantic-core"
|
||||
version = "2.46.4"
|
||||
|
||||
Reference in New Issue
Block a user