Compare commits

...
Author SHA1 Message Date
c28eaf874b Alphabetical sort CI tests (#1784)
Release / Push CUDA image to Docker (push) Canceled after 0s
* Align alphabet-sort nightly test with reverse-text checks

Co-authored-by: samsja <samsja@users.noreply.github.com>

* Add alphabet-sort integration CI test and config

Co-authored-by: samsja <samsja@users.noreply.github.com>

* Isolate alphabet-sort integration logs per run

Co-authored-by: samsja <samsja@users.noreply.github.com>

* Reduce alphabet-sort CI runtime and raise timeout

Co-authored-by: samsja <samsja@users.noreply.github.com>

* Seed resume output with alphabet-sort checkpoints

Co-authored-by: samsja <samsja@users.noreply.github.com>

* Copy resume weights for alphabet-sort integration

Co-authored-by: samsja <samsja@users.noreply.github.com>

* Simplify alphabet-sort integration test to single run

Co-authored-by: samsja <samsja@users.noreply.github.com>

* Remove unused alphabet-sort resume CI config

Co-authored-by: samsja <samsja@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: samsja <samsja@users.noreply.github.com>
2026-02-15 15:33:58 -08:00
JannikStandGitHub 26db10418e WIP fix: call evaluate with explicit keyword arguments (#1792)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix: call evaluate with explicit keyword arguments

* chore: apply ruff format to vf utils

* fix: lazy client selection for elastic inference during evals

* refactor: make clients optional, remove redundant params from eval calls
2026-02-15 14:06:11 -08:00
6 changed files with 137 additions and 11 deletions
+6 -1
View File
@@ -65,10 +65,13 @@ jobs:
include:
- test: base
runner: vm
pytest_args: "tests/integration -m gpu --ignore=tests/integration/test_rl_lora.py --ignore=tests/integration/test_rl_multi_run_lora.py --ignore=tests/integration/test_benchmark_regression.py"
pytest_args: "tests/integration -m gpu --ignore=tests/integration/test_rl_lora.py --ignore=tests/integration/test_rl_multi_run_lora.py --ignore=tests/integration/test_benchmark_regression.py --ignore=tests/integration/test_alphabet_sort.py"
- test: rl_lora
runner: vm
pytest_args: "tests/integration/test_rl_lora.py -m gpu"
- test: alphabet_sort
runner: vm
pytest_args: "tests/integration/test_alphabet_sort.py -m gpu"
- test: rl_multi_run
runner: 4xa6000
pytest_args: "tests/integration/test_rl_multi_run_lora.py -m gpu"
@@ -102,6 +105,8 @@ jobs:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
PRIME_API_KEY: ${{ secrets.PRIME_API_KEY }}
PRIME_BASE_URL: ${{ secrets.PRIME_BASE_URL }}
PRIME_TEAM_ID: ${{ secrets.PRIME_TEAM_ID }}
GITHUB_REF_NAME: ${{ github.ref_name }}
GITHUB_HEAD_REF: ${{ github.head_ref }}
PYTEST_OUTPUT_DIR: /tmp/outputs
@@ -0,0 +1,27 @@
inference_gpu_ids = [0]
trainer_gpu_ids = [1]
max_steps = 10
seq_len = 2048
[ckpt]
[model]
name = "PrimeIntellect/Qwen3-0.6B"
[trainer.optim]
lr = 1e-5
[orchestrator]
batch_size = 128
rollouts_per_example = 8
[orchestrator.sampling]
max_tokens = 384
[[orchestrator.env]]
id = "primeintellect/alphabet-sort"
name = "alphabet-sort"
args = { min_turns = 2, max_turns = 2, min_names_per_turn = 1, max_names_per_turn = 3, similarity_power = 4, power_per_turn = false }
[inference]
+11 -2
View File
@@ -1,4 +1,5 @@
import time
from collections.abc import Awaitable, Callable
from typing import Any
import numpy as np
@@ -65,7 +66,6 @@ def compute_pass_at_k(rewards: list[int]) -> dict[str, float]:
async def evaluate_env(
env: vf.Environment,
env_name: str,
clients: list[vf.ClientConfig],
model_name: str,
sampling_args: dict,
num_examples: int,
@@ -73,11 +73,20 @@ async def evaluate_env(
max_retries: int,
ckpt_step: int,
step: int | None,
get_client: Callable[[], Awaitable[vf.ClientConfig]],
):
logger = get_logger()
logger.info(f"Evaluating {env_name} ({num_examples=}, {rollouts_per_example=})")
eval_start_time = time.perf_counter()
outputs = await evaluate(env, clients, model_name, sampling_args, num_examples, rollouts_per_example, max_retries)
outputs = await evaluate(
env=env,
model_name=model_name,
sampling_args=sampling_args,
num_examples=num_examples,
rollouts_per_example=rollouts_per_example,
get_client=get_client,
max_retries=max_retries,
)
eval_time = time.perf_counter() - eval_start_time
rows = []
+3 -4
View File
@@ -386,13 +386,12 @@ async def orchestrate(config: OrchestratorConfig):
# this avoid doing eval across different checkpoints and avoid congestion
scheduler.checkpoint_ready.clear()
scheduler.cancel_all_inflight_rollouts()
results = await asyncio.gather(
*[
evaluate_env(
env=eval_env,
env_name=eval_env_name,
clients=inference_pool.clients,
get_client=inference_pool.get_next_client,
model_name=scheduler.model_name,
sampling_args=eval_sampling_args,
num_examples=eval_env_config.num_examples or config.eval.num_examples,
@@ -421,11 +420,11 @@ async def orchestrate(config: OrchestratorConfig):
val_task = asyncio.create_task(
generate(
env=train_env_group,
clients=inference_pool.clients,
model_name=scheduler.model_name,
examples=val_examples,
rollouts_per_example=config.val.rollouts_per_example,
sampling_args=sampling_args,
clients=inference_pool.clients,
pbar_description="Generating rollouts (val)",
)
)
@@ -728,7 +727,7 @@ async def orchestrate(config: OrchestratorConfig):
evaluate_env(
env=eval_env,
env_name=eval_env_name,
clients=inference_pool.clients,
get_client=inference_pool.get_next_client,
model_name=scheduler.model_name,
sampling_args=eval_sampling_args,
num_examples=eval_env_config.num_examples or config.eval.num_examples,
+18 -4
View File
@@ -1,5 +1,6 @@
import asyncio
import logging
from collections.abc import Awaitable, Callable
from itertools import cycle
from multiprocessing import Process
from typing import Any
@@ -111,11 +112,12 @@ async def run_group(
# TODO: migrate this to vf.Environment.generate() once it supports multiple clients
async def generate(
env: vf.Environment,
clients: list[vf.ClientConfig],
model_name: str,
examples: list,
rollouts_per_example: int,
sampling_args: dict,
clients: list[vf.ClientConfig] | None = None,
get_client: Callable[[], Awaitable[vf.ClientConfig]] | None = None,
max_retries: int = DEFAULT_RETRIES,
state_columns: list[str] = DEFAULT_STATE_COLUMNS,
pbar_description: str = "Generating rollouts",
@@ -128,10 +130,20 @@ async def generate(
Asynchronously generates and scores a list of groups.
"""
if not clients and get_client is None:
raise ValueError("generate requires at least one client or a get_client callback")
if get_client is None:
client_cycle = cycle(clients)
async def get_client() -> vf.ClientConfig:
return next(client_cycle)
total_rollouts = len(examples) * rollouts_per_example
pbar = ProgressTracker(total=total_rollouts, desc=pbar_description)
async def run_group_with_progress(client, example):
async def run_group_with_progress(example):
client = await get_client()
result = await run_group(
env=env,
client=client,
@@ -147,7 +159,7 @@ async def generate(
try:
group_outputs_list: list[list[vf.RolloutOutput]] = await asyncio.gather(
*[run_group_with_progress(client, example) for client, example in zip(cycle(clients), examples)]
*[run_group_with_progress(example) for example in examples]
)
finally:
pbar.close()
@@ -157,11 +169,12 @@ async def generate(
async def evaluate(
env: vf.Environment,
clients: list[vf.ClientConfig],
model_name: str,
sampling_args: dict,
num_examples: int,
rollouts_per_example: int,
clients: list[vf.ClientConfig] | None = None,
get_client: Callable[[], Awaitable[vf.ClientConfig]] | None = None,
max_retries: int = DEFAULT_RETRIES,
state_columns: list[str] = DEFAULT_STATE_COLUMNS,
) -> list[vf.RolloutOutput]:
@@ -176,6 +189,7 @@ async def evaluate(
outputs = await generate(
env=env,
clients=clients,
get_client=get_client,
model_name=model_name,
examples=inputs,
# _get_eval_inputs() already repeats the examples, this currently means
+72
View File
@@ -0,0 +1,72 @@
from functools import partial
from pathlib import Path
from typing import Callable
import pytest
from tests.conftest import ProcessResult
from tests.utils import check_no_error, check_number_goes_up_or_down, check_reward_in_range, strip_escape_codes
pytestmark = [pytest.mark.gpu, pytest.mark.slow]
TIMEOUT = 900 # 15 minutes
@pytest.fixture(scope="module")
def rl_output_dir(output_dir: Path) -> Path:
rl_dir = output_dir / "alphabet_sort_start"
rl_dir.mkdir(parents=True, exist_ok=True)
return rl_dir
@pytest.fixture(scope="module")
def wandb_name(branch_name: str) -> str:
"""Fixture for W&B name for alphabet sort RL CI integration tests."""
return f"test-alphabet-sort-{branch_name}"
@pytest.fixture(scope="module")
def rl_process(
run_process: Callable[..., ProcessResult],
rl_output_dir: Path,
wandb_project: str,
wandb_name: str,
) -> ProcessResult:
cmd = [
"uv",
"run",
"rl",
"@",
"configs/ci/integration/alphabet_sort/start.toml",
"--wandb.project",
wandb_project,
"--wandb.name",
wandb_name,
"--output-dir",
rl_output_dir.as_posix(),
]
return run_process(cmd, timeout=TIMEOUT)
check_reward_goes_up = partial(check_number_goes_up_or_down, go_up=True, pattern=r"Reward:\s*(\d+\.\d{4})")
@pytest.fixture(scope="module")
def test_no_error(rl_process: ProcessResult, rl_output_dir: Path):
"""Tests that the RL process does not fail."""
check_no_error(rl_process, rl_output_dir)
def test_reward_goes_up(rl_process: ProcessResult, test_no_error, rl_output_dir: Path):
"""Tests that the reward goes up in the RL process."""
with open(rl_output_dir / "logs" / "orchestrator.stdout", "r") as f:
orchestrator_stdout = strip_escape_codes(f.read()).splitlines()
check_reward_goes_up(orchestrator_stdout)
def test_reward_in_range(rl_process: ProcessResult, test_no_error, rl_output_dir: Path):
"""Tests that the reward is in range in the RL process."""
with open(rl_output_dir / "logs" / "orchestrator.stdout", "r") as f:
orchestrator_stdout = strip_escape_codes(f.read()).splitlines()
check_reward_in_range(orchestrator_stdout, min_threshold=0.05)