* 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>
* 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>
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>
* 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>
* 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.
* 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.
* 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
* 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
* 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
* 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
* 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>
* 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>
* 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
* 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>
* 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
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>
* 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>
* 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
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>
* [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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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
* 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
* 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>
* 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>
* 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
* 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
* 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
* 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
* 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>
* 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>
* 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