Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
95a53f39e7 | ||
|
|
0756df77c1 | ||
|
|
66b1f4b6b7 | ||
|
|
bb5e48292d |
+2
-1
@@ -56,6 +56,7 @@ Documenting changes which affect configuration usage patterns (added/moved/remov
|
||||
- **`EvalSaveDiskConfig`**, **`EvalSaveConfig`**, **`RetryConfig`**, **`OnlineEvalConfig`**: Removed (2026-02-06)
|
||||
- **`TemperatureScheduleConfig`**: Renamed to `TemperatureSchedulerConfig` (2026-02-06)
|
||||
- **`optim.mu`**: Added Muon momentum (`mu`) config field (default: 0.95). Previously hardcoded to Muon class default. Also fixed `optim.betas1`/`optim.betas2` not being passed through to the Muon optimizer (2026-02-09)
|
||||
- **`dump_config`**: Added `--dump-config <path>` flag to the `rl` command. When set, writes the resolved subconfigs (trainer, orchestrator, inference, teacher_inference) to the given directory and exits without starting any processes (2026-02-12
|
||||
- **`dump_config`**: Added `--dump-config <path>` flag to the `rl` command. When set, writes the resolved subconfigs (trainer, orchestrator, inference, teacher_inference) to the given directory and exits without starting any processes (2026-02-12)
|
||||
- **`client.api_key_var`**: Changed default from "OPENAI_API_KEY" to "VLLM_API_KEY" (2026-02-12)
|
||||
- **`orchestrator.eval.cancel_inflight_rollouts_on_eval`**: Added flag to optionally cancel in-flight training rollouts before starting online evals. When enabled, avoids congestion by preventing training and eval rollouts from running simultaneously, but slows training as the rollout pipeline must refill after each eval (default: False) (2026-02-16)
|
||||
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ sft = "prime_rl.trainer.sft.train:main"
|
||||
|
||||
[project.optional-dependencies]
|
||||
flash-attn = [
|
||||
"flash-attn @ https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.7.16/flash_attn-2.6.3%2Bcu128torch2.10-cp312-cp312-linux_x86_64.whl",
|
||||
"flash-attn @ https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.7.16/flash_attn-2.8.3%2Bcu128torch2.10-cp312-cp312-linux_x86_64.whl",
|
||||
]
|
||||
flash-attn-3 = [
|
||||
"flash_attn_3 @ https://github.com/samsja/flash-attn-builds/releases/download/v0.1/flash_attn_3-3.0.0b1-cp39-abi3-linux_x86_64.whl",
|
||||
|
||||
@@ -376,6 +376,13 @@ class EvalConfig(BaseConfig):
|
||||
),
|
||||
] = True
|
||||
|
||||
cancel_inflight_rollouts_on_eval: Annotated[
|
||||
bool,
|
||||
Field(
|
||||
description="Whether to cancel in-flight training rollouts before starting online evals. This is useful to avoid congestion (e.g. do not have training + eval rollouts happening at the same time) but leads to slower training steps as rollouts get cancelled and the pipeline has to fill up after each eval",
|
||||
),
|
||||
] = False
|
||||
|
||||
|
||||
class CheckpointConfig(BaseConfig):
|
||||
"""Configures checkpointing the orchestrator."""
|
||||
|
||||
@@ -381,10 +381,15 @@ async def orchestrate(config: OrchestratorConfig):
|
||||
last_eval_step = ckpt_step
|
||||
logger.info(f"Running evals for checkpoint step {ckpt_step}")
|
||||
|
||||
# Pause weight updates during eval and cancel inflight rollouts
|
||||
# this avoid doing eval across different checkpoints and avoid congestion
|
||||
# Pause weight updates and re-scheduling of training rollouts during eval
|
||||
# to avoid evaluating across different checkpoints and avoid congestion
|
||||
scheduler.checkpoint_ready.clear()
|
||||
scheduler.cancel_all_inflight_rollouts()
|
||||
|
||||
# For heavy eval workloads, it might be necessary additionally cancel in-flight training rollouts
|
||||
if config.eval.cancel_inflight_rollouts_on_eval:
|
||||
logger.info("Cancelling in-flight training rollouts before starting evals to avoid congestion.")
|
||||
scheduler.cancel_inflight_rollouts()
|
||||
|
||||
results = await asyncio.gather(
|
||||
*[
|
||||
evaluate_env(
|
||||
@@ -747,6 +752,7 @@ async def orchestrate(config: OrchestratorConfig):
|
||||
sampling_args=eval_sampling_args,
|
||||
num_examples=eval_env_config.num_examples or config.eval.num_examples,
|
||||
rollouts_per_example=eval_env_config.rollouts_per_example or config.eval.rollouts_per_example,
|
||||
max_retries=eval_env_config.max_retries,
|
||||
ckpt_step=ckpt_step,
|
||||
step=progress.step,
|
||||
)
|
||||
@@ -770,7 +776,7 @@ async def orchestrate(config: OrchestratorConfig):
|
||||
rollout_executor.shutdown(wait=False)
|
||||
|
||||
# Stop scheduler
|
||||
scheduler.cancel_all_inflight_rollouts()
|
||||
scheduler.cancel_inflight_rollouts()
|
||||
update_policy_task.cancel()
|
||||
|
||||
# Stop inference pool
|
||||
|
||||
@@ -95,11 +95,8 @@ class Scheduler:
|
||||
"""Update sampling args for future rollout requests."""
|
||||
self.sampling_args = sampling_args
|
||||
|
||||
def cancel_all_inflight_rollouts(self):
|
||||
"""Cancel all in-flight rollout requests.
|
||||
|
||||
Used when weights are updated to discard stale rollouts generated with old weights.
|
||||
"""
|
||||
def cancel_inflight_rollouts(self):
|
||||
"""Cancel all in-flight rollout requests."""
|
||||
count = len(self.inflight_group_rollouts)
|
||||
for future in list(self.inflight_group_rollouts.keys()):
|
||||
if not future.done():
|
||||
|
||||
@@ -14,7 +14,7 @@ NO_BOLD = "\033[22m"
|
||||
RESET = "\033[0m"
|
||||
|
||||
|
||||
def _build_log_entry(record) -> dict:
|
||||
def build_log_entry(record) -> dict:
|
||||
"""Build a flat JSON log entry from a loguru record."""
|
||||
extra = record["extra"]
|
||||
|
||||
@@ -54,14 +54,14 @@ def _build_log_entry(record) -> dict:
|
||||
return log_entry
|
||||
|
||||
|
||||
def _json_sink(message) -> None:
|
||||
def json_sink(message) -> None:
|
||||
"""Sink that outputs flat JSON to stdout for log aggregation (Loki, Grafana, etc.)."""
|
||||
log_entry = _build_log_entry(message.record)
|
||||
log_entry = build_log_entry(message.record)
|
||||
sys.stdout.write(json_module.dumps(log_entry) + "\n")
|
||||
sys.stdout.flush()
|
||||
|
||||
|
||||
class _JsonFileSink:
|
||||
class JsonFileSink:
|
||||
"""File sink that keeps the handle open and writes flat JSON lines."""
|
||||
|
||||
def __init__(self, log_file: Path):
|
||||
@@ -74,7 +74,7 @@ class _JsonFileSink:
|
||||
self._file.close()
|
||||
|
||||
def write(self, message) -> None:
|
||||
log_entry = _build_log_entry(message.record)
|
||||
log_entry = build_log_entry(message.record)
|
||||
self._file.write(json_module.dumps(log_entry) + "\n")
|
||||
self._file.flush()
|
||||
|
||||
@@ -102,17 +102,19 @@ class InterceptHandler(logging.Handler):
|
||||
|
||||
|
||||
def setup_logger(
|
||||
log_level: str,
|
||||
log_level: str = "info",
|
||||
log_file: Path | None = None,
|
||||
append: bool = False,
|
||||
tag: str | None = None,
|
||||
json_logging: bool = False,
|
||||
):
|
||||
global _LOGGER, _JSON_LOGGING
|
||||
if _LOGGER is not None:
|
||||
raise RuntimeError("Logger already set. Please call `setup_logger` only once.")
|
||||
_JSON_LOGGING = json_logging
|
||||
|
||||
# Clean up old logger instance to prevent resource leaks
|
||||
if _LOGGER is not None:
|
||||
_LOGGER.remove()
|
||||
|
||||
# Format message with optional tag prefix
|
||||
tag_prefix = f"[{tag}] " if tag else ""
|
||||
message = "".join(
|
||||
@@ -154,7 +156,7 @@ def setup_logger(
|
||||
|
||||
# Install console handler (enqueue=True only for JSON mode to avoid blocking in async contexts)
|
||||
if json_logging:
|
||||
logger.add(_json_sink, level=log_level.upper(), enqueue=True)
|
||||
logger.add(json_sink, level=log_level.upper(), enqueue=True)
|
||||
else:
|
||||
logger.add(sys.stdout, format=format, level=log_level.upper(), colorize=True)
|
||||
|
||||
@@ -163,7 +165,7 @@ def setup_logger(
|
||||
if not append and log_file.exists():
|
||||
log_file.unlink()
|
||||
if json_logging:
|
||||
file_sink = _JsonFileSink(log_file)
|
||||
file_sink = JsonFileSink(log_file)
|
||||
logger.add(file_sink.write, level=log_level.upper(), enqueue=True)
|
||||
else:
|
||||
logger.add(log_file, format=format, level=log_level.upper(), colorize=True)
|
||||
@@ -178,23 +180,17 @@ def setup_logger(
|
||||
|
||||
|
||||
def get_logger():
|
||||
"""
|
||||
Get the global logger. This function is shared across submodules such as
|
||||
training and inference to access the global logger instance. Raises if the
|
||||
logger has not been set.
|
||||
|
||||
Returns:
|
||||
The global logger.
|
||||
"""
|
||||
global _LOGGER
|
||||
if _LOGGER is None:
|
||||
raise RuntimeError("Logger not set. Please call `set_logger` first.")
|
||||
_LOGGER = setup_logger()
|
||||
return _LOGGER
|
||||
|
||||
|
||||
def reset_logger():
|
||||
"""Reset the global logger. Useful mainly in test to clear loggers between tests."""
|
||||
"""Reset the logger. Useful mainly in tests."""
|
||||
global _LOGGER, _JSON_LOGGING
|
||||
if _LOGGER is not None:
|
||||
_LOGGER.remove()
|
||||
_LOGGER = None
|
||||
_JSON_LOGGING = False
|
||||
|
||||
|
||||
@@ -755,14 +755,14 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "flash-attn"
|
||||
version = "2.6.3+cu128torch2.10"
|
||||
source = { url = "https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.7.16/flash_attn-2.6.3%2Bcu128torch2.10-cp312-cp312-linux_x86_64.whl" }
|
||||
version = "2.8.3+cu128torch2.10"
|
||||
source = { url = "https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.7.16/flash_attn-2.8.3%2Bcu128torch2.10-cp312-cp312-linux_x86_64.whl" }
|
||||
dependencies = [
|
||||
{ name = "einops" },
|
||||
{ name = "torch" },
|
||||
]
|
||||
wheels = [
|
||||
{ url = "https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.7.16/flash_attn-2.6.3%2Bcu128torch2.10-cp312-cp312-linux_x86_64.whl", hash = "sha256:e883225b48075ea57790527ae3f653421a58c25d207375d00a1dfa9221b5bd43" },
|
||||
{ url = "https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.7.16/flash_attn-2.8.3%2Bcu128torch2.10-cp312-cp312-linux_x86_64.whl", hash = "sha256:5ef676dfd01d198eed36795d924eb6af4c87674896de6bd102390afa7f522bc0" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
@@ -2334,7 +2334,7 @@ requires-dist = [
|
||||
{ name = "beartype", specifier = ">=0.21.0" },
|
||||
{ name = "datasets", specifier = ">=4.0.0" },
|
||||
{ name = "dion", git = "https://github.com/samsja/dion.git?rev=d891eeb" },
|
||||
{ name = "flash-attn", marker = "extra == 'flash-attn'", url = "https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.7.16/flash_attn-2.6.3%2Bcu128torch2.10-cp312-cp312-linux_x86_64.whl" },
|
||||
{ name = "flash-attn", marker = "extra == 'flash-attn'", url = "https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.7.16/flash_attn-2.8.3%2Bcu128torch2.10-cp312-cp312-linux_x86_64.whl" },
|
||||
{ name = "flash-attn-3", marker = "extra == 'flash-attn-3'", url = "https://github.com/samsja/flash-attn-builds/releases/download/v0.1/flash_attn_3-3.0.0b1-cp39-abi3-linux_x86_64.whl" },
|
||||
{ name = "flash-attn-cute", marker = "extra == 'flash-attn-cute'", git = "https://github.com/Dao-AILab/flash-attention.git?subdirectory=flash_attn%2Fcute&rev=main" },
|
||||
{ name = "jaxtyping", specifier = ">=0.3.2" },
|
||||
|
||||
Reference in New Issue
Block a user