39 Commits
Author SHA1 Message Date
samsjaandGitHub 9281c5589a add nixl to gigitngore (#2805)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
2026-06-13 16:25:11 -07:00
a73fa39f2f chore: gitignore .claude/worktrees/ (#2633)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-25 13:59:30 -07:00
81f9e9512b fix(ci): fix recurring failures + speedup ci (#2512)
* fix(wandb): respect WANDB_MODE env var in WandbMonitor

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): disable W&B on PR runs to prevent ID collision and missing key crashes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(ci): rename test_rl.py to test_reverse_text.py and split into own CI job

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(ci): reduce reverse-text RL run to 15+5 steps

Reward plateaus at step 8-9 and stays above the 0.65 threshold from
step 8 onward. 20 steps was ~40% wasted compute.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test: add average mismatch KL check to reverse-text integration test

Asserts the average mismatch KL across the last 10 trainer steps stays
below 0.01, catching numerical instability early without being brittle
to per-step noise.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(alphabet-sort): add mismatch KL guard, tighten reward threshold, reduce steps

Cut max_steps 10→8 (reward plateaus by step 7 at ~0.22, saves ~16s).
Tighten reward min_threshold 0.05→0.10 to catch regressions earlier.
Add avg mismatch KL check (last 5 steps ≤ 0.15) based on observed ~0.05-0.09
range; 0.15 gives CI headroom while catching numerical instability.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(reverse-text): rename wandb run, reduce mismatch KL check window

Rename W&B run from test-rl to test-reverse-text:{branch} to match the
test file rename. Reduce last_n_steps from 10→3 for the mismatch KL
check to make it less brittle (3 steps is sufficient to catch instability).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: remove unused alphabet_sort_branch CI config

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(tests): update config paths after renames, fix double newline in error output

- configs/ci/integration/rl/ → reverse_text/
- configs/ci/integration/alphabet_sort/start.toml → alphabet_sort.toml
- sep="\n" → sep="" in check_no_error (readlines() lines already end in \n)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): respect WANDB_MODE in shared mode, align lora/alphabet-sort configs

- wandb.py: WANDB_MODE=disabled/offline now bypasses shared mode entirely
  (shared mode requires a server connection and can't work offline)
- reverse_text_lora: reduce steps 20+5 → 15+5 to match reverse_text config
- gpu_tests.yaml: rename rl_lora job → reverse_text_lora, update ignore list
- test_reverse_text_lora.py: use colon separator in wandb run name
- test_alphabet_sort.py: drop rl_output_dir wrapper, use output_dir directly;
  use colon separator in wandb run name

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor: rename test_rl_moe → test_reverse_text_moe, split into own CI job

- Rename test file and config dir (rl_moe → reverse_text_moe)
- Add reverse_text_moe as a dedicated CI job; exclude from base
- Update config paths, wandb name (colon separator), output subdirs (hf/custom)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(test): add missing test function to test_reverse_text_moe

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): update config paths for renamed sft/multi-run dirs, tail orch logs

- test_sft.py: sft/ → reverse_text_sft/
- test_sft_lora.py: sft_lora/ → reverse_text_sft_lora/
- test_reverse_text_multi_run.py: rl_multi_run/ → reverse_text_multi_run/
- gpu_tests.yaml: rename rl_multi_run job → reverse_text_multi_run, update
  ignore list to use test_reverse_text_multi_run.py
- rl.py: tail orchestrator.log instead of trainer.log on startup

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(tests): rename CI integration tests and configs to use descriptive names

Rename test files and config directories from generic rl/sft/rl_lora/rl_multi_run
prefixes to descriptive reverse_text/alphabet_sort/reverse_text_sft/etc names.
Flatten alphabet_sort config from a directory to a single file.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(ci): reduce SFT integration test steps from 10+10 to 5+5

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(ci): simplify CI - always offline W&B, drop OPENAI_API_KEY, fix wandb names

- WANDB_MODE hardcoded to offline (removes flaky conditional logic)
- Remove OPENAI_API_KEY (not referenced in code, client defaults to EMPTY)
- Remove WANDB_API_KEY (no longer needed with offline mode)
- Drop -m gpu from integration test args (all integration tests already carry the mark)
- Standardize wandb run names to use colon separator in sft/sft_lora/multi_run tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(ci): replace base integration job with explicit sft matrix jobs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: ignore .claude/scheduled_tasks.lock

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: untrack deps/renderers/_version.py, add to gitignore

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(ci): use dynamic matrix to avoid expanded skipped entries on draft PRs

Static matrix jobs get pre-registered by GitHub even when skipped, showing 8
individual "Skipped" entries on draft PRs. A dynamic matrix (output from a prior
job) can't be pre-expanded, so GitHub shows a single entry instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Revert "chore(ci): use dynamic matrix to avoid expanded skipped entries on draft PRs"

This reverts commit 0e835ed63ef467f8a33018f809b8ab182ebb2c56.

* chore(ci): disable uv cache on GPU jobs

The post-job cache save tars multi-GB pytorch/CUDA packages, adding 3+ min of
overhead. The save cost exceeds the restore benefit for large GPU dependencies.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: remove deps/renderers/_version.py from gitignore

Handled in a separate PR.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(ci): run integration tests with -vvs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* only 5 alphabet sort steps [skip ci]

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 22:25:40 -07:00
Matej SirovatkaandGitHub d11fc90469 Fix: third_party to .gitignore (#2463)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-05-09 15:18:24 -07:00
1692a67d90 chore: unify log directories (#2150)
Release / Push CUDA image to Docker (push) Canceled after 0s
* chore: unify log directories across local and SLURM deployments

Remove Python file logging (log.file config) — deployment-level capture
(stdout redirect for local, tee for SLURM) is sufficient. This eliminates
duplicate log files and simplifies the logging architecture.

Key changes:
- Remove log.file config option and JsonFileSink from logger
- Rename .stdout -> .log for deployment-captured logs
- Unify SLURM logs from slurm/ into logs/ (same as local)
- Trainer shows rank 0 only, all rank logs in logs/trainer/torchrun/
- Multi-node SLURM: logs/trainer/node_N.log, logs/inference/node_N.log
- Symlink logs/trainer.log -> trainer/node_0.log (multi-node)
- Historical per-job logs under logs/slurm/job_{id}/

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: update env log paths in docs to match actual structure

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs: simplify env and torchrun logging sections

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: include per-node and per-rank log paths in log messages

Show where to find node-level logs (for multi-node) and per-rank
torchrun logs in the startup log messages for RL, SFT, and inference.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: extract format_log_message to shared utility

Move format_log_message from rl.py to utils/pathing.py and reuse it
in SFT and inference entrypoints, eliminating duplicated formatting logic.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: remove historical per-job SLURM log copies

The job_* log copies in logs/slurm/ added complexity without much value.
SLURM's own job output log (job_%j.log) already serves as the historical
record.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs: move tmux helper section to bottom of logging.md

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: consolidate tmux.sh and slurm_tmux.sh into one script

Log paths are now unified across local and SLURM, so both scripts
were tailing the same files. Merge into a single tmux.sh with a Logs
window (4 panes tailing trainer/orchestrator/envs/inference) and a
Monitor window (nvtop + htop).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs: fix logger docs to match actual behavior

setup_logger doesn't raise when called twice (it reconfigures).
get_logger always works (auto-initializes a default if needed).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs: remove incorrect env_worker_logs reference

The env_worker_logs config field is defined but never read — env worker
logs are written unconditionally.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: remove dead env_worker_logs config field

Defined but never read anywhere in the codebase.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs: add router logs to slurm monitoring section

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs: mention per-node and per-rank trainer logs in performance section

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs: generalize config path references to {output_dir}/configs/

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: template rendering bugs and improve log message labels

- Fix Jinja2 tags on same line as tee commands (broken bash output)
- Rename "Trainer:" to "Trainer (rank 0):" in log messages
- Rename "Nodes:" to "All nodes:" and "Per-rank:" to "All ranks:"
- Make per-rank log line a tail -F command following torchrun structure

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: include stderr in all-ranks log tail command

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: update stale log paths in examples, SFT tests, and pathing test

- Fix torchrun glob: **/*.log → */*/*/*.log (tail -F doesn't support **)
- Update 5 example READMEs from slurm/latest_* to logs/ paths
- Update SFT tests from logs/trainer/rank_0.log to logs/trainer.log
- Update pathing test fixture to match new log structure

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: clean up log message code and fix test bug

- Remove hardcoded "Showing rank 0 logs only" message from trainers
  (already communicated via format_log_message)
- Derive env_log_dir inside format_log_message instead of requiring
  callers to pass it
- Fix test_pathing double mkdir crash (FileExistsError)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: split LogConfig into TrainerLogConfig and OrchestratorLogConfig

- TrainerLogConfig adds ranks_filter (configures torchrun
  --local-ranks-filter, defaults to [0]) and log_data
- OrchestratorLogConfig adds vf_level
- Base LogConfig retains level and json_logging
- ranks_filter is passed through to SLURM templates

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: keep LogConfig as-is, only extend with TrainerLogConfig

Revert OrchestratorLogConfig — keep vf_level and log_data on the base
LogConfig for safety. Only TrainerLogConfig extends with ranks_filter.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: remove "(rank 0)" from trainer log message

ranks_filter is now configurable so it may show more than rank 0.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: use total_infer_nodes for log hint and add CHANGELOG entries

- Fix num_infer_nodes using per-replica count instead of total, which
  suppressed "All nodes" hint for multi-replica inference
- Add CHANGELOG entries for removed config fields and new ranks_filter

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: use `uv run sft` entrypoint in SFT integration tests

The SFT tests were calling torchrun directly, bypassing the SFT
entrypoint which handles stdout redirection to trainer.log. This caused
tests to read stale/wrong log files from the shared output directory.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: add --clean-output-dir to initial SFT integration tests

The SFT entrypoint validates that output_dir doesn't contain stale
checkpoints. Since output_dir is session-scoped and shared across test
modules, the SFT tests need --clean-output-dir on the initial run.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: add --clean-output-dir to RL integration tests too

All integration tests sharing the session-scoped output_dir should
clean on initial run to avoid stale checkpoint validation errors.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 13:04:11 -07:00
3102ca47cb Add SLURM entrypoint with Jinja2 template (#1774)
Release / Push CUDA image to Docker (push) Canceled after 0s
* refactor config

* Add SLURM entrypoint with Jinja2 template and tmux launcher

Adds a new `rl_slurm` entrypoint that resolves the full RL config,
dumps sub-configs as TOML, renders a SLURM batch script from a Jinja2
template, and submits it via sbatch (with --dry-run option). Includes
a tmux launcher for monitoring trainer/orchestrator/inference logs and
documentation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix ruff formatting

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(slurm): sync orchestrator output dir with cleanup

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

* test(configs): include slurm config parser in config loading test

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

* add auto dir

* fix(slurm): move auto_setup_output_dir to BaseRLConfig so SLURM entrypoint propagates output_dir

RLSLURMConfig extends BaseRLConfig, not RLConfig, so the validator that
propagates output_dir to trainer and orchestrator was never running.
This caused the Jinja template cleanup to target wrong paths and the
trainer to pick up stale rollouts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* add args

* feat(slurm): make config more flexible and self-contained

- Replace base_dir/env_file/venv with single project_dir
- Add gpus_per_node (default 8) to remove hardcoded GPU counts
- Add nodes_per_fsdp_group to auto-compute dp_replicate
- Use -m module syntax for torchrun instead of file path
- Derive .env and .venv paths from project_dir

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix many stuff

* add math

* addexamples

* add moe example

* docs(slurm): update to Hendrycks Math examples with MoE config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: add required output_dir to slurm example configs

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: samsja <samsja@users.noreply.github.com>
Co-authored-by: sami jaghouar <sami@primeintellect.ai>
2026-02-17 13:10:27 -08:00
b82e85ad44 Feat ring flash attn (#1305)
* Feat: data loading

* Feat: forward passes

* Feat: compute loss todo

* Feat: don't gather full logits, just the last one

* Feat: fworks lol

* Feat: works with custom model impl

* Feat: cleanup

* Feat: gemini cooked?

* To revert: debug

* Feat: cleanup

* Feat: more cleanup

* Feat: more cleanup

* Feat: padding

* Feat: add padding validator

* Fix to padding

* Minor

* cleanup

* Feat: deslop

* cleanup

* Fix: non data parallel size

* Fix: proper replacement of forward method

* Fix: padding length

* Fix: non data parallel size

* Fix: remove print

* Feat: generator

* Fix: fake dataloader cp

* filesystem transport

* make orchestrator output batch

* fix circular import

* fix: advantage assignment

* changes to orchestrator for multi-dir

* rename some orchestrator stuff

* BC util imports

* multi dir train packing no  broadcast

* configs and docs changes

* gitignore

* multi broadcast

* fix paths for tests

* remove duplicate progress

* fix test trajectories

* test runs

* allow setting max-loras

* use transport config

* fix: circular import

* test orchestrator log path

* rename to rollout_transport

* make prepare batch use lists instead of tensors

* extend is a little fastertan +=

* make trajectories use bool

* make packer to dataloader use msgpack

* guard write with tmp rename

* cursor be dumb sometimes

* Feat: sft cp

* Feat: add validators

* Feat: merge

* Feat: final?

* Fix: ruff

* cleanup

* Fix: toml

* Fix: token counting

* Fix: readd validator

* Feat: fix back tests

* Feat: rename documents->samples

* Update src/prime_rl/trainer/rl/data.py

Co-authored-by: samsja <55492238+samsja@users.noreply.github.com>
Signed-off-by: Matej Sirovatka <54212263+S1ro1@users.noreply.github.com>

* Update src/prime_rl/trainer/rl/data.py

Co-authored-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
Signed-off-by: Matej Sirovatka <54212263+S1ro1@users.noreply.github.com>

---------

Signed-off-by: Matej Sirovatka <54212263+S1ro1@users.noreply.github.com>
Co-authored-by: Jackmin801 <ongjackm@gmail.com>
Co-authored-by: samsja <55492238+samsja@users.noreply.github.com>
Co-authored-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
2025-12-16 15:33:05 -08:00
Jackmin801andGitHub b8697b0f02 Move packing to trainer and support run directories (#1419)
* filesystem transport

* make orchestrator output batch

* fix circular import

* fix: advantage assignment

* changes to orchestrator for multi-dir

* rename some orchestrator stuff

* BC util imports

* multi dir train packing no  broadcast

* configs and docs changes

* gitignore

* multi broadcast

* fix paths for tests

* remove duplicate progress

* fix test trajectories

* test runs

* allow setting max-loras

* use transport config

* fix: circular import

* test orchestrator log path

* rename to rollout_transport

* make prepare batch use lists instead of tensors

* extend is a little fastertan +=

* make trajectories use bool

* make packer to dataloader use msgpack

* guard write with tmp rename

* cursor be dumb sometimes

* rename TrainingExample to TrainingSample

* small fix

* use bool cast

* make notify private

* stdout is still in root logs folder

* set packer timeout

* fix run_default path

* fix last steps of broadcast

* fix: log self save sharded

* DEBUG CI

* more print

* test rl lora first

* separate lora test from non lora test

* turn off debug

* dont pass orch seqlen to trainer

* dont support none positions ids for now

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
2025-12-15 13:38:45 -08:00
9763a8a5b4 Add INTELLECT-3 eval configs (#1335)
* Add INTELLECT-3 eval configs

* Add deepseek via openrouter

* fix eval config discovery

---------

Co-authored-by: rasdani <73563550+rasdani@users.noreply.github.com>
2025-11-29 01:21:24 +01:00
Mika SenghaasandGitHub 8518c157c2 Decouple weight checkpointing and broadcasting (#1299)
* rename module to nccl

* Refawctorrr

* Ignore broadcast dir as well

* Cleaner

* Clean broadcast dir

* Only delete necessary dirs

* Turn off weight checkpointing by default

* Rename to broadcasts to avoid gitignoring

* Notify orchestrator at start of NCCL broadcast

* Ensure dir exists before writing file

* Put back sender-receiver interface zto be easy to test

* Change defaults

* Only save on master rank and optionally with LoRAs

* Only notify on master

* Also cleanup broadcast dir to avoid out of disk

* Lazily load cuda

* Fix attr not defined

* Deprecate weight ckpt manager

* Make trainer ckpt manager responsible of deleting ckpt directories

* Fix SFT trainer

* Use broadcast dir on resume

* Revert "Deprecate weight ckpt manager"

This reverts commit 3f5d0057e0527509fe135b383ff8858f3730b1b2.

* Revert "Fix SFT trainer"

This reverts commit 568013d4f9716be50b9cc14bb4c284c02e30430b.

* Use public attrs

* Keep broadcast dir with fs

* Organize imports

* Do write final steps to resume proper

* Remove unused func

* Also save model config

* Do not remove broadcast dir on resume

* Remove ugly backticks

* Make weight ckpt part of full ckpt

* Fix weight ckpt logic

* use sharded safetensors by default

* Make async save threadsafe

* Use async save by default

* Do not try joining current thread

* Wait for final thread in main loop

* Fix not saving intermediate dataloader

* Also cleanup from inside the weight ckpt manager

* Clean final ckpt as well

* Make ckpt cleaning thread save

* Only save weights on master rank

* Do not allow async saving of full ckpt (as before)

* Do not gather weights and adapters in thread

* Remove ability to async save again because it barely saves time

* minor

* Remove unused arg
2025-11-18 14:02:08 -08:00
will brownandGitHub 794aa5c1f2 add .chroma_db to gitignore (#1247) 2025-11-05 20:43:48 -08:00
Mika SenghaasandGitHub 9836553393 Seed buffer (#1154)
* Seed buffer

* Fix buffer tests

* Remove output summaries

* Ignore final summaries
2025-10-27 05:23:18 -07:00
Mika SenghaasandGitHub 6d6ff43742 Also ignore slurm and torchrun in outputs (#1104) 2025-10-14 04:54:29 -07:00
Mika SenghaasandGitHub 1ae027ce15 Add eval artifacts (#767)
* Save eval samples and metrics as JSON report

* Only report completion len in artifact but not to W&B

* Move save to base eval settings, slightly adjust signature

* Use step path here too

* Add eval subdir to gitignore and cleanup

* Add info print

* Setup but not use monitor

* More precision on printout

* Save by default if eval enabled
2025-08-17 16:30:21 -07:00
Mika SenghaasandGitHub 4444c7e2d0 Implement outputs directory (#698)
* Remove path configs

* Change path definition in ckpt and weight ckpt manager

* Add outputs_dir to trainer and orch config and pass to ckpt managers

* Remove exp_id, use output dir in batch loading/ writing, change validation

* Fix some more paths

* Update gitignore

* Interactive cleanup for safety

* Discriminate session name and outputs dir in tmux.sh and use outputs by default

* Update README

* Remove configurable wandb path

* Extract shared path definitions

* Rephrase multi-exp per node section

* Fix tests

* Remove wandb dir

* Also remove wandb dir

* Fix fake rollouts integration test

* Minor comment change

* Fix attribute not defined
2025-08-09 10:29:03 -07:00
will brownandGitHub 04dd24e1c9 Reorganize environments into standalone modules (#649)
* env reorg

* add vf.load_environment to orchestrator, add pydantic typing for vf, move registry to environments folder

* deprecate test_env script in favor of vf-eval

* orchestrator ckpt None fallback

* update env ids in configs

* install vf-reverse-text in pyproject for integration test

* refresh uv.lock

* config default name update

* fix type warnings in config.py

* remove endpoints.py
2025-07-31 08:51:34 -07:00
390206faf0 Will/wordle env (#625)
* wordle envs in registry, test script

* formatting

* pretty print

* add env testing script, bump vf version, rename get_env -> load_env

* remove print

* re-add uv.lock

* bump vf version

* MC cleanup

* MC cleanup

* MC cleanup

* xlam env

* simpleqa, other envs

* reqs

* multiturn vllm logprobs

* gitignore

* wordle 1b test

* tweaks

* wordle configs

* wordle id

* config

* config

* mini readme fix (#601)

* fix group loading (#600)

* fix group loading

* remove newline

* Complete the backport for ASCII tree + Sentence unscrambling tasks (#582)

* complete backport for ascii + unscramble tasks

* fix task type missing from preprocessor and mismatching dataset var

* keep all envs
# Conflicts:
#	src/prime_rl/environments/registry.py

* wordle envs in registry, test script

# Conflicts:
#	pyproject.toml
#	scripts/test_env.py
#	src/prime_rl/environments/registry.py
#	uv.lock

# Conflicts:
#	src/prime_rl/environments/registry.py
#	uv.lock

* formatting

# Conflicts:
#	scripts/test_env.py
#	src/prime_rl/environments/registry.py

* pretty print

# Conflicts:
#	scripts/test_env.py

* --no-edit

* remove print

* remove uv.lock for now

# Conflicts:
#	uv.lock

* xlam env

# Conflicts:
#	src/prime_rl/environments/registry.py
#	uv.lock

# Conflicts:
#	src/prime_rl/environments/registry.py

* simpleqa, other envs

# Conflicts:
#	src/prime_rl/environments/registry.py
#	uv.lock

# Conflicts:
#	pyproject.toml
#	src/prime_rl/environments/registry.py

* multiturn vllm logprobs

# Conflicts:
#	configs/inference/multiturn_wordle/1b.toml

# Conflicts:
#	configs/orchestrator/multiturn_wordle/1b.toml
#	configs/trainer/multiturn_wordle/1b.toml
#	src/prime_rl/environments/registry.py

* wordle 1b test

# Conflicts:
#	configs/inference/multiturn_wordle/1b.toml

# Conflicts:
#	configs/orchestrator/multiturn_wordle/1b.toml
#	pyproject.toml
#	src/prime_rl/environments/registry.py

* rebase

* rebase

* wordle

* merge cleanup

* 14b wordle config

* 3.12-dev for b200

* max len

* 1b wordle config

* rename

* 1b default

* logprobs = 0

* revert logprob change

* bump batch size

* registry

* uv.lock

* rename wordle folders

* uv.lock

* remove unnecessary kwargs

* removed ac

* remove num_samples from wandb config

* bump vf commit

* cleanup

---------

Co-authored-by: Justus Mattern <122226645+justusmattern27@users.noreply.github.com>
2025-07-24 04:33:06 -07:00
will brownandGitHub d7ecfad1f9 Revert "Wordle + misc. envs in registry, test script, multi-turn vLLM logprob…" (#623)
This reverts commit c655d76f49.
2025-07-22 16:55:56 -07:00
c655d76f49 Wordle + misc. envs in registry, test script, multi-turn vLLM logprobs, verifiers version bump (#593)
* wordle envs in registry, test script

* formatting

* pretty print

* add env testing script, bump vf version, rename get_env -> load_env

* remove print

* re-add uv.lock

* bump vf version

* MC cleanup

* MC cleanup

* MC cleanup

* xlam env

* simpleqa, other envs

* reqs

* multiturn vllm logprobs

* gitignore

* wordle 1b test

* tweaks

* wordle configs

* wordle id

* config

* config

* mini readme fix (#601)

* fix group loading (#600)

* fix group loading

* remove newline

* Complete the backport for ASCII tree + Sentence unscrambling tasks (#582)

* complete backport for ascii + unscramble tasks

* fix task type missing from preprocessor and mismatching dataset var

* keep all envs
# Conflicts:
#	src/prime_rl/environments/registry.py

* wordle envs in registry, test script

# Conflicts:
#	pyproject.toml
#	scripts/test_env.py
#	src/prime_rl/environments/registry.py
#	uv.lock

# Conflicts:
#	src/prime_rl/environments/registry.py
#	uv.lock

* formatting

# Conflicts:
#	scripts/test_env.py
#	src/prime_rl/environments/registry.py

* pretty print

# Conflicts:
#	scripts/test_env.py

* --no-edit

* remove print

* remove uv.lock for now

# Conflicts:
#	uv.lock

* xlam env

# Conflicts:
#	src/prime_rl/environments/registry.py
#	uv.lock

# Conflicts:
#	src/prime_rl/environments/registry.py

* simpleqa, other envs

# Conflicts:
#	src/prime_rl/environments/registry.py
#	uv.lock

# Conflicts:
#	pyproject.toml
#	src/prime_rl/environments/registry.py

* multiturn vllm logprobs

# Conflicts:
#	configs/inference/multiturn_wordle/1b.toml

# Conflicts:
#	configs/orchestrator/multiturn_wordle/1b.toml
#	configs/trainer/multiturn_wordle/1b.toml
#	src/prime_rl/environments/registry.py

* wordle 1b test

# Conflicts:
#	configs/inference/multiturn_wordle/1b.toml

# Conflicts:
#	configs/orchestrator/multiturn_wordle/1b.toml
#	pyproject.toml
#	src/prime_rl/environments/registry.py

* rebase

* rebase

* wordle

* merge cleanup

* 14b wordle config

* 3.12-dev for b200

* max len

* 1b wordle config

* rename

* 1b default

* logprobs = 0

* revert logprob change

* bump batch size

* registry

* uv.lock

* rename wordle folders

* uv.lock

* remove unnecessary kwargs

* removed ac

* remove num_samples from wandb config

* bump vf commit

---------

Co-authored-by: Justus Mattern <122226645+justusmattern27@users.noreply.github.com>
2025-07-22 15:51:44 -07:00
Mika SenghaasandGitHub 6a122196c2 Colorized, piped file logs instead of loguru file logging (#573)
* Remove trailing backslash

* Remove loguru file logging in favor of piping stdout
2025-07-12 22:46:56 +02:00
Mika SenghaasandGitHub 9892c1f460 Disable tqdm env var, update .gitignore, cleanup unused function (#563)
* Type tqdm disable env var

* Ignore .loguru files

* Cleanup unused test rpc func
2025-07-11 23:20:11 +02:00
4874e09da5 gradio script (#468) (#560)
* gradio script (#468)

* Rename file

---------

Co-authored-by: will brown <williambrown97@gmail.com>
Co-authored-by: Mika Senghaas <mail@mikasenghaas.de>
2025-07-11 21:36:35 +02:00
3a19c92c29 Implement single-node RL entrypoint (#545)
* Alllow partial path updates

* Exclude toml files from serialization

* Working RL training entrypoint

* Use tmuxinator as skeleton

* Log samples on debug RL run

* Move install script

* Move orchestrator one dir level up

* Log samples only as part of CI

* Renmae training -> trainer and infer -> inference endpoint

* Adapt rl.py to new trainer def

* Make inference optional

* Rename trainer logs

* Add rl entrypoint

* Allow to restart experiments from within tmux sesion

* Remove sidecar

* Misc

* Implement local device auto-placement

* Make orchestrator info logs slightly more informative

* Do not log start cmd

* Even better orchestrator logs

* Improve trainer logs

* Install tmuxinator

* Clean and setup logging from rl

* More nice logs

* Only clean up log files

* Tie async level

* Fix parallel bug

* Add docs

* Remove log configs at start

* Use torchrun for trainer

* Fix tests and make rl test and integration test

* Bubble up subprocess exceptions

* Set eval config path

* Pipe outputs

* Fix RL CI run

* RL shows trainer streams trainer logs

* Fix tests

* Fxi integration test

* Implement toml subconfigs

* Update configs, README and test with TOML subconfig passing

* Log inference output to file to prevent server hanging

* Update README

* Do not echo for cleaner tmuxinator open

* Use space in between @ and toml

* Fix wrong config path

---------

Co-authored-by: sami jaghouar <sami.jaghouar@gmail.com>
2025-07-09 20:21:07 +02:00
Mika SenghaasandGitHub 9529ee771e Cleanup trainer (+configs) (#481)
* First draft train configs (not running)

* Rename orchestrator data configs

* Cleanup trainer

* Refactor activation checkpointing

* Simplify logprob recomputation

* Clean up metrics averager

* Rename world info to world for brevity

* Remove explicit batch loss

* Move grad norm to loss config and improve timing metrics

* Remove reward server

* Bring back perf counter

* Bring back fake data loader and debug train config

* Move util functions away from entrypoint script

* Remove legacy code

* Final cleanup in train configs

* Allow training sync with buffer size

* Remove old code

* Use alias for reshard

* Move compute logprobs func

* Move fsdp and ac into model file and simplify setup logic

* Remove unused code

* Remove seeding on trainer

* Renamed back to input_ids

* Remove buffer size and renamed to async_level

* No config inheritance;((
2025-06-30 19:33:26 -07:00
Mika SenghaasandGitHub ae402099dd Finalize SYNTHETIC-2 configs (#431)
* Finalize syn-2 configs

* Ignore jsonl (monitor output by default)
2025-06-19 11:54:31 -07:00
fca28f9fd3 Refactor configs (#383)
* Add docs to sampling config and add missing sampling parameters

* Extract parallel config

* Extract model config

* Extract data config

* Correct var naming from batch_size to max_batch_size

* Extract RL config

* Delete deprecated configs

* Increment data offset by problems per batch (excluding sampling.n)

* Align ckpt/rollout path definition

* Ignore ckpt/rollout dir

* Adapt configs

* Fix inference integration tests

* Switch to using annotated fields for configs

* Improved config logs

* Migrate inference configs to pydantic-settings

* Fix broken model validation

* Fix integration test

* Skip ge/le checks on non-numeric type

* Update README

* Move comments into field description

* Use path type

* Fix tab tab error

* Use implicit boolean flags

* Fix funny legacy import error

* Fix unit tests

* Extract default syn-2 configs (allows for composed configs)

* Allow passing nested configs from env

* Define shared base config to remove pydantic_config dep

* The return of the space and snake

* Move group and task ID and log level into configs

* Do not init logger at module level (do not trigger init when loading submodule)

* Do not enable monitor by default (should be set by CLI arg in orchestrator task)

* Setup task ID via arg

* Fix monitor

* Allow passing config via env using __ delimiter

* Use clean argv fixture in inference config test

* Explain configs in README

* Fix bug from rebase

* Skip doing hex string validation

* Optionally parse from CLI and move toml extraction away from module def

* Move training configs to pydantic-settings

* Update README

* Remove pydanctic_config from deps

* Move config description to end of file

* Remove descriptions

* Remove sentence

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

* location of logprobs has changed

* Fix forma task configs

---------

Co-authored-by: samsja <55492238+samsja@users.noreply.github.com>
Co-authored-by: Jackmin801 <ongjackm@gmail.com>
2025-06-13 14:10:04 -07:00
Mika SenghaasandGitHub 8271a7df2d Fix and refactor applying chat template (#346)
* Move prompt preparation into utils

* Restructure utils

* Simplify generating target lengths and fixing chat template

* Add test.ipynb to gitignore

* Add simple unit tests

* Add doc string

* Pass tokenizer directly to function (easier testing)

* Revert typing LLM class

* Add `enable_thinking` flag to configs and tests

* Rename file

* Fix e2e test

* Ignore all notebooks
2025-06-04 11:09:45 +02:00
Sami Jaghouarandsamsja 049b9b9cc9 add wandb_logs folder to .gitingore 2025-05-22 19:20:16 -07:00
84aed5b49e Add HTTPMonitor (#152)
* Add HTTPMonitor

* Add HTTPMonitor

* update uv lock

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* refactor: use env var

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* refactor: use env var

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* Add HTTPMonitor

* add monitor filter to only send required data

* update env vars

* remove unused function

* remove prime dashboard key as not used

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* remove comments

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

---------

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>
Co-authored-by: Sami Jaghouar <sami.jaghouar@gmail.com>
2025-04-11 01:35:15 +02:00
Sami Jaghouarandsamsja ab6a9f7e6f add e2e testing
Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>
2025-02-27 15:26:25 -08:00
99a69b99d0 Data stream (#5)
* add schema for infernece

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* fix inference schema

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* add updatable datasets

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* remove kl for now

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* add beartype

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* fix data stream loading

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* fix grpoype hint

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* add tests for no debug data

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* add tests for pq datasets

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* fix loss

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* fix inference

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* remove updatable dataset

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* fix dataset

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* add dataset

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* add splitting

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* fix config

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* fix config

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* add seqlen to tests

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* fix tests

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* update git ignore

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* add fake rllout

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>

* make generate fake rollout faster

---------

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>
Co-authored-by: Jackmin801 <ongjackm@gmail.com>
2025-02-25 10:58:02 -08:00
Sami Jaghouar d38b25d1db update gitingore
Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>
2025-02-18 19:57:34 +00:00
apazandGitHub 8bec8a8e28 Add named runs and get_env_config() (#194)
* Ignore project log pickle

* Add `get_env_config()` and names  to runs.
2025-01-15 16:24:35 -06:00
apazandGitHub 57c68c6184 Add profiling and chunked cross-entropy (#192)
* Push EOD

* Update EOD again

* Resolve merge.

* Update dummy metric logger

* Resolve type errors

* Fixed typing

* Remove simulate_multi_node.sh

* Pass ruff check

* Put logs back where they were

* Cleanup

* Fix loss test.
2025-01-14 17:59:53 -06:00
Sami Jaghouarandsamsja fe84fefe6d add install cript 2024-12-04 14:54:58 -08:00
Sami Jaghouar b888717db5 update gitingore 2024-09-24 19:19:33 +00:00
Sami Jaghouarandsamsja bdf5955ebe add mutli run script 2024-09-22 16:44:54 -07:00
Sami Jaghouar 491f220251 add test dist 2024-09-21 23:36:15 +00:00
samsjaandGitHub 36d854c85a Initial commit 2024-09-11 19:07:37 +02:00