100 Commits
Author SHA1 Message Date
Jackmin801andGitHub 7c9c1308dc Register Nano V3 reasoning parser (#2767)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* fix: register nano v3 reasoning parser

* chore: apply ruff formatting
2026-06-11 16:38:51 -07:00
941019f2e3 [feat] multiplex trainer token export and agg to prime monitor on orch side (#2641)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* multiplex trainer output

* update skill

* test: cover multi-run token exports

* feat: export token metrics from orchestrator

* refactor: store token export run fields on microbatch

* refactor: send microbatches without payload wrapper

* test: cover orchestrator token-export metric collection

Adds an integration test asserting the orchestrator's per-step read path
(collect_token_export_metrics) surfaces finite mismatch_kl/entropy mean/max
from real multi-run exports. Complements the file-writing coverage in
test_token_exports_are_run_local; reuses the existing fixture.

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

* fix: defer token-export STABLE until run step fully consumed

A single orchestrator run_step can span multiple trainer steps when the
packer splits its samples across packs (token budget). mark_stable() ran
every trainer step and marked any dir touched that step, so the orchestrator
could read a run step's exports as complete from only the first pack's
sequences and advance its cursor, never aggregating the remainder.

Mark a run's export dir STABLE only once that run step is fully consumed —
gated on the same ready_to_update signal that drives its optimizer step.
Dirs for runs not yet ready carry over to a later trainer step. run_id=None
(single-run export) never spans trainer steps, so it is marked immediately.

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

* feat: stamp token-export metrics with their trainer step

Token exports lag the orchestrator step they're logged under (the trainer
runs behind), so on the default W&B step axis mismatch_kl/entropy appear
shifted right. Log the run step the exports actually belong to as
`trainer/step` so the metrics can be plotted against a lag-corrected axis.

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

* refactor: fold token-export metrics into MetricsBuilder under trainer/

Move the token-export collection from the orchestrator mainline into
MetricsBuilder.build, which now owns the last-logged-step cursor (seeded from
the resumed step via start_step). Namespace the metrics under trainer/
(trainer/mismatch_kl/*, trainer/entropy/*) alongside trainer/step so they
group in W&B and can be plotted against a lag-corrected axis.

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

* refactor: drop redundant max_step from token-export reader

Exports always lag the orchestrator (the current step's batch is shipped just
before metrics are built and trained afterward), so no stable export at or
beyond the current step can exist on disk. The `step <= max_step` filter was
always satisfied; the last_logged_step cursor alone drives correctness.

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

* refactor: return log-ready dict from token-export reader

Drop the TokenExportMetricsResult dataclass that was unpacked into a dict one
line later. collect_next_token_export_metrics now returns the trainer/-prefixed
metrics (including trainer/step) directly, so the builder just updates the log
dict and reads trainer/step back to advance its cursor.

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

* refactor: guard token-export log update under the truthiness check

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

* refactor: drop redundant run_idx guard in SinglePacker

The receiver always stamps batch.run_idx from used_idxs (a key of idx_2_id),
so the is-not-None/in-idx_2_id check was always true. Index directly, matching
MultiPacker.

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

* refactor: mark token-export STABLE with a barrier instead of all_gather

The all_gather_object did barrier + dir-union + rank-0 write. Replace it with a
plain dist.barrier() (so STABLE only lands after every rank flushed its
rank_*.jsonl), then each rank touches STABLE for the dirs it wrote. touch is
idempotent, so ranks sharing a (run, step) dir converge harmlessly, and the
union is covered without shipping dir lists.

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

* refactor: barrier at the call site, drop participate_in_stable_marking

The barrier lived inside the exporter, so the disabled variant needed a
participate_in_stable_marking flag to opt into it. Move the barrier to the
single train-loop call site, gated on token export being enabled (uniform
across ranks): every rank barriers together, then writers touch STABLE and
disabled ranks no-op. DisabledTokenExporter is a pure no-op again and the
exporter does no collectives.

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

* refactor: drop dist.is_initialized guard before token-export barrier

train() always calls setup_torch_distributed before the training loop, so dist
is initialized by the time the barrier runs.

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

* chore: drop redundant comments around token-export barrier

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

* refactor: derive token-export root from output_dir.parent

root_output_dir was just output_dir.parent of self.output_dir and used in one
place; drop the redundant attribute.

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

* fix: skip malformed token-export records instead of aborting the step

Token-export metrics are best-effort monitoring read inside MetricsBuilder.build
every step. A malformed JSONL line or a loss_mask/value length mismatch raised
ValueError, which would abort the orchestrator step. Guard each record, skip and
count failures, and warn once per step dir; good records still aggregate.

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

* feat: drain trailing token-export metrics after max_steps

Token exports lag the orchestrator, so the last shipped steps are finalized by
the trainer after the main loop ends — and build() no longer runs to log them,
dropping the tail. Add an end-of-run drain that polls for the remaining stable
steps up to max_steps-1 and logs each under its own trainer/step (a local W&B
step axis, leaving progress.step for the final checkpoint untouched). Gated on
token export being on for the run; early-returns when build() already kept up;
bounded by a timeout. Shared collection extracted to
MetricsBuilder.next_token_export_metrics.

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

* make token export a top-level trainer flag

* chore: fold token export into multi-run integration config

* chore: revert multi-run trainer config override

* chore: remove token export unit tests

* docs: document token export config migration

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 15:05:10 -07:00
Jackmin801andGitHub 7b7bde1fa0 drop ampere in fa4 (#2452) 2026-05-08 18:01:22 -07:00
Jackmin801andGitHub 0fe673c23c pin vllm down to cu129 (#2450)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-05-08 17:28:27 -07:00
3b01ce9d48 bump vllm version (#2427)
Release / Push CUDA image to Docker (push) Canceled after 0s
* bump vllm version

* fix cuda version pin

* correct flash attn

* chore: drop monkey patches now upstream in vLLM 0.20

vLLM 0.20.1 ships fixes for the LoRA+MoE+DP>1 corruption (#40338) and
the OffloadingConnector CPU block-count miscalculation (#39617), so
remove the local monkey patches and the corresponding call site in
transformers_v5_compat. Refresh stale "vLLM 0.16/0.19" comments.

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

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
Co-authored-by: hallerite <git@hallerite.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 11:01:05 -07:00
Jackmin801andGitHub edf41113fe Revert "chore: bump vllm 0.20.1 + migrate cu128 → cu130 (#2403)" (#2426)
Release / Push CUDA image to Docker (push) Canceled after 0s
This reverts commit bcac552c3f.
2026-05-05 21:12:11 -07:00
af17a555fe fix(qwen3.5-moe): align _compute_attention with FA4 kwarg-based cu_seqlens (#2378)
Release / Push CUDA image to Docker (push) Canceled after 0s
Port the _compute_attention implementation from layers/attn.py so FA4
receives cu_seqlens via keyword args (its 4th positional is qv) and so
sliding_window is honored when set.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 14:13:20 -07:00
Jackmin801andGitHub 5061b8d88e up fa4 version (#2369)
Release / Push CUDA image to Docker (push) Canceled after 0s
* up fa4 version

* update in the arm build script

* uv lock

* update in fix-flash-attn-cute
2026-04-28 19:53:57 -07:00
Jackmin801andGitHub 8457b601d6 [Fix] gpt oss (#2365)
Release / Push CUDA image to Docker (push) Canceled after 0s
* custom gpt oss impl

* gpt oss multilora impl

* gpt oss experts

* add gpt oss to custom model mapping

* add GPToss experts to apply lora

* update warning message
2026-04-27 15:49:51 -07:00
Jackmin801andGitHub 24a2af0054 patch warnings and turn off 3d for qwen (#2356)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-04-26 13:08:46 -07:00
Jackmin801andGitHub b0a7cad8a8 [fix] patch gdn with varlen for qwen (#2346)
Release / Push CUDA image to Docker (push) Canceled after 0s
* patch gdn with varlen

* claude just casually reverted this what?
2026-04-22 23:38:47 -07:00
Jackmin801andGitHub f1bbdf924e missed patch for nemotron state dict (#2340)
Release / Push CUDA image to Docker (push) Canceled after 0s
* missed patch for nemotron state dict

* allow implementing state dict map hook

* address comment
2026-04-22 21:40:56 -07:00
Jackmin801andGitHub 9bbed30eba [Fix] nemotron fixes (#2338)
Release / Push CUDA image to Docker (push) Canceled after 0s
* non gated grouped experts multilora layer

* do bias leveling to avoid overflow

* varlen mamba

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
2026-04-21 20:23:42 -07:00
52b1ae14a6 [fix] add gpt-oss extra to Dockerfile uv sync and fix meta buffers (#2280)
Release / Push CUDA image to Docker (push) Canceled after 0s
* chore: add gpt-oss extra to Dockerfile uv sync

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

* fix buffer init for meta loading

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 17:34:46 -07:00
Jackmin801andGitHub b6a920f10f allow setting log level from env var (#2260)
Release / Push CUDA image to Docker (push) Canceled after 0s
* allow setting log level from env var

* address comment
2026-04-12 16:59:35 -07:00
Jackmin801andGitHub d7770a6738 [feat] attn only lora (#2233)
Release / Push CUDA image to Docker (push) Canceled after 0s
* add patch for oracle expert backend selection

* lora target modules and apply patch conditionally
2026-04-09 09:18:36 +02:00
Jackmin801andGitHub 714d0ea904 comment out patch (#2114)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-27 17:16:55 -07:00
Jackmin801andGitHub 08f8c643cf Fix checkpoint cleanup crashing trainer on OSError (#1763)
* Fix checkpoint cleanup crashing trainer on OSError

When external processes (e.g. checkpoint uploader) hold open file handles
on checkpoint directories, shutil.rmtree can fail with "Directory not
empty". Skip the deletion and log a warning instead of crashing — the
next maybe_clean call will retry.

* Retain failed-to-delete steps in ckpt_steps for retry

Steps where rmtree fails were being removed from ckpt_steps, making
them orphaned and never retried. Track which deletions succeed and
only remove those from the list.

* Restore debug logging before checkpoint deletion

* Revert ckpt_steps tracking, just skip failed deletions

The steps_deleted tracking caused state divergence across ranks since
only master populates it. Keep the original ckpt_steps pruning logic
and accept potential disk leak over complexity.
2026-02-11 00:37:56 -08:00
Jackmin801andGitHub 869717456f Fix model weight loading: crash fix and memory optimization (#1760)
* Fix IndexError in load_state_dict sort for non-standard safetensor filenames

The sort assumed filenames follow the `model-NNNNN-of-NNNNN.safetensors`
convention, crashing on files like `model.safetensors`. The sort is
unnecessary since the function merges all shards into a flat dict where
key order doesn't matter.

* Only load full snapshot on master rank for format conversion

Previously all ranks loaded the full model weights into CPU memory just
to check key names for format detection. Now all ranks read only the
safetensor key names (no tensor data), and only master loads the full
state dict when conversion is actually needed.
2026-02-11 00:22:56 -08:00
Jackmin801andGitHub 050490e0f6 Fix broadcast alpha rank (#1729)
* save lora config with orchestrator alpha and rank

* move alpha definition to orchestrator

* making rank default to trainers rank makes more sense
2026-02-09 16:14:14 -08:00
Jackmin801andGitHub f14c8d6c2d user inference pool client instead of starting one for validation (#1704) 2026-01-31 20:39:05 -08:00
Jackmin801andGitHub b798a90d6a [ci] benchmark test (#1696)
* weee test

* add it to gha

* 4gpu test

* add row for 4 x a6000 to benchamrks

* change the baseline a bit

* im not sure if we actually regressed :(

* up tolerance because massed compute suk
2026-01-31 20:13:51 -08:00
Jackmin801andGitHub 53ddafcbee remove cc check for grouped mm (#1692) 2026-01-30 14:46:29 -08:00
Jackmin801andGitHub 370221cb4e [fix] dont create config dir on trainer during config validation (#1690)
* dont ever create config dir

* add parsing error back

* remove test for error file on missing config
2026-01-30 12:56:06 -08:00
Jackmin801andGitHub 25f604ed01 [ci] make multi run test do 2 gpu trainer and 2 inference servers (#1682)
* make multi run rl test run on 4xa6000

* make multi run test do 2:2
2026-01-29 15:16:42 -08:00
Jackmin801andGitHub 137e36add5 [fix] zombie guard on checkpoint (#1670)
* zombie guard on checkpoint

* make the cleanup code safer

* make resume from latest stable so we dont try to resume from orchestrator only ckts

* simpler logic

* the old checkpoint step discovery is needed by single packer

* we need to relook for stable step in load_run otherwise packer might ahveincremented the step and we are introuble

* dont set step after ckpt load because we might reset packer progress
2026-01-28 15:41:08 -08:00
Jackmin801andGitHub 756b78e7a4 skip openai integ tests if key not set (#1662) 2026-01-26 02:35:39 -08:00
Jackmin801andGitHub 53a5ab868b [fix] use discovery in eval (#1642)
* use discovery in eval

* make eval use lora name unless none of the servers have it

* address comments to encapsulate and not be too defensive

* type hinting

* pass model name directly instead of doing model config

* better logging

* we dont need complicated discovery because only ckpt 0 is base in lora

* wait indefinitely similar to the env workers

* move the wait into discovery
2026-01-23 08:10:49 +01:00
Jackmin801andGitHub 0ca5739f75 Allow trainer to evict runs that write bad batches (#1634)
* add run eviction logic

* add some tests

* add run eviction to docs

* update rename in index

* make packer evict runs it doesnt like

* add check for teacher logprobs

* dont error on idx not found in case we double evict

* remove stale test

* this log is quite spammy

* rename config folder to control
2026-01-21 16:10:10 -08:00
9613f61b9b Disable final checkpoint saving when max_concurrent_runs > 1 (#1632)
* Disable final checkpoint saving when max_concurrent_runs > 1

When max_concurrent_runs > 1, checkpoints are managed by the
MultiCheckpointManager at the whims of the orchestrator, making
the final checkpoint save in the trainer redundant and meaningless.

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

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>

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

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-01-21 11:57:24 -08:00
Jackmin801andGitHub 11c84c2853 [fix] make search for line more robust (#1630)
* make search for line more robust

* need the fix in above line as well
2026-01-20 19:47:58 -08:00
Jackmin801andGitHub 66bfa0f473 up vllm version to 0.14 (#1625) 2026-01-20 16:37:03 -08:00
c3de771b0d [Refactor] rename Runs -> RunsManager and cleanup hooks (#1619)
* better runs docs

* some renamin

* missed tests

* missed comments

* meraid docs render in gh according to CC [skip ci]

* better diagram [skip ci]

* Update docs/runs.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>

* docs update

* rename to MultiRunManager

* guard the discovery apis rom being used by non master ranks

* variable renaming

* sync runs to synchronize state

* dont register master only hooks on non master

* encapsulate lora hook registration into run manager setup

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-20 12:54:48 -08:00
Jackmin801andGitHub 41a66e2b26 fix comma in benchmark json (#1618) 2026-01-19 16:45:48 -08:00
Jackmin801andGitHub 8718eb143d [CI] Add CP and EP to benchmarks (#1614)
* add ep

* add cp

* add ep and cp to the table

* rename json in benchmark ci

* add some cp and ep tests
2026-01-19 15:18:34 -08:00
Jackmin801andGitHub 2486860eba [feat] Multi run ckpt (#1593)
* support index in register post creation callback

register scheduler at index 0

plumbing

first draft

fixes

* just copy for now

* fix issue where only master tracks saved ckpt steps

* only master should do the broadcast copy

* add deletion hooks

* delete stale managers on deletion

* support the -1 convention

* make orchestrator broadcast support reading from ckpy dir

* only delete manager if it exists

* fix: add creation hook so we check existing ckpts before orchestrator
creates them

* missing arg [skip ci]

* dcp is not my friend

* add ckpt config to test

* more efficient trainer

* include some stop resume in the tests

* fix tests

* add some useful debug logs

* fix: type in orch check

* fix: dont load progress in create run hook

* broadcast progress so all ranks know when to ckpt

* better debug log for ckpting

* fix: we must wait for trainer checkpoint before we can delete run

* ci uses single gpu trainer

* Revert "ci uses single gpu trainer"

This reverts commit 7b0382b947aa0cb2af64645c17d849708adef467.

* refactor wait and kill for tests

* tests passing but kinda messy

* remove old log

* cleanup test

* cosmetic changes to multi run test

* fix: missed orch proc setting

* put start print in a better location

* exclude the resumes from reward go up check

* use stable file to mark trainer is done with checkpointing

* the barrier needs t be outside the try catch

* add timeout to wait for file

* mark stable after last barrier

* error in wait for log if timeout

* fix fixture signature

* append to tracked steps after barrier

* fix bad while else

* fix: move barrier and mark stable into the loop

* the orchestrator finish wait was apparently necessary for beta orch to exit correctly

* better error message for not finding weight dir

* cleaner manager creation in multi ckpt

* try catch the weight copy

* fix: manager access in clean

* move wait file print to less spammy place

* no max steps in trainer toml should make it infinite

* add comment about wide try except
2026-01-19 14:42:40 -08:00
Jackmin801andGitHub 08afcd20c1 [fix] use step change instead of batch size to demarcate when to update (#1613)
* use step change instead of batch size to demarcate when to update

* address copilot comments
2026-01-18 13:40:13 -08:00
Jackmin801andGitHub 213553403c Fix timeout overcounting (#1612)
* smaller timeout [skip ci]

* fix timeout overcounting into next step
2026-01-18 10:53:11 -08:00
Jackmin801andGitHub 147e443101 Revert "fix logging (#1605)" (#1611)
This reverts commit 0e53e7f19b.
2026-01-16 16:49:35 -08:00
Jackmin801andGitHub b214a4536c adjust multi run test args to be less flaky (#1606) 2026-01-16 12:31:42 -08:00
Jackmin801GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>github-actions[bot] <github-actions[bot]@users.noreply.github.com>
d8f290ef03 [CI] nightly perf (#1566)
* support exporting json in bench mode

* script to run one benchmark

* auto set batch size

* aggregation script

* draft nightly

* add benchmarks folder to image

* support passing docker image

* use image and from micro batches

* some reordering and passing more args

* try this

* use runner name in step name

* bash the entrypoint and working dir

* rename artifact

* dont support sft lora for now

* remove concurrency gorup

* print last 100 lines in success so we can see the table in the ci run output

* add comment

* make containers use host HF home to speedup multiple tests on the same runner

* set max loras

* use hosts root cache

* add runner to artifact name

* make baselines dir

* dont use this random dudes step wth claude

* do /data

* don do labels

* try to just use a named volume

* try directly having root level dir

* try clearing lock and changing permissions

* just start container as root

* god i cant rmb the name of my own args

* better device name surfacing

* pin a digest because tag might drift

* should probably make it easier to test changes to agg result but yolo i trust the ai overlords

* get the image digest on a self hosted runner so we have image cache

* go out of our way to surface OOM

* allow setting diff display threshold

* baseline should be set after running not before

* put docker image in the markdown

* displaying per microbatch step time probably makes more sense

* set better name for benchmark json files

* dont use batch size in config key

* move constants to the top

* rename and cleanup

* wishlist matrix

* missing commas lol

* fix typo

* use the 1xa6000 as the digest runner

* rename workflow

* set longer timeout for 235b

* try shell arithmetic

* we need to multiply the num tokens by dp size

* add time taken

* better sorting key

* change hardware col order

* just print every line in the success case, we arent poor

* lines

* wishlist benchmarks

* prune some more errors

* remove some dead ones

* rl bench validator

* add timeou to run single benchmark

* only copy the scripts

* sort matrix a bit better

* more pruning and tuning

* Update benchmark results 2026-01-16 (#13)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Apply suggestions from code review

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>

* make regression flag more unique

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-01-16 11:44:18 -08:00
Jackmin801andGitHub 7a50d2680e check for current step based on progress to know what is valid for this step (#1604) 2026-01-15 20:47:43 -08:00
Jackmin801andGitHub c95bd79d43 Make packer pack smaller granularity and round-robin (#1542)
* generated packer tests

* simplify packer tests

* packer doc

* support buffers and smaller orchestrator granularity

* fix duplicates in filesystem reader

* make small batch granularity toggleable to not break single run behavior

* add comment about temperature

* fix reset staleness

* fix: cc is way too defensive and didnt understand what we meant with needing full batches in small_batch_granularity=False case

* missing samples increment

* guard infinite loop in select samples

* remove the tests because the previous logic didnt make sense so theyre probably super stale and confusing

* fix: check every run in full batch case

* do popleft

* add create run data hook

* just prealloc state cuz life is easier

* set small granularity packing on the multi run test

* remove debug prints

* have very descriptive name for pack flag

* the doc isnt particularly helpful

* cover overfull case

* split out single run packer

* remove packer arg

* missing step arg

* pop out the oversized batch

* take out tokens collected if skip

* transport config

* move packing reset hook to deletion
2026-01-14 19:43:36 -08:00
Jackmin801andGitHub dddc0ddfb7 add fa3 to deps (#1580)
* add fa3 to deps

* pin prebuilt wheel instead
2026-01-13 15:52:23 -08:00
ddb9571ef4 Update LoRA layer default alpha from 16.0 to 32.0 (#1571)
Ensures consistency with the config default changed in #1567. The
MultiLoRALinear and MultiLoRAGroupedExperts classes had stale defaults
that should match the orchestrator and trainer configs.

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-12 09:21:21 -08:00
Jackmin801andGitHub d70a00f6e8 [fix] orchestrator shouldnt have null batch (#1563)
* orchestrator shouldnt have null batch

* change to zero check so partial is stil allowed
2026-01-09 19:01:39 -08:00
1fa70e83dd feat: set default fused_lm_head_chunk_size to 2048 for RL training (#1544)
* feat: set default fused_lm_head_chunk_size to 2048 for RL training

Auto-configures model.fused_lm_head_chunk_size to 2048 for RL training
when not explicitly set. SFT training continues to use None (no chunking)
as it doesn't support chunked loss yet.

* docs: update fused_lm_head_chunk_size description and changelog

Update the field description to mention RL training auto-sets to 2048.
Add changelog entry for the default behavior change.

* Fix: RL training auto-sets fused_lm_head_chunk_size except for liger_kernel

Co-authored-by: ongjackm <ongjackm@gmail.com>

* Refactor check_number_in_range to improve step searching

Co-authored-by: ongjackm <ongjackm@gmail.com>

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-01-09 12:55:43 -08:00
Jackmin801andGitHub 16e747c25e set multinear linear cumsum dtype to int32 (#1557) 2026-01-07 21:34:24 -08:00
Jackmin801andGitHub e75677fcbd [Feat] multi run optim args (#1555)
* orchestrator config is ok and component integrations look satisfactory

* rename lora_name to lora.name in orchestrator

* fix in rl.py

* multilora independent scaling factors

* train.py changes

* changes to runs

* update tomls for lora.name

* set the default lora rank to trainers

* set lora scaling dtype to bf16

* missed lora_name -> lora.name

* allow run to reset the lora globals

* damn these configs got hands

* i feel like i might have made my life hard for no reason. ah well, im lazy to think of somethin better rn

* set higher default lr on orch side

* fix configs for non-master ranks
2026-01-07 18:50:40 -08:00
a24ec986b3 Remove PR template (#1550)
With agents now drafting PRs and auto-generating descriptions, the
template with placeholder text is no longer needed.

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-07 01:39:50 -08:00
d564195cac [feat] Enable loss chunking for non-custom HuggingFace models (#1545)
* [feat] Enable loss chunking for non-custom HuggingFace models

Add support for chunked loss computation (via FusedOutputLinear) for any
HuggingFace CausalLM model, not just custom PrimeRL implementations.

Changes:
- Add wrap_lm_head_for_hf_model() function in model.py that:
  - Wraps the lm_head with FusedOutputLinear or VanillaOutputLinear
  - Overrides the model's forward method to accept labels and temperature
  - Returns PrimeLmOutput with logprobs/entropy for chunked mode
- Update setup_model() to call wrap_lm_head_for_hf_model for non-PrimeRL models
- Remove config validator restriction that limited fused_lm_head_chunk_size
  to custom/auto implementations
- Add tests for HF model wrapping with both vanilla and fused modes

* change PrimeLmOutput to TypedDict so that it is pytree node by default

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

* change all references to output for dict

* guard against unconventional model being used

* dont be so defensive in tests with model output

* guard against lm heads with bias

* move lm head injection logic into lm_head.py and unify injection path for custom and hf impl

* update inject in tests

* fix forward signature for custom impls

* cover input embeds case

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Matej Sirovatka <54212263+S1ro1@users.noreply.github.com>
2026-01-06 18:56:06 -08:00
f870bc91df [feat] moe lora (#1526)
* plumbing to get it to be loaded

* first draft without tenant splitting

* correct fqns

* cleanup multilora moe impl

* fix: param counting

* fix excessive vram usage due to views

* fix perf lora adapter param counting

* make packer only pack global mbs rows with similar run_idx

* add comment because this packing is kinda weird

* fix: set offset correctly for multiloramoe

* idk if th vibe coding has more typos or me

* support lora dropout

* add experts to default lora targets

* remove outdated tests

* feat: Add LoRA dropout to MultiLoRAGroupedExperts

Co-authored-by: ongjackm <ongjackm@gmail.com>

* cursor nits

* forgot the changelog lol

* Update CHANGELOG with recent changes and fixes

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Johannes Hagemann <johannes@primeintellect.ai>
2026-01-05 13:21:43 -08:00
Jackmin801andGitHub 895e7d6901 take out step in wandb monitor (#1516) 2025-12-31 10:22:18 +01:00
Jackmin801andGitHub 2e5f3e88e4 [Feat] Multi-lora layer, data packing, optimizer, broadcast and scheduler (#1433)
* kitchsen sink

fix device for set offsets

fqn hook on multilora

refactor: base lora layer

dont export private stuff and use abs pathing;

standardize int32 cast for lora_num_tokens

encapsulate logic into multi lora module

save module instead of parameters

move registration into apply lora

* fix no more experimental

* move more things to base

* have overriden state dict function

* set correct device for multi node offset

* fix: other ranks need to init optimizer in run hooks

* refactor: move creation and deletion into their own functions

* introduce sync runs in run object

* follower ranks sync runs from master

* fix: import dist

* move run init to after PG setup

* drop deletion hooks and make creation hooks happen in sync_data instead of check for changes on master

* make state dict creation for lora on runs

* wrong indentation

* fix some comments

* only full tensor on the updating model

* fix: dont reset ready to update in delete run data

* fix test import

* untested multi-scheduler [skip ci]

* take out debug print in multi optim

* remove lora lienar

* defaults for lora num tokens

* make multi optimizer suport both paths [skip ci]

* rename multilora module

* move set offsets into base

* remove unused state dict func

* make named params call abstract in base class

* add back setup_optimizer

* have assert before pack

* return zero if nothing is ready to update

* correct cover max concurrent 1 case

* only step on ready to update idxs

* remove irrelevant comment

* set the default max concurrent to 1 for tests to pass

* fix batch tests

* fix: init process grtoup in runs test

* add wait for optimizer to be created in lora case

* have list to cover muon case

* multi run tests

* add multi run to tests

* route the padding tokens to the last lora

* typo in the ignore

* runs doc

* fix: chunk cu offsets in cp

* fix: sort used idx to maintain consistency across ranks

* only master checks for changes

* rename set offsets to set multilora offsets

* dont have multi components for single run [skip ci]

* fix: we still need to wait for run 0 creation because otherwise, its arrival will reset the parameters and this may happen after ckpt loading which would wipe the ckpt

* change dist init to fixture

* hide optim creation nuance in setup optimizer

* move the hook registration into scheduler.py

* missing optimizer arg

* rename to multilora components

* fix: trainer shouldnt accidentally revive runs that have been deleted mid update

* we shouldnt need this guard anymore

* sft shouldnt have the lora option as it doesnt have runs so it wont reset

* remove all the code specific stuff and just have a high level in the docs

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
2025-12-29 02:33:48 -08:00
4f97f39da5 feat: Enable activation checkpointing when activation offloading is enabled (#1493)
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-12-27 02:18:13 -08:00
72e9548068 Lora weight broadcast removal (#1489)
* Remove weight_broadcast.adapter_only config option

The adapter_only flag was automatically enabled when LoRA was configured,
making it a redundant configuration option. This change:

- Removes the adapter_only field from BaseWeightBroadcastConfig
- Derives adapter_only behavior from the presence of lora_config in
  FileSystemWeightBroadcast
- Simplifies validate_lora_broadcast by removing adapter_only logic
- Removes adapter_only from rl_lora config TOML files
- Updates broadcast_weights method signatures to remove adapter_only param

* Refactor: Remove trainer.weight_broadcast.adapter_only

Co-authored-by: ongjackm <ongjackm@gmail.com>

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-12-27 01:24:46 -08:00
27295a7419 [feat] auto impl selection (#1488)
* auto impl selection

* Refactor: Change model.impl default to auto

Co-authored-by: ongjackm <ongjackm@gmail.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-12-27 00:22:47 -08:00
Jackmin801andGitHub 857df41c91 dont return prompt logprobs (#1485) 2025-12-26 06:56:44 +01:00
Jackmin801andGitHub 67af6779a7 [fix] error if train seq len too short and add arg for setting in rl.py (#1455)
* error if train seq len too short and add arg for setting in rl.py

* change all configs to use root seq len

* update changelog

* just inline the util

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
2025-12-22 10:15:59 +01:00
Jackmin801andGitHub 3147f5fed3 fix: set model seq len (#1452) 2025-12-18 14:45:55 -08:00
Jackmin801andGitHub 8e4deb68cf runnable (#1450) 2025-12-17 21:01:19 -08:00
Jackmin801andGitHub 6fe5a559d4 [Fix] lora inplace load (#1449)
* fix: patch load lora post to not inc lora idx

* patch LRUCacheWorkerLoRAManager

* fix: move remove to before capacity check
2025-12-17 19:52:20 -08:00
72c5f5f656 Upgrade vllm (#1427)
* dont use enum setter for logprobs mode

* fix: stale imports

* update to torch 2.9

* init_app_state doesnt take vllm config anymore somehow

* use runnable because of CUDAGraphWrapper

* vllm now uses default seed 0

* fix import

* moe venv

* use mjun flash attn for torch 2.9 and up vllm version

* Revert "moe venv"

This reverts commit 8934ceb3f92e3d38d8423f4f5418b8766d315548.

* remove some todos

* remove unused import

* Apply suggestions from code review

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>

* set very high max cpu loras to patch around areal lora hack

* make flash attn optional and put uv sync extras everywhere

* Integrate token-in route with vLLM v0.12.0 (#1444)

* Move LoRA out of experimental section (#1440)

* Add Bug Bot instructions for changelog enforcement (#1441)

Co-authored-by: Cursor Agent <cursoragent@cursor.com>

* duplicate chat completinos endpoint into /generate

* serve chat with token in functionality

* use field to avoid misleading warning

* nicer error msg

* lock feature branch

* make use tokens prompt configurable

* use setter and print info

* bump

* include inference

* do not print warning log (logs all the time)

* bump

* bump + bring back warning log

* bump vf

* bump vf

* use dp=6 in wordle example

* no deepcopy and no warning

* do not tokenize on the server

* add field names so that tokens is cached and no warning of unrecognized field is shown

* bump vf

* auto install

* bump vf

* bump vf + set vllm tokenize method

* skip applying chat template

* Revert "skip applying chat template"

This reverts commit 43c6a2b2a835fbf2def3ed93571ec3c3a2aa945c.

* Revert "do not tokenize on the server"

This reverts commit 918219176773ad45bd45e749e0e596d6d1a7e423.

* bring back log

* use route /v1/chat/completions/tokens

* fix log

* bump vf and make everything configurable

* bump and more informative log

* bump and make non-exact tokenization default

* use token prompts by default

* remove retokenization issue from docs

* rename class

* bump vf

* fix auto asc setup for lora

* bump vf

* bump vf

* bump vf

* bring back setter

* bump vf

* bump vf to latest prime-rl

* make custom routes v0.12.0 compatible

* monkey patch api server worker proc again to enable multi api server mode

---------

Co-authored-by: will brown <williambrown97@gmail.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
Co-authored-by: Mika Senghaas <mail@mikasenghaas.de>
Co-authored-by: will brown <williambrown97@gmail.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-12-17 17:19:40 -08:00
Jackmin801andGitHub 4fad366276 [Fix] clean orch dirs (#1437)
* clean brdcast and rollout

* clean orch log dir
2025-12-16 15:37:27 -08:00
4bc4cc6806 Fix spammy debug log (#1431)
* fix spammy debug log

* call to action for empty

* Update src/prime_rl/transport/filesystem.py

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

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
Co-authored-by: samsja <55492238+samsja@users.noreply.github.com>
2025-12-15 19:33:45 -08:00
Jackmin801andGitHub 580a016488 [Fix] Error on update fail (#1429)
* error on update fail

* cancel other task so it exits
2025-12-15 17:13:01 -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
Jackmin801andGitHub a5ee737636 Fix moe lora (#1375)
* move lora layer to models

* strip and init meta

* add debug log

* skip lm head if tied weight embeddings

* use load using meta

* fix: exclude lora from pre load state dict hook

* make lora linear support any module

* add tests

* add tests for sequential

* remove rl lora config

* add logic to save dp_replicate_ranks

* fix: dont do relicate seeding when no dp replicate

* just raise NotImplemented for now

* fix: param freezing test

* broadcast seeding on dp replicate
2025-12-11 19:43:02 -08:00
Jackmin801andGitHub edda3bd028 [Fix] patch vllm statslogger to be ok with lora dp and helm chart to support multi-client for inference replicas (#1393)
* all claud opus 45 lol

* use pod specific inference urls

* fix: bad inferenc url [skip ci]

* fix: inference url in reverse text example

* Revert "all claud opus 45 lol" [skip ci]

This reverts commit 65064c2c9c9a50b604c2cf0c591e001c02aece33.

* monkey patch is da way
2025-12-09 21:30:11 -08:00
Jackmin801andGitHub 108af723b1 [Fix] ac lora (#1388)
* dont shard adapter state dicts

* strip pytorch wrapper prefixes

* throw on empty state dict

* saved by cursor
2025-12-04 12:10:32 +08:00
Jackmin801andGitHub 28c93fa656 exclude top k from max vio calculation to try and skip the "padding experts" (#1332)
* use second expert

* do top k + 1

* just cut out the padding experts from the calc

* zero on the original
2025-12-03 17:09:11 -08:00
Jackmin801andGitHub 70c15aaeee Revert "add dp replicate forcing (#1245)" (#1373)
This reverts commit cc0b6cc5eb.
2025-12-03 03:27:44 +08:00
Jackmin801andGitHub a5fd637104 refactor models to dir and add model specific conversion function (#1356)
* refactor models to dir and add conversion function

* move llama too

* fix qwen3 moe conversion tt -> hf

* use index 0 in the conversion

* add tests for qwen3 moe

* add tests for conversion

* fix position ids for HF

* fallback to for loop for non hopper

* fix: imports need cuda

* remove unused scripts

* fix default device and dtype at module level bad

* take out moe specific language

* fix tests

* fix missing cls

* use custom init buffers

* add back conversion test

* make max layer counting and looping simpler

* cover qwen with mlp case

* add tests for llama

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
2025-12-02 13:23:52 +08:00
Jackmin801andGitHub 2aa47ae6b7 Support broadcasting just lora weights and drop support for merged weights (#1320)
* expose lora apis in client

* support lora in orchestrator

* fix: dumbest bug ever

* fix: dont unload because it will 404 inflight requests

* fix: dont crash without lora

* add full_weight prefix

* add dynamic lora tests

* run non lora and lora test separately

* use lora_name instead of load_lora

* have step in lora name so its less confusing when name ends with number

* fix: test should use lora name now

* do inplace update of lora adapter

* cleanup lora adapter after training

* TEMP: test scripts

* TEMP: script changes

* TEMP: parallel scripts

* TEMP: update meow.sh to use reverse text model

* dont unload weights in update

* fix ruff

* fix: save adapter separately moved

* support broadcasting

* Revert "TEMP: update meow.sh to use reverse text model"

This reverts commit 18326d48838fa2be4839190cd4cf84f45c294cae.

* Revert "TEMP: parallel scripts"

This reverts commit 1ca54b25f57d30679c8256abd4c01ae1949a3bec.

* Revert "TEMP: script changes"

This reverts commit 20fb5f33a979b873602ee058261531b6446d7b55.

* Revert "TEMP: test scripts"

This reverts commit 05631dec3398c782be8843ee23d8006916768bd8.

* drop unused merged weights

* remove unused counting

* remove unused stuff

* fix server in test

* fix ckpt saving for lora

* fix args in test

* print logs for easier debugging ci

* run lora one first to fail fast

* add logging to non lora test

* make output dir?

* Comment out LoRA adapter unloading logic

Comment out the unloading of the LoRA adapter in orchestrator.py.

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>

* make cursor bot happy

* dont unload for now

* restore original order

* add validation for adapter only

* change everything to adapter only

* have base broadcast config

* guard nccl broadcast from adapter_only

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
2025-11-21 15:22:18 -08:00
Jackmin801andGitHub 797afb5948 [Feat] ckpt convert scripts (#1053)
* export one big model safetensor

* support sharding safetensor for upload to hf hub

* convert moe to hf

* dont index 0 if we dont have degenerate dimension
2025-10-02 21:18:11 -07:00
Jackmin801andGitHub 199b49010b Use 'head_dim' from config if available (#1050)
Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
2025-09-30 10:17:36 -07:00
Jackmin801andGitHub 9e01aa0e0d [Feat] better custom (#1027)
* extract glm layers

* extract glm layers

* take out attention masks

* ruff stuff

* move rope in glm out

* cut more blubber

* remove some more unused args

* add qwen

* type hints

* refactor mlp

* fix some qwen kwargs and allow intermediate dim greater than hidden dim in attn

* rename custom models to models

* support none position ids
2025-09-29 14:29:25 -07:00
Jackmin801andGitHub 962c1ae1ea support setting torch dist timeout in config (#1037) 2025-09-29 11:45:25 -07:00
Jackmin801andGitHub cb65ae97ba support data replicate (#1033) 2025-09-28 21:09:14 -07:00
Jackmin801andGitHub 511dbf7f16 log total (#1020) 2025-09-25 16:22:27 -07:00
3476520e9e BC moe impl (#1001)
Co-authored-by: prime <prime@intellect.ai>
2025-09-23 22:12:47 -07:00
1bf42f302f Feat update moe impl glm (#967)
* import latest moe impl from torchtitan

* flash attn path in glm

* fucking claude

* raise for unknown attn

* new moe doesnt compile for some reason

* turn off expert bias

* fix: move tokens_per_expert zero_ to after the bwd

* pass cu_seqlen from uncompiled portion

* Update src/prime_rl/trainer/custom_models/glm.py

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

* fix sdpa paath

* fix sutff

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
Co-authored-by: samsja <55492238+samsja@users.noreply.github.com>
Co-authored-by: Sami Jaghouar <sami.jaghouar@hotmail.fr>
2025-09-22 20:57:07 -07:00
307dfe277f [Feat] export traces (#960)
* support exporting traces

* dont allow massive traces

* add tracing to rl

* prettty sft

* raise instead of assert

* fix import

---------

Co-authored-by: Sami Jaghouar <sami.jaghouar@hotmail.fr>
2025-09-19 13:22:25 -07:00
Jackmin801andGitHub 4321960ee3 [Fix] test in container (#958)
* os.getlogin() will error in containers

* use older antlr4, i actually dk what thispkg does
2025-09-18 21:52:30 -07:00
babb1f4295 [Fix] meta loading with compile (#957)
* disable meta loading when compile

* fix compile loading incorrectly

* Update src/prime_rl/trainer/model.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-18 19:59:17 -07:00
Jackmin801andGitHub 60ab908c71 [ci] fail rl test on reward too low (#944)
* always save a final summary for orchestrator

* add check on reward values above threshold

* move output dir setting to earlier

* skip if no config
2025-09-18 05:15:48 -07:00
Jackmin801andGitHub 66b13aa613 [fix] always fix rotary if they are in the buffers and ignore tt moe buffers (#942)
* fix: always fix rotary if they are in the buffers

* cover tt moe buffer case

* allow partial load again

* add option to log signature

* allow disabling meta loading

* dont compress signature

* support setting optimization dtype

* change default optim dtype to fp32

* torch_dtype -> dtype
2025-09-17 19:51:00 -07:00
Jackmin801andGitHub 0bbf0bb0b5 [Fix] meta loading (#937)
* tensor hashing utils

* support meta in tensor hashing

* working but suboptimal?

* cleanup;
2025-09-16 22:00:23 -07:00
Jackmin801andGitHub 6343d9743c [feat] Up vllm version (#919)
* up vllm version and add tt deps

* remove monkeypatch for process logprobs

* no need for deps moe

* remove venv test

* we dont need the dual version in model loading anymore now that all is torch2.8

* dont use load dcp from hf

* add comment explaining bad load dcp line
2025-09-16 10:34:45 -07:00
Jackmin801andGitHub 186d5ae92d use from config path for meta device (#921) 2025-09-15 20:15:40 -07:00
Jackmin801andGitHub 72a499550e fix multinodes (#912) 2025-09-13 23:17:25 -07:00
719627dfcd [feat] dcp loading from hf (#911)
* dcp loading from hf

* fix max vio PR

* fix: private import for torch 2.7

* dont support torch2.7 at all

* use snapshot download method which is much faster

---------

Co-authored-by: Ubuntu <ubuntu@denvrbm-2007.hou1.cloud.denvrdata.com>
2025-09-13 18:43:01 -07:00
Jackmin801andGitHub c250a20aa2 [fix] use max for max vio (#905)
* use max for max vio

* this one should be avg

* fix: better max vio for fsdp

* move the divide
2025-09-13 12:06:24 -07:00
Jackmin801andGitHub 153570cbc7 [Chore] update transformers (#880)
* up transformers version and add accelerate

* main lock

* moe lock
2025-09-09 14:40:14 -07:00
3b39c2e8f9 [Feat] support cp in sft trainer (#845)
* support ep tp

* take parallel dims from torchtitan

* fix logger

* get back to what we previously supported [skip ci]

* duplicate data on non dp rank

* refactor parallel dims into training script

* take out debug prints

* implement pack functions

* guard stacking in cp

* add back sftdataconfig type annotation

* dummy context when no cp

* guard in rl because im lazy

* make simpler truncate loging in stackingdataset

* bucket timeout

* greedy combine and pad

* cover mesh dim 1 case

* why none instead of empty list?

* always have dp shard dim

* reverse ugly workaround

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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-31 00:39:51 -07:00
Jackmin801andGitHub e2e6f9ab1a fix: add epsilon to loss scale division to prevent nan loss on padding batches (#808) 2025-08-22 14:02:57 -07:00
Jackmin801andGitHub 53832e7ddb [fix] dont error on mixed dense moe models (#807)
* fix: dont error on moonlight which has 1 dense at the start

* use singleton logger
2025-08-22 12:25:48 -07:00
Jackmin801andGitHub bab8127a94 [feat] max vio in sft (#789)
* max vio in sft

* fix: non moe needs to work

* log max vio in rl trainer

* rename to micro step

* reset stats after getting stats
2025-08-22 03:28:58 -07:00
Jackmin801andGitHub 3b10a88de4 [Fix] moe mfu (#803)
* add requested type hint

* implement method to get active params

* add test to guard new flop counting behavior

* CI doesnt have torchtitan

* remove comment

* remove main in test

* guard gpu peak flop for tests

* fix: isolate meta device as default to just test perf counter context
2025-08-21 18:11:48 -07:00
Jackmin801andGitHub ad6c3036d5 [Fix] MoE pyproject (#787)
* fix: port vf changes

* update lock

* add venv test

* sync script

* overwrite when test fails

* dont overwrite cuz too ugly

* add doc
2025-08-20 14:50:27 -07:00