Compare commits

...
Author SHA1 Message Date
6bfbd64aef chore(deps): bump verifiers + research-environments to latest main (#2976)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
Bump both submodules to their current upstream main:
- verifiers:              50883f16 -> a497ee52
- research-environments:  404f0fa8 -> 3e3b5ac3

Reconcile pyproject/uv.lock with upstream changes:
- research-environments moved the SWE tasksets under environments/swe/,
  so repath r2e-gym-v1, scaleswe-v1, swebench-pro-v1, swebench-verified-v1
  and swelego-v1 to environments/swe/<name>.
- research-environments removed the v0 general_agent and rlm_search envs
  (#646), so drop general-agent and rlm-search from the `envs` extra and
  [tool.uv.sources]. general-agent-v1 is unaffected.

verifiers is consumed only via the verifiers.v1 namespace; the removed
verifiers.rl / verifiers-rl code and the RolloutContext->ModelContext
rename do not touch prime-rl. Verified `uv sync --extra envs` resolves,
all 64 env dists install, the moved SWE envs import, and prime-rl's
verifiers.v1 imports (incl. EnvConfig(vf.EnvServerConfig)) still work.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 14:39:52 -07:00
Sebastian MüllerandGitHub b453f40d8c fix(orchestrator): train shared sampled nodes exactly once across branches (#2975)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* fix(orchestrator): train shared sampled nodes exactly once across branches

trace_to_samples built one sample per branch using branch.sampled_mask
directly, so a sampled node lying on N branches (a mid-trajectory fork)
was mask-True in N samples and received N x the gradient weight. Grant
each sampled node its mask only in the first branch containing it; later
branches carry its tokens as context (mask False). No behavior change
for traces whose branches share only input nodes.

* fix(orchestrator): keep echo branch/sample zip aligned under fork dedup

Extract the dedup'd branch selection into iter_trainable_branches and use
it in both trace_to_samples and EchoAlgorithm._weight_observations. When
a later branch's only sampled tokens are on an already-trained shared
node, it yields no sample; echo's old any(branch.sampled_mask) filter
would still count it, shifting the zip with rollout.samples on forked
traces.
2026-07-08 19:11:54 +02:00
samsjaandGitHub 1b028ca1d1 bump depsj (#2967)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
2026-07-07 09:10:48 -07:00
samsjaandGitHub e96bbae2dd feat: derive inference node counts (#2959)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
2026-07-06 10:03:29 -07:00
samsjaandGitHub df2acf4874 bump vf (#2956)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
2026-07-03 20:31:12 -07:00
samsjaandGitHub 5ff9abd8b5 bump re (#2955)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
2026-07-03 20:23:40 -07:00
5448f5a722 feat: opt-in fp32 MoE routing (trainer gates + inference router logits) (#2952)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat(trainer): fp32 MoE router gates via model.moe_router_dtype

Add model.moe_router_dtype = "float32" to run MoE router gates in fp32,
matching checkpoints trained with fp32 routing (e.g. GLM-5.x via Megatron's
--moe-router-dtype fp32):

- router gate weights are cast to fp32 and exempted from the FSDP bf16
  parameter cast via a nested fully_shard unit with an fp32 mp policy
  (gradients also reduce in fp32)
- TokenChoiceTopKRouter upcasts the gate GEMM input to fp32, so routing
  logits are fp32 end-to-end in forward and backward (NemotronHRouter
  already computes in fp32; it only needed the weight exemption)
- router FSDP units join the manual EP prefetch schedule

Default "bfloat16" preserves current behavior exactly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(inference): fp32 MoE router logits for DeepSeek-family models

Add inference.enable_fp32_router_logits (default off): sets
out_dtype=float32 on vLLM's DeepseekV2MoE gate via a monkey patch, so the
bf16xbf16 gate GEMM writes its fp32 accumulator out unrounded instead of
truncating router logits to bf16 before expert scoring (GateLinear's
cuBLAS tier on SM90+). Covers GLM-5.x (glm_moe_dsa), which was trained
with fp32 routing; pairs with trainer.model.moe_router_dtype="float32".

Unlike upstream's full fp32 gate (vllm-project/vllm#47410, not in the
pinned release), the gate weight stays bf16, so the LoRA Triton kernel
dtype assert and the bf16 weight-broadcast path are unaffected. Follows
the fp32_lm_head pattern: flag flows through additional_config and the
patch self-gates at model construction. No-op when something else (e.g.
the ROCm AITER branch) already set an out_dtype.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat: default fp32 MoE routing on (trainer + inference)

Flip model.moe_router_dtype to "float32" and
inference.enable_fp32_router_logits to true by default. Routing logits
are no longer rounded to bf16 anywhere: custom-impl MoE trainers run
fp32 gate weights/GEMM, and DeepSeek-family vLLM models emit fp32
router logits. apply_fp32_moe_router is now a silent no-op for non-MoE
and HF-impl models (previously raised), since the default makes absent
custom MoE routers the common case.

Set moe_router_dtype = "bfloat16" / enable_fp32_router_logits = false
to restore the previous numerics.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: fares <fares@primeintellect.ai>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 20:16:24 -07:00
minh hoangandGitHub 8a977ecc9c chore: bump renderers for Laguna-XS-2.1 support (#2950)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
Pulls in renderers#97 (laguna-xs-2.1 renderer variant: XS-2.1's template
drops the baked-in default system message) and renderers#94 (multimodal
payload through build_training_sample). No renderers dependency changes,
so uv.lock is untouched.
2026-07-03 12:48:17 -07:00
1ab29c0587 fix(deps): refresh flash-linear-attention lock to unbreak GDN training on Hopper (#2939)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
At the locked rev (bd67d11, June 22) fla's tilelang chunk_bwd_dqkwg fails to
JIT for sm_90a (tvm InternalError: Get different layout for b_dq), and the
Triton fallback is guard-blocked on Hopper (wrong dg/db/dk, fla#640) — so any
GDN model (Qwen3.5-MoE, Qwen3-Next) crashes at the first backward on H100/H200.
Upstream fixed the kernel in fla#975 (June 29). fla is an unpinned git dep, so
this is a lock-only refresh: bd67d11 -> a954753.

Co-authored-by: fares <fares@primeintellect.ai>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 12:34:13 -07:00
5e6b641574 fix(deps): bump torchtitan to 23e4dfc to fix EP grad-clip crash with empty ep_grads (#2911)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
Bumps torchtitan one commit forward (a1fdd7e -> 23e4dfc) to pull in
pytorch/torchtitan#1541, which guards _clip_grad_norm_with_ep against
calling .full_tensor() on a plain Tensor when ep_grads is empty.

This crash surfaces when EP is enabled but no trainable parameter is
EP-sharded — e.g. LoRA targeting only non-expert modules, or PP+EP
setups where some PP ranks own no MoE layers — causing
get_total_norm([]) to return tensor(0.) (a non-DTensor) and the
subsequent .full_tensor() to raise AttributeError at step 0.

The diff between the two torchtitan commits is exactly this one fix
(torchtitan/distributed/utils.py, +6/-1); all other prime-rl imports
from torchtitan (ExpertParallel, expert_parallel, TOKEN_GROUP_ALIGN_SIZE_M,
generate_permute_indices) are unchanged.

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Matej Sirovatka <54212263+S1ro1@users.noreply.github.com>
2026-07-03 12:28:37 -07:00
16f5c7222b feat: make step numbers 1-indexed (policy versions stay 0-indexed) (#2896)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat: 1-index step counters (policy versions stay 0-indexed)

The first trainer/orchestrator step is now step 1 (was step 0). Policy
versions remain 0-indexed, with v0 the base model. Training step x consumes
batch x and produces policy version x; orchestrator step x samples that batch
from policy v(x-1).

Checkpoints/broadcasts now follow a completed-step convention: the trainer
writes the broadcast + checkpoint at the END of each step's iteration (model
= the version just produced), the loop breaks on step == max_steps, and a
checkpoint step_S means "step S finished". Resuming from step_S continues at
step S+1 (orchestrator, trainer, and per-run progress all advance one step on
load). broadcasts/step_S holds policy vS, so the watcher derives the policy
version directly from the directory label; the broadcast label is
mm.progress[idx].step - 1 because pack() has already advanced progress.

This is a pure relabeling: the number of steps, LR schedule, data, and
off-policy/async-barrier behavior are unchanged.

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

* chore: drop CHANGELOG entry for 1-indexed steps (not a config-field change)

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

* fix: align multi-run checkpoint step label with 1-indexed convention

MultiCheckpointManager.save derived its step from mm.progress[idx].step, but
pack() has already advanced that to the next step by the end-of-loop save
point — the same off-by-one the broadcast paths needed. It mislabeled the ckpt
dir step_{S+1} (vs the orchestrator's step_S), looked for the nonexistent
broadcasts/step_{S+1} when copying weights into the ckpt, and gated _should_save
on the wrong interval boundary. Subtract 1 to use the step just finished.

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

* docs: fix misleading checkpoint comment in RL trainer loop

The "skip it here / written after the loop" note applied only to the single-run
branch; move it onto that branch and clarify the multi-run branch has no
after-loop final save.

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

* docs: trim redundant async-pipeline sentence in algorithms.md

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

* fix: keep orchestrator resume step coordinated under ckpt.skip_progress

The resume increment ran on whatever progress.step held after load, but with
ckpt.skip_progress the orchestrator's CheckpointManager doesn't restore the
counter, so `+= 1` bumped the default (→ 2) while policy.version came from
resume_step — desyncing rollouts/checkpoints/dispatch-gate from the trainer and
mm.progress (both at resume_step + 1). Derive the step from resume_step so
skip_progress only resets the totals and the step stays coordinated.

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-03 10:06:58 -07:00
5c0a6dbdba chore(ci): drop uv extras that aren't required from CPU unit tests to fix disk exhaustion (#2940)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* chore(ci): drop --all-extras from CPU unit tests to fix disk exhaustion

The CPU unit-test job ran `uv sync --all-extras --locked`, pulling the
entire dependency universe (envs, flash-attn-3, disagg, quack, gpt-oss,
modelexpress) just to run `pytest tests/unit -m "not gpu"`. That ~2-3GB
of GPU kernels and env deps (spacy, rdkit, chromadb, opencv, onnxruntime,
...) overflows the runner's root disk — the last run died extracting
triton with "No space left on device (os error 28)".

No `tests/unit` test imports any of those extras: they only use base deps
(torch, transformers, vllm, verifiers.v1) plus dev (pytest). The one test
touching flash_attn skips gracefully when it's absent. Install base + dev
only.

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

* clean up comment

* fix(ci): install flash-attn extra for CPU unit tests

Dropping --all-extras entirely broke test collection: `ring_flash_attn`
(a base dep) hard-imports `flash_attn` at module load, and `flash_attn`
is provided only by the flash-attn extra. 12 model/train tests failed to
collect with `ModuleNotFoundError: No module named 'flash_attn'`.

Add back just the flash-attn extra (a prebuilt wheel on x86_64, no build).
The disk fix holds — we still skip envs/flash-attn-3/disagg/quack/etc.,
the ~2-3GB no unit test imports.

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

* fix(ci): add envs extra for CPU unit tests config loading

test_load_configs loads every config TOML; configs referencing a v1
taskset make verifiers.v1.loaders import the taskset package by name at
runtime (scaleswe_v1, math500_v1, aime24_v1, ...), which ships via the
envs extra. Static import analysis missed this, so the prior commit's
base+flash-attn install failed 15 config-loading tests.

The run proved the disk fix and the extras audit: 454 tests passed with
only flash-attn installed, and the sole failures were envs tasksets. So
install flash-attn + envs and skip the GPU-only extras (flash-attn-3,
disagg, quack, gpt-oss, modelexpress, flash-attn-cute) no unit test uses.

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

* clean up comment

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 23:25:39 -07:00
dbe95b799a feat: optional per-node uv sync for multi-node RL (#2926)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat: optional per-node uv sync for multi-node RL

Add a SlurmConfig.per_node_venv_sync flag (default False). When enabled,
the multi-node RL sbatch runs uv sync on every node via srun (one task per
node, blocking) instead of only the batch node.

This is needed when the venv is node-local (e.g. UV_PROJECT_ENVIRONMENT on
/tmp): a single batch-node sync would leave the other nodes without a venv.
The srun task re-sources .env so uv sees the node-local UV_PROJECT_ENVIRONMENT
/ UV_CACHE_DIR even if SLURM env propagation is disabled. With set -e, a failed
sync on any node aborts the job. Default keeps the original head-only behavior
for shared (NFS) venvs.

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

* feat: rename per_node_venv_sync to shared_fs, fix .env sourcing, extend to all multi-node templates

- Rename SlurmConfig.per_node_venv_sync (default False) to SlurmConfig.shared_fs
  (default True) with inverted logic, as suggested in PR review
- Fix .env sourcing in srun command to not fail when .env is absent
  (|| true guard), matching the rest of the script
- Fix comment: re-sourcing .env is needed because unexported vars don't cross
  srun even with normal SLURM env propagation, not because propagation is disabled
- Extend shared_fs to multi_node_sft.sbatch.j2 and inference.sbatch.j2
  since the flag lives in shared.py config

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 18:30:46 -07:00
07e6bec87a feat: log time/wait_for_policy for dispatch gate stalls (#2938)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat: log time/wait_for_policy for dispatch gate stalls

The dispatch gate (`dispatch_allowed`) pauses the orchestrator when it
would run more than TARGET_LAG batches ahead of the trainer's policy
version, but that pause was invisible in metrics — the only signal was
two info log lines. When the trainer is the bottleneck this stall is
exactly what we want to quantify.

Accumulate the wall-clock the gate spends closed across pause/resume
cycles and log it as `time/wait_for_policy` alongside the other
orchestrator `time/*` metrics, resetting each shipped batch.

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

* chore: drop redundant comment on wait_for_policy state

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

* feat: add time/wait_for_policy to the W&B overview performance section

Show the orchestrator's dispatch-gate wait next to time/wait_for_batch
in the curated overview view.

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 12:49:21 -07:00
9fede0ac78 feat: auto-create curated W&B overview view per project (#2933)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat: auto-create curated W&B "overview" saved view per project

Creates an idempotent "overview" saved view (train / eval / stability /
performance sections) on the first run into a W&B project, so a new project
gets a usable overview without hand-picking panels from the thousands of
logged metrics.

- New src/prime_rl/utils/monitor/workspace.py builds the view via wandb-workspaces
- WandbMonitor creates it after wandb.init (run's primary process, online only,
  best-effort so a failure never breaks training; skips if it already exists)
- Per-env train/<env> and eval/<env> sections built from the orchestrator's
  resolved env names; single train env collapses to train/<env>, multiple add
  train/agg on top
- inference/* panels use the wall-clock x-axis (they are logged against
  _timestamp); every other panel uses `step`
- Config: WandbConfig.create_overview (default True; --wandb.no-create-overview)

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

* feat: add time/wait_for_batch to overview performance section

* feat: always create overview when wandb enabled (drop create_overview config)

* chore: rename overview env-name params to train_env_names/eval_env_names

* chore: make overview metric/layout constants public

* feat: version overview on env-set change; make helpers public, inline x_for

* refactor: fold overview view code into monitor/wandb.py

* docs: note deliberate metric volume + auto-created W&B overview view

* feat: unify train/eval overview metrics (reward vs avg@), all subset only

* chore: drop perf throughput/throughput_per_gpu/peak_memory from overview

* fix: isolate per-view load in overview reuse loop so one bad view doesn't abort

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 12:39:30 -07:00
d16981b533 fix: advance progress.step before gating so dispatch lead is correct (#2937)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
`update_dispatch_gate` computed `lead = (progress.step + 1) - policy.version`
at both call sites, but `progress.step` meant different things at each: at
ship time it was still the just-shipped step (so +1 = the batch being
collected, correct), but at `on_new_version` a prior ship had already advanced
it to the collecting batch, so the +1 double-counted and overstated the lead by
one. That kept the dispatcher paused one policy version too long and could
self-sustain into a stall (a paused dispatcher can't ship the batch the trainer
needs to produce the next version).

Advance `progress.step` immediately after shipping so it always names the batch
being collected, then gate on a single `progress.step - policy.version`. The
lead is now correct at both sites and never overstated, so the gate can't
falsely stall.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 12:36:10 -07:00
b2b4f3f711 feat: bump vLLM 0.23.0 -> 0.24.0 (#2921)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat: bump vLLM 0.23.0 -> 0.24.0

Base runtime bump. Changes:
- pyproject.toml: `vllm>=0.24.0` + the x86_64/aarch64 wheel URLs to v0.24.0
  (cu129 cp38-abi3); uv.lock regenerated (vllm 0.24.0 pulls humming-kernels
  0.1.6, prometheus-fastapi-instrumentator 8.0.2, starlette 1.3.1; drops gguf).
- weight_transfer.py: 0.24 turned `FusedMoE` into a factory returning a
  `MoERunner` and split its state -- the expert map now lives on
  `MoERunner.routed_experts` (RoutedExperts) and EPLB state on
  `MoERunner.router`. `isinstance(module, FusedMoE)` would raise TypeError.
  Rewrote `build_expert_map`/`_build_expert_source_indices` to match
  `MoERunner` and read both submodules. Keying by the MoERunner name still
  prefix-matches the nested `routed_experts.*` params in load_weights_kernel.
  (Only reached on the quantize_in_weight_transfer=True path.)
- patches.py: verified all 7 monkeypatches still apply on 0.24; only a docstring
  version ref updated (is_3d_moe_weight still defaults True in 0.24).

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

* fix(inference): rebase monkey_patch_no_moe_lora onto vLLM 0.24 __post_init__

0.24 made FusedMoEConfig.intermediate_size the ctor field and
intermediate_size_per_partition a -1 sentinel that __post_init__ must compute.
The patch replaced __post_init__ with a verbatim-0.23 copy that never set it,
leaving intermediate_size_per_partition=-1 (silent corruption of every
downstream consumer) and dropping the % tp_size assert + aiter/mori/platform
guards. Mirror 0.24's body verbatim, then flip is_lora_enabled off.

Found in a second-pass audit of all 16 active monkeypatches (registered across
patches.py, orchestrator.py, server.py, worker/__init__.py); the rest KEEP.

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

* refactor(inference): drop 2 LoRA reload monkeypatches for vLLM 0.24 native load_inplace

0.24's native OpenAIServingModels.load_lora_adapter reuses the existing
lora_int_id on a same-name reload and repoints the path, and its worker
LRUCacheWorkerLoRAManager.add_adapter force-reloads when lora_request.load_inplace
is True -- exactly what monkey_patch_load_lora_adapter and
monkey_patch_LRUCacheWorkerLoRAManager reimplemented by copying upstream bodies.

Replace both with the native path plus a small mechanism in prime-rl's
/load_lora_adapter endpoint:
- set load_inplace=True on the incoming request so 0.24 doesn't reject the
  same-name reload and the worker re-reads the new weights during add_lora;
- reset the *stored* LoRARequest's load_inplace back to False afterward, because
  it is a sticky field that _maybe_get_adapters hands to every generation request
  -- left True it would force a per-scheduler-step disk reload (the perf trap the
  old _apply_adapters(force_load=False) override avoided).

The orchestrator awaits this endpoint before dispatching rollouts for the new
policy version, so the reset lands before any generation resolves the adapter.

Also refresh stale "vLLM 0.23.0" version refs in comments to 0.24.0 where the
described behavior was re-verified against the 0.24 source (minimax gate dtype,
V2-runner routing rationale, NemotronH layerwise-reload shim -- the latter's
counting path is byte-identical in 0.24, so the shim stays needed).

Requires a live LoRA weight-sync run to validate before merge: confirm the
adapter picks up fresh weights each step AND that there is no per-step reload
regression.

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

* style: ruff format (unwrap lines within 120-col limit)

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

* refactor(inference): simplify monkey_patch_no_moe_lora to wrap upstream __post_init__

The previous version copied vLLM 0.24's FusedMoEConfig.__post_init__ body
verbatim (intermediate_size_per_partition compute, ROCm/aiter/mori guards,
platform checks) just to append `is_lora_enabled = False` -- carrying a
drift-prone "keep in sync with upstream" burden plus _aiter_ops/current_platform
imports.

`is_lora_enabled` is never read inside __post_init__ (only later during kernel
selection in modular_kernel.py / oracle/unquantized.py), so flipping it after
the original runs is equivalent. Wrap the original instead: it computes
intermediate_size_per_partition and runs every guard itself, so nothing can
drift and the -1 sentinel can never leak.

Verified against the 0.24 wheel: with tp_size=2, intermediate_size_per_partition
= 128 and is_lora_enabled = False.

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

* fix(inference): reset load_inplace unconditionally in /load_lora_adapter

Previously the sticky-flag reset ran only on success, so an ErrorResponse
returned before resetting. Not triggerable on vLLM 0.24 (native load_lora_adapter
stores the adapter only after add_lora succeeds, and builds a fresh request rather
than mutating the stored one), but the correctness relied on that vLLM-internal
invariant. Reset whatever is stored for the name regardless of outcome so a
lingering load_inplace=True can never force a per-scheduler-step disk reload,
independent of vLLM internals.

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

* fix(inference): remap flat MoE kernel wire names to vLLM 0.24 routed_experts params

vLLM 0.24 nests FusedMoE expert weights under MoERunner.routed_experts
(...experts.routed_experts.w13_weight), while the trainer's
convert_layer_to_vllm_kernel still emits the pre-0.24 flat names
(...experts.w13_weight). load_weights_kernel's 'name not in params' gate
fired before the expert-map prefix match, so the first fp8 kernel weight
update raised 'Kernel weight transfer skipped N weights not found in
model'. Wrap the incoming stream with upstream's remap_moe_expert_weights,
the compat shim vLLM ships for exactly this transition (covers w13/w2
weights and their _scale_inv variants; leaves gate/shared_experts names
untouched).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore(inference): drop NemotronH mixer.D reload shim, fixed upstream in 0.24

vllm-project/vllm#44814 did land in the pinned 0.24.0 release - in
reload/meta.py, which caps copied_numel at param.numel() to fix the
composed_weight_loader double-count that finalized layers early and
dropped Mamba mixer.D. The earlier audit diffed mamba_mixer2.py and
reload/layerwise.py (byte-identical) and missed it. The capture/restore
shim is now dead weight on every non-quantized weight update; remove it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(inference): LoRA/MoE patch hygiene for vLLM 0.24

- Drop monkey_patch_skip_lora_module_warnings: the per-module regex
  warning loop it skipped was removed upstream before 0.23, so it was a
  pure drift-carrier - its _load_adapter copy silently dropped 0.24's
  moe_ep_spec= passthrough (EP read-time expert filtering) and the
  lora.is_3d_lora_weight stamp (needed for enable_mixed_moe_lora_format).
  Stock _load_adapter now runs in workers.
- Re-derive _patch_lora_key_prefix's from_local_checkpoint copy from the
  0.24 original so the stock caller's moe_ep_spec= kwarg is accepted;
  keeps only the real payload (accept bare-suffix OR qualified expert
  module names) and picks up the EP remote-expert pruning + tensorizer
  hardening. Docstring rewritten: vllm#38522 was closed unmerged and the
  base_model.model. prefix case is handled upstream.
- Drop the MiniMax M2 forward patch: the MoERunner already all-reduces
  internally (_maybe_reduce_final_output), so the patched forward's extra
  tensor_model_parallel_all_reduce doubled the MoE output at TP>1.
  Upstream's forward needs no changes; the gate rebuild + hf_to_vllm
  mapper stay.
- Remove the dead transformers-v5 tie_word_embeddings shim (class attr
  exists on the pinned transformers, guard never fired) and refresh stale
  comments: DP coordinator upstream timeout is 120s not 30s; 0.24 routes
  MoE archs (DeepseekV2/Qwen2Moe/GraniteMoe) to the V2 runner by default
  too, making the forced V1 more load-bearing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore(inference): rename transformers_v5_compat to apply_shared_vllm_patches

The function is the vllm.general_plugins entry point dispatching the six
patches that must run in every vLLM process; the transformers-v5 shim it
was named for was removed. Entry-point target updated in pyproject.toml
(vLLM swallows plugin load failures, so a stale target would silently
skip all patches - uv run re-syncs metadata automatically).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(inference): restore 0.23 parser semantics + guard new 0.24 request validation

vLLM 0.24 behavior changes outside this branch's original diff surface:

- qwen3_coder (parser engine) now full-strips every tool parameter value where
  0.23 trimmed exactly one leading/trailing newline, corrupting
  whitespace-significant args (str_replace old_str/new_str, indented file
  content). Restore single-newline trim via monkey_patch_qwen3_coder_param_newline_trim
  (also covers nemotron_v3, which reuses qwen3_config).
- minimax_m2's engine swallows the literal </think> in CONTENT state and strips
  content on tool turns, breaking minimax_m2_append_think round-tripping. Drop
  the (CONTENT, THINK_END) transition and disable the strip.
- VLLM_ENFORCE_STRICT_TOOL_CALLING default flipped to True in 0.24: structural-tag
  constrained decoding for required/named/strict tools would sample a distribution
  the trainer never sees. Default it off in setup_vllm_env.
- 0.24 rejects temperature > 2.0 at request validation; mirror the bound in
  TrainSamplingConfig/EvalSamplingConfig so misconfigured sweeps fail at config
  load, not per-rollout with HTTP 400s.
- Fix stale 30s -> 120s DP-coordinator timeout comment.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test(inference): cover plugin entry-point load, MoE kernel remap, MoE mismatch KL

CI could not see three load-bearing paths of the 0.24 bump:

- vLLM swallows vllm.general_plugins load failures, so a stale/misnamed entry
  point (renamed on this branch) silently drops every shared patch; load it
  exactly like vLLM does and assert the padded-input scrub applied.
- The MoERunner weight-sync rewrite (flat trainer names -> nested
  routed_experts params via remap_moe_expert_weights, expert-map prefix
  slicing) is only reachable via NCCL broadcast, which no CI config uses;
  exercise load_weights_kernel directly on a fake module tree.
- reverse_text_moe asserted exit code only; add a trainer/inference mismatch-KL
  bound so silent MoE weight corruption fails the job.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: address review — drop test additions and comment flourishes

Per review: remove the plugin entry-point test, the weight-transfer kernel
unit tests, and the reverse_text_moe mismatch-KL addition; trim the vLLM-0.24
references from the temperature docstrings (the le=2.0 bound stays).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: faresobeid <111092724+faresobeid@users.noreply.github.com>
Co-authored-by: hallerite <git@hallerite.com>
Co-authored-by: fares <fares@primeintellect.ai>
2026-07-02 20:25:56 +01:00
50aeb3c7d6 chore(deps): bump research-environments + wire s1-deepresearch-v1/arxivmath-v1 (#2934)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* chore(deps): add s1-deepresearch-v1 + arxivmath-v1 environments to pyproject.toml + uv.lock

Bumps the research-environments pin to pick up the two new
bring-your-own-search v1 tasksets:

- s1-deepresearch-v1: ScienceOne-AI/S1-DeepResearch-15k closed-ended
  deep-research QA (6000 verifiable tasks, en/zh filter), binary semantic
  LLM judge.
- arxivmath-v1: MathArena/arxivmath-training research-level math
  (2605 tasks), in-runtime math-verify scoring of the boxed answer.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore(deps): bump research-environments for trace.last_reply scoring fix

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore(deps): bump research-environments to merge with upstream main

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore(deps): relock for research-environments verifiers pin bumps

The submodule merge brought main's env pyproject updates (verifiers pins
unified to >=0.1.15.dev411), which uv.lock records as requires-dist metadata.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore(deps): bump research-environments to merged main (s1-deepresearch/arxivmath #630)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: fares <fares@primeintellect.ai>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 20:24:16 +01:00
45 changed files with 1006 additions and 698 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ jobs:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install dependencies
run: uv sync --all-extras --locked
run: uv sync --extra flash-attn --extra envs --locked
- name: Run tests
env:
USERNAME_CI: CI_RUNNER
+1
View File
@@ -2,6 +2,7 @@
Documenting **breaking** configuration changes — renamed, removed, or moved fields that require users to update existing configs.
- **fp32 MoE routing enabled by default**: `trainer.model.moe_router_dtype` (new field) defaults to `"float32"` — custom-impl MoE router gates keep fp32 weights through forward/backward (exempt from the FSDP bf16 cast) and compute the gate GEMM and routing logits in fp32. `inference.enable_fp32_router_logits` (new field) defaults to `true` — DeepSeek-family models served by vLLM (incl. GLM-5.x) emit fp32 router logits via `out_dtype=float32` on the gate. Both change MoE numerics for existing runs (routing logits are no longer rounded to bf16; near-tie expert selections can differ). Set `moe_router_dtype = "bfloat16"` / `enable_fp32_router_logits = false` to restore the previous behavior. Non-MoE and HF-impl models are unaffected. (2026-07-04)
- **`[[orchestrator.train.env]].ratio` now defaults to `1` and no longer accepts unset/`None`**: Each train env's sampling weight defaults to `1` (equal weight per env) instead of `None`. The `None`-for-all-envs mode — which sampled proportional to each env's dataset size (the "natural task distribution") — is removed, along with the all-or-none constraint (any subset of envs may now set `ratio`; the rest default to `1`). Multi-env configs that relied on the old default now sample each env equally rather than proportional to dataset size; set each env's `ratio` explicitly to restore a proportional (or any other) mix. (2026-07-02)
- **`orchestrator.algo.length_penalty` restructured to a single `linear` shape; `tokens`/`turns` length penalties removed**: The `grpo`-family length penalty keeps the `[orchestrator.algo.length_penalty]` key but is collapsed to a single `type = "linear"` shape; the discriminated `type = "tokens" | "turns"` efficiency-shaping variants (and the `efficiency_shaping` helper) are removed. The linear penalty subtracts a `pass_rate`-scaled penalty from each reward before the GRPO baseline, summing three terms — `num_output_tokens_weight` × output tokens, `num_input_tokens_weight` × input (non-output) tokens, and `num_turns_weight` × turns — each normalized by the group's own max for that quantity. Field renames within the penalty: `coef` → `num_output_tokens_weight` (default `0.25`), `context_coef` → `num_input_tokens_weight` (default `0.1`), `turns_coef` → `num_turns_weight` (default `0.1`); the `gate_by_correctness` flag is removed. `extra="forbid"` rejects the old keys, so existing configs must migrate. (2026-06-29)
- **`model.fused_lm_head_token_chunk_size` `"auto"` option removed**: The `"auto"` value is no longer accepted. Use an explicit integer (e.g. `8192`) or `"disabled"`. The `"auto"` value previously resolved to `8192` for RL training — set `fused_lm_head_token_chunk_size = 8192` explicitly to get the same behavior.
+3 -3
View File
@@ -1,4 +1,4 @@
# GLM-5.2-FP8 16-node P/D, FULL STACK: mooncake + llm-d router, vLLM 0.23.
# GLM-5.2-FP8 16-node P/D, FULL STACK: mooncake + llm-d router, vLLM 0.24.
# Step 3 / goal target. Topology mirrors the proven original glm5.1_llmd_inference
# (job 348 succeeded): 8 prefill nodes (4 replicas x 2) + 8 decode nodes (1 replica).
#
@@ -31,9 +31,9 @@ num_bytes = 1_000_000_000_000
[deployment]
type = "disaggregated"
num_prefill_nodes = 8
prefill_nodes_per_replica = 2
num_prefill_replicas = 4
num_decode_nodes = 8
decode_nodes_per_replica = 8
num_decode_replicas = 1
prefill_env_vars = {"VLLM_ENABLE_MOE_DP_CHUNK"="0", "VLLM_DEEP_GEMM_WARMUP"="skip", "UCX_RCACHE_MAX_UNRELEASED"="1024"}
decode_env_vars = {"VLLM_DEEP_GEMM_WARMUP"="skip", "UCX_RCACHE_MAX_UNRELEASED"="1024"}
+2 -2
View File
@@ -10,8 +10,8 @@ reasoning_parser = "glm45"
[deployment]
type = "disaggregated"
num_prefill_nodes = 4
num_decode_nodes = 2
prefill_nodes_per_replica = 4
decode_nodes_per_replica = 2
gpus_per_node = 8
[slurm]
+1 -1
+1 -1
+1 -1
View File
@@ -157,7 +157,7 @@ At step $n = 1, 2, 3, \dots$:
- **Trainer** produces policy $\pi_n$ with weights $\theta_n$ from rollouts $(x_n, y_n)$.
- **Inference** produces rollouts $(x_n, y_n)$ from policy $\pi_{\max(0,\,n-1)}$.
Step indices are 0-indexed so the gap holds at startup — inference is exactly one step behind the trainer.
Step indices are 1-indexed; policy versions are 0-indexed, with $\pi_0$ the base model. At step 1 inference samples from $\pi_0$.
## Loss
+9 -11
View File
@@ -128,41 +128,39 @@ This configuration will run 2 vLLM processes, each with `data_parallel_size_loca
This is the most advanced deployment shape. It allows you to disaggregate the prefill and decode stages, with KV cache flowing between them. This is useful for large scale deployments, where there are high requirements on latency, such as agentic workflows spanning 100s of turns.
This deployment shape is defined by setting `inference.deployment.type = "disaggregated"` and `inference.deployment.num_prefill_nodes` and `inference.deployment.num_decode_nodes` to the number of nodes you want to run the prefill and decode stages on.
This deployment shape is defined by setting `inference.deployment.type = "disaggregated"` and choosing how many nodes each prefill and decode replica spans.
```toml
[inference.deployment]
type = "disaggregated"
num_prefill_nodes = 2
num_decode_nodes = 2
prefill_nodes_per_replica = 2
decode_nodes_per_replica = 2
```
Sometimes, you may want to run multiple independent vLLM instances within the prefill and decode node groups. You can do this by setting `inference.deployment.num_prefill_replicas` and `inference.deployment.num_decode_replicas` to the number of replicas you want to run.
Sometimes, you may want to run multiple independent vLLM instances within the prefill and decode stages. You can do this by setting `inference.deployment.num_prefill_replicas` and `inference.deployment.num_decode_replicas` to the number of role replicas you want to run.
```toml
[inference.deployment]
type = "disaggregated"
num_prefill_nodes = 2
num_decode_nodes = 2
prefill_nodes_per_replica = 2
num_prefill_replicas = 2
decode_nodes_per_replica = 2
num_decode_replicas = 1
```
Now the total deployment will span 6 nodes - 2x2 for prefill and 1x2 for decode. 2 prefill replicas will run on 2 nodes each - total of 4 nodes for prefill. 1 decode replica will run on 2 nodes for decode.
Now each prefill replica spans 2 nodes and each decode replica spans 2 nodes. With 2 prefill replicas and 1 decode replica, one inference island spans 6 nodes.
We also allow you to configure the total amount of inference replicas - this is useful if you'd like to multiply the above configuration by a factor of `k`, each running behind a separate `vllm-router` instance.
For RL runs, the top-level deployment can multiply that whole inference island by setting `deployment.num_infer_replicas`. `deployment.num_infer_nodes` is inferred from the nested inference deployment when you omit it.
```toml
[deployment] # this is a top-level RL deployment, not inference.deployment!!
type = "multi_node"
num_train_nodes = 4
num_infer_nodes = 6 # this is per-replica
num_infer_replicas = 3
```
This will run 3 inference replicas, each running on 6 nodes. Each replica will run on 2x2 nodes for prefill and 1x2 nodes for decode. The total deployment will span 18 nodes. This will also spin-up 3 separate `vllm-router` instances.
This will run 3 inference islands, each running on 6 nodes. The total inference deployment will span 18 nodes and start 3 separate router instances.
## Router
+1 -1
View File
@@ -208,7 +208,7 @@ uv run rl @ base_rl.toml @ my_slurm.toml --dry-run # writes the sbatch script
[deployment]
type = "multi_node"
num_train_nodes = 2
num_infer_nodes = 1
num_infer_nodes = 1 # optional when inference.deployment defines the node topology
gpus_per_node = 8 # default
nodes_per_fsdp_group = 1 # optional — controls FSDP island size
```
+3 -1
View File
@@ -226,7 +226,7 @@ uv run rl @ rl.toml --ckpt.interval 25 --ckpt.keep-interval 100 # …plus perma
Re-run the same launch command and pass `--ckpt.resume-step <N>` (or `-1` for "latest"). Make sure `--max-steps` is at least the target final step, not the remaining delta:
```bash
# First run: steps 0–10
# First run: steps 1–10
uv run rl @ rl.toml --max-steps 10 --ckpt
# Resume: continue to step 20
@@ -307,6 +307,8 @@ uv run rl @ rl.toml --wandb \
--no-trainer.wandb.log-extras.distributions
```
prime-rl deliberately logs a **large number of metrics** for maximum observability: every rollout metric is emitted per subset (`all`/`effective`), per statistic (`mean`/`max`/`min`/`p10`/`p90`), and per environment alongside a cross-env aggregate, so a multi-env run can emit thousands of series. To keep that navigable, W&B mode **auto-creates an `overview` saved view** on the first run into a project — curating the handful of metrics that matter into `train`, `eval`, `stability`, and `performance` sections (with per-env breakdowns). The view is created once per project and adapts to the run's environments; if a later run uses a different set of environments, a new versioned view (`overview-v2`, …) is created instead of overwriting the first.
### Platform Monitoring
Register a run on the Prime Intellect platform (Prime Lab) and stream training metrics, samples, and distributions to the platform dashboard. Bare flag uses defaults:
@@ -274,25 +274,22 @@ class MultiNodeInferenceDeploymentConfig(BaseInferenceDeploymentConfig):
# Disaggregated prefill/decode inference. Each replica is split into separate
# prefill and decode node groups. Requires NIXL for KV transfer and a vllm-router
# for request routing. Multi-replica: set ``num_prefill_replicas`` /
# ``num_decode_replicas`` to run multiple independent vLLM instances within the
# prefill / decode node groups. E.g. ``num_prefill_nodes=4, num_prefill_replicas=2``
# creates two prefill vLLM instances each spanning 2 nodes (EP16 with 8 GPUs/node).
# prefill and decode node groups. Requires NIXL for KV transfer and a router for
# request routing.
class DisaggregatedInferenceDeploymentConfig(BaseInferenceDeploymentConfig):
type: Literal["disaggregated"] = "disaggregated"
num_prefill_nodes: int = Field(1, ge=1)
"""Total prefill nodes."""
prefill_nodes_per_replica: int = Field(1, ge=1)
"""Nodes in each prefill vLLM instance."""
num_decode_nodes: int = Field(1, ge=1)
"""Total decode nodes."""
decode_nodes_per_replica: int = Field(1, ge=1)
"""Nodes in each decode vLLM instance."""
num_prefill_replicas: int = Field(1, ge=1)
"""Independent prefill vLLM instances. Must evenly divide ``num_prefill_nodes``."""
"""Independent prefill vLLM instances."""
num_decode_replicas: int = Field(1, ge=1)
"""Independent decode vLLM instances. Must evenly divide ``num_decode_nodes``."""
"""Independent decode vLLM instances."""
prefill_port: int = 8100
"""Port for prefill vLLM instances."""
@@ -312,23 +309,43 @@ class DisaggregatedInferenceDeploymentConfig(BaseInferenceDeploymentConfig):
decode_vllm_overrides: dict[str, Any] = {}
"""Extra vLLM config options merged into --vllm-extra only for decode ranks (SLURM only)."""
@property
def num_prefill_nodes(self) -> int:
return self.prefill_nodes_per_replica * self.num_prefill_replicas
@property
def num_decode_nodes(self) -> int:
return self.decode_nodes_per_replica * self.num_decode_replicas
@property
def num_nodes(self) -> int:
return self.num_prefill_nodes + self.num_decode_nodes
@model_validator(mode="after")
def validate_replicas_divide_nodes(self):
if self.num_prefill_nodes % self.num_prefill_replicas != 0:
raise ValueError(
f"num_prefill_replicas ({self.num_prefill_replicas}) must evenly divide "
f"num_prefill_nodes ({self.num_prefill_nodes})"
)
if self.num_decode_nodes % self.num_decode_replicas != 0:
raise ValueError(
f"num_decode_replicas ({self.num_decode_replicas}) must evenly divide "
f"num_decode_nodes ({self.num_decode_nodes})"
)
return self
@model_validator(mode="before")
@classmethod
def normalize_node_counts(cls, data: Any) -> Any:
if not isinstance(data, dict):
return data
data = dict(data)
def normalize_total_nodes(total_key: str, per_replica_key: str, replicas_key: str) -> None:
has_total = total_key in data
has_per_replica = per_replica_key in data
if has_total and has_per_replica:
raise ValueError(f"Set only {per_replica_key}; {total_key} is derived from it.")
if not has_total:
return
total_nodes = int(data.pop(total_key))
replicas = int(data.get(replicas_key, 1))
if total_nodes % replicas != 0:
raise ValueError(f"{total_key} ({total_nodes}) must be divisible by {replicas_key} ({replicas}).")
data[per_replica_key] = total_nodes // replicas
normalize_total_nodes("num_prefill_nodes", "prefill_nodes_per_replica", "num_prefill_replicas")
normalize_total_nodes("num_decode_nodes", "decode_nodes_per_replica", "num_decode_replicas")
return data
InferenceDeploymentConfig: TypeAlias = Annotated[
@@ -416,6 +433,9 @@ class InferenceConfig(BaseConfig):
enable_fp32_lm_head: bool = True
"""Run the lm_head projection in fp32 via a native bf16×bf16 → fp32 GEMM (``torch.mm`` with ``out_dtype=torch.float32``). Stabilizes logprob precision under FP8/bf16 inference, matching SGLang's ``--enable-fp32-lm-head``. Implemented as a monkey-patch over vLLM's LogitsProcessor, activated by setting ``additional_config["fp32_lm_head"] = True`` on the vLLM config."""
enable_fp32_router_logits: bool = True
"""Emit fp32 MoE router logits for DeepSeek-family models (incl. GLM-5.x) by setting ``out_dtype=float32`` on the gate: the bf16×bf16 gate GEMM writes its fp32 accumulator out unrounded instead of truncating logits to bf16 before expert scoring. Matches fp32-routed checkpoints (e.g. GLM-5.x, trained with Megatron ``--moe-router-dtype fp32``); pairs with ``trainer.model.moe_router_dtype = "float32"``. Implemented as a monkey-patch over vLLM's DeepseekV2MoE, activated by setting ``additional_config["fp32_router_logits"] = True`` on the vLLM config."""
vllm_extra: dict[str, Any] = {}
"""Extra arguments forwarded to vLLM. Applied as attributes on the vLLM namespace after config translation."""
@@ -608,6 +628,10 @@ class InferenceConfig(BaseConfig):
existing = getattr(namespace, "additional_config", None) or {}
existing["fp32_lm_head"] = True
rsetattr(namespace, "additional_config", existing)
if self.enable_fp32_router_logits:
existing = getattr(namespace, "additional_config", None) or {}
existing["fp32_router_logits"] = True
rsetattr(namespace, "additional_config", existing)
# Remove chat_template if not set (vLLM doesn't accept None)
if namespace.chat_template is None:
@@ -50,7 +50,7 @@ class ModelConfig(BaseModelConfig):
class TrainSamplingConfig(BaseConfig):
temperature: float = Field(1.0, ge=0)
temperature: float = Field(1.0, ge=0, le=2.0)
"""Sampling temperature."""
max_completion_tokens: int | None = Field(
@@ -92,7 +92,7 @@ class TrainSamplingConfig(BaseConfig):
class EvalSamplingConfig(BaseConfig):
temperature: float | None = Field(None, ge=0)
temperature: float | None = Field(None, ge=0, le=2.0)
"""Sampling temperature. None defers to the inference server default."""
top_p: float | None = None
@@ -155,8 +155,8 @@ class MultiNodeDeploymentConfig(BaseDeploymentConfig):
num_train_nodes: int
"""Training nodes."""
num_infer_nodes: int = Field(ge=0)
"""Inference nodes per replica. Set to 0 to skip inference and orchestrator (requires fake data)."""
num_infer_nodes: int | None = Field(None, ge=0)
"""Inference nodes per replica. If unset, inferred from ``inference.deployment``. Set to 0 to skip inference and orchestrator (requires fake data)."""
num_infer_replicas: int = Field(1, ge=1)
"""Independent inference replicas. Total inference nodes = ``num_infer_nodes * num_infer_replicas``."""
@@ -167,9 +167,13 @@ class MultiNodeDeploymentConfig(BaseDeploymentConfig):
orchestrator_on_inference: bool = False
"""Run the orchestrator on the last inference node instead of trainer rank 0 (frees host RAM on the trainer node)."""
@property
def infer_nodes_per_replica(self) -> int:
return self.num_infer_nodes or 0
@property
def total_infer_nodes(self) -> int:
return self.num_infer_nodes * self.num_infer_replicas
return self.infer_nodes_per_replica * self.num_infer_replicas
DeploymentConfig: TypeAlias = Annotated[
@@ -232,19 +236,47 @@ class RLConfig(BaseConfig):
### Validate configs (e.g. raise for unsupported (combinations of) configs)
@model_validator(mode="after")
def auto_setup_infer_nodes(self):
if self.deployment.type != "multi_node":
return self
if self.inference is None:
inferred_nodes = 0
elif self.inference.deployment.type == "multi_node":
inferred_nodes = self.inference.deployment.num_nodes
elif self.inference.deployment.type == "disaggregated":
inferred_nodes = self.inference.deployment.num_nodes
else:
inferred_nodes = 1
if self.deployment.num_infer_nodes is None:
self.deployment.num_infer_nodes = inferred_nodes
elif (
self.inference is not None
and self.inference.deployment.type == "multi_node"
and self.deployment.num_infer_nodes != inferred_nodes
):
raise ValueError(
f"deployment.num_infer_nodes ({self.deployment.num_infer_nodes}) must equal "
f"inference.deployment.num_nodes ({inferred_nodes}) for multi-node inference."
)
return self
@model_validator(mode="after")
def validate_deployment(self):
if self.deployment.type == "multi_node":
if self.slurm is None:
raise ValueError("Must use SLURM for multi-node deployment.")
if self.deployment.num_infer_nodes > 0 and not self.inference:
num_infer_nodes = self.deployment.infer_nodes_per_replica
if num_infer_nodes > 0 and not self.inference:
raise ValueError("Must configure inference when using multi-node deployment with inference nodes.")
if self.deployment.num_infer_nodes == 0 and self.inference:
if num_infer_nodes == 0 and self.inference:
raise ValueError(
"Cannot configure inference with num_infer_nodes = 0. "
"Either set num_infer_nodes > 0 or remove the inference config."
)
if self.deployment.num_infer_nodes == 0 and not self.trainer.data.fake and not self.bench:
if num_infer_nodes == 0 and not self.trainer.data.fake and not self.bench:
raise ValueError(
"Must use fake data (trainer.data.fake or bench = true) when num_infer_nodes = 0, "
"since no orchestrator or inference server will be running."
@@ -531,7 +563,7 @@ class RLConfig(BaseConfig):
)
inferred_dp_local = self.deployment.gpus_per_node // inference_tp
total_infer_gpus = self.deployment.num_infer_nodes * self.deployment.gpus_per_node
total_infer_gpus = self.deployment.infer_nodes_per_replica * self.deployment.gpus_per_node
expected_global_world_size = self.inference.parallel.dp * inference_tp
if expected_global_world_size != total_infer_gpus:
raise ValueError(
@@ -593,12 +625,11 @@ class RLConfig(BaseConfig):
return self
infer_deploy = self.inference.deployment
expected_infer_nodes = infer_deploy.num_prefill_nodes + infer_deploy.num_decode_nodes
if self.deployment.num_infer_nodes != expected_infer_nodes:
expected_infer_nodes = infer_deploy.num_nodes
if self.deployment.infer_nodes_per_replica != expected_infer_nodes:
raise ValueError(
f"deployment.num_infer_nodes ({self.deployment.num_infer_nodes}) must equal "
f"inference.deployment.num_prefill_nodes ({infer_deploy.num_prefill_nodes}) + "
f"inference.deployment.num_decode_nodes ({infer_deploy.num_decode_nodes}) = {expected_infer_nodes}"
f"deployment.num_infer_nodes ({self.deployment.num_infer_nodes}) must equal the derived "
f"disaggregated inference nodes per replica ({expected_infer_nodes})."
)
total_infer_gpus = self.deployment.total_infer_nodes * self.deployment.gpus_per_node
@@ -58,6 +58,9 @@ class SlurmConfig(BaseConfig):
cleanup_grace_period: int = Field(3600, ge=0)
"""Seconds to wait before tearing down a multi-node RL job that hit a non-zero exit, letting in-flight checkpoints flush. Set to 0 to tear down immediately."""
shared_fs: bool = True
"""Whether the project filesystem (including the venv) is shared across nodes (e.g. NFS). When True, a single ``uv sync`` on the batch node suffices. Set to False when the venv is node-local (e.g. ``UV_PROJECT_ENVIRONMENT`` on ``/tmp``) so ``uv sync`` runs on every node via srun."""
@property
def template_vars(self) -> dict:
"""Common template variables for all SLURM templates."""
@@ -71,6 +74,7 @@ class SlurmConfig(BaseConfig):
"time": self.time,
"pre_run_command": self.pre_run_command,
"cleanup_grace_period": self.cleanup_grace_period,
"shared_fs": self.shared_fs,
}
@model_validator(mode="after")
@@ -171,6 +171,9 @@ class ModelConfig(BaseModelConfig):
reduce_dtype: Literal["bfloat16", "float32"] = "float32"
"""dtype for gradient/parameter reductions."""
moe_router_dtype: Literal["bfloat16", "float32"] = "float32"
"""Compute dtype for MoE router gates. ``float32`` (default) keeps router gate weights in fp32 through forward and backward (exempt from FSDP bf16 parameter casting) and computes the gate GEMM and routing logits in fp32, matching models trained with fp32 routing (e.g. GLM-5.x via Megatron's ``--moe-router-dtype fp32``). ``bfloat16`` computes the gate GEMM in the model compute dtype. Router score functions (sigmoid/softmax) run in fp32 regardless. Only affects the custom MoE implementation; a no-op for non-MoE and HF-impl models."""
moe_use_grouped_mm: bool = True
"""Use grouped mm for MoE layers. Requires compute capability ≥ 9.0."""
+15 -14
View File
@@ -19,9 +19,10 @@ dependencies = [
"torchaudio",
"torchdata>=0.11.0",
"transformers==5.6.2",
"vllm>=0.23.0",
"vllm>=0.24.0",
"mooncake-transfer-engine>=0.3.10.post2",
"wandb>=0.26.1",
"wandb-workspaces>=0.4.3",
"ring-flash-attn>=0.1.8",
"prime>=0.6.4",
"pyzmq>=27.1.0",
@@ -54,7 +55,7 @@ orchestrator = "prime_rl.entrypoints.orchestrator:main"
env-server = "prime_rl.orchestrator.env_server.env_server:main"
[project.entry-points."vllm.general_plugins"]
prime_rl = "prime_rl.inference.patches:transformers_v5_compat"
prime_rl = "prime_rl.inference.patches:apply_shared_vllm_patches"
[project.optional-dependencies]
flash-attn = [
@@ -72,13 +73,13 @@ envs = [
"alphabet-sort",
"alphabet-sort-v1",
"apex-shortlist-v1",
"arxivmath-v1",
"browsecomp-v1",
"code-golf-v1",
"color-codeword-v1",
"deepdive-v1",
"deepwiki-v1",
"forth-lang-v1",
"general-agent",
"general-agent-v1",
"glossary-v1",
"gpqa-v1",
@@ -112,7 +113,7 @@ envs = [
"redsearcher-v1",
"reverse-text",
"reverse-text-v1",
"rlm-search",
"s1-deepresearch-v1",
"scaleswe-v1",
"simpleqa-v1",
"simpleqa-verified-v1",
@@ -245,13 +246,13 @@ aime26-v1 = { path = "deps/research-environments/environments/aime26_v1", editab
alphabet-sort = { path = "deps/verifiers/environments/alphabet_sort", editable = true }
alphabet-sort-v1 = { path = "deps/verifiers/environments/alphabet_sort_v1", editable = true }
apex-shortlist-v1 = { path = "deps/research-environments/environments/apex_shortlist_v1", editable = true }
arxivmath-v1 = { path = "deps/research-environments/environments/arxivmath_v1", editable = true }
browsecomp-v1 = { path = "deps/research-environments/environments/browsecomp_v1", editable = true }
code-golf-v1 = { path = "deps/verifiers/environments/code_golf_v1", editable = true }
color-codeword-v1 = { path = "deps/verifiers/environments/color_codeword_v1", editable = true }
deepdive-v1 = { path = "deps/research-environments/environments/deepdive_v1", editable = true }
deepwiki-v1 = { path = "deps/verifiers/environments/deepwiki_v1", editable = true }
forth-lang-v1 = { path = "deps/research-environments/environments/forth_lang_v1", editable = true }
general-agent = { path = "deps/research-environments/environments/general_agent", editable = true }
general-agent-v1 = { path = "deps/research-environments/environments/general_agent_v1", editable = true }
glossary-v1 = { path = "deps/verifiers/environments/glossary_v1", editable = true }
gpqa-v1 = { path = "deps/research-environments/environments/gpqa_v1", editable = true }
@@ -281,17 +282,17 @@ openthoughts-tblite-v1 = { path = "deps/research-environments/environments/opent
papersearchqa-v1 = { path = "deps/research-environments/environments/papersearchqa_v1", editable = true }
patterned-needle-in-haystack-v1 = { path = "deps/research-environments/environments/patterned_needle_in_haystack_v1", editable = true }
prolog-v1 = { path = "deps/research-environments/environments/prolog_v1", editable = true }
r2e-gym-v1 = { path = "deps/research-environments/environments/r2e_gym_v1", editable = true }
r2e-gym-v1 = { path = "deps/research-environments/environments/swe/r2e_gym_v1", editable = true }
redsearcher-v1 = { path = "deps/research-environments/environments/redsearcher_v1", editable = true }
reverse-text = { path = "deps/verifiers/environments/reverse_text", editable = true }
reverse-text-v1 = { path = "deps/verifiers/environments/reverse_text_v1", editable = true }
rlm-search = { path = "deps/research-environments/environments/rlm_search", editable = true }
scaleswe-v1 = { path = "deps/research-environments/environments/scaleswe_v1", editable = true }
s1-deepresearch-v1 = { path = "deps/research-environments/environments/s1_deepresearch_v1", editable = true }
scaleswe-v1 = { path = "deps/research-environments/environments/swe/scaleswe_v1", editable = true }
simpleqa-v1 = { path = "deps/research-environments/environments/simpleqa_v1", editable = true }
simpleqa-verified-v1 = { path = "deps/research-environments/environments/simpleqa_verified_v1", editable = true }
swebench-pro-v1 = { path = "deps/research-environments/environments/swebench_pro_v1", editable = true }
swebench-verified-v1 = { path = "deps/research-environments/environments/swebench_verified_v1", editable = true }
swelego-v1 = { path = "deps/research-environments/environments/swelego_v1", editable = true }
swebench-pro-v1 = { path = "deps/research-environments/environments/swe/swebench_pro_v1", editable = true }
swebench-verified-v1 = { path = "deps/research-environments/environments/swe/swebench_verified_v1", editable = true }
swelego-v1 = { path = "deps/research-environments/environments/swe/swelego_v1", editable = true }
tau2-bench-v1 = { path = "deps/research-environments/environments/tau2_bench_v1", editable = true }
terminal-bench-2-v1 = { path = "deps/research-environments/environments/terminal_bench_2_v1", editable = true }
unscramble-v1 = { path = "deps/research-environments/environments/unscramble_v1", editable = true }
@@ -306,13 +307,13 @@ wordle-v1 = { path = "deps/verifiers/environments/wordle_v1", editable = true }
torch = { index = "pytorch-cu128" }
torchvision = { index = "pytorch-cu128" }
torchaudio = { index = "pytorch-cu128" }
torchtitan = { git = "https://github.com/pytorch/torchtitan", rev = "a1fdd7e" }
torchtitan = { git = "https://github.com/pytorch/torchtitan", rev = "23e4dfc" }
dion = { git = "https://github.com/samsja/dion.git", rev = "d891eeb" }
flash-attn-4 = { git = "https://github.com/Dao-AILab/flash-attention.git", subdirectory = "flash_attn/cute", rev = "96bd151" }
vllm-router = { url = "https://github.com/PrimeIntellect-ai/router/releases/download/v0.1.26/vllm_router-0.1.26-cp38-abi3-manylinux_2_28_x86_64.whl" }
vllm = [
{ url = "https://github.com/vllm-project/vllm/releases/download/v0.23.0/vllm-0.23.0+cu129-cp38-abi3-manylinux_2_28_x86_64.whl", marker = "platform_machine == 'x86_64'" },
{ url = "https://github.com/vllm-project/vllm/releases/download/v0.23.0/vllm-0.23.0+cu129-cp38-abi3-manylinux_2_28_aarch64.whl", marker = "platform_machine == 'aarch64'" },
{ url = "https://github.com/vllm-project/vllm/releases/download/v0.24.0/vllm-0.24.0+cu129-cp38-abi3-manylinux_2_28_x86_64.whl", marker = "platform_machine == 'x86_64'" },
{ url = "https://github.com/vllm-project/vllm/releases/download/v0.24.0/vllm-0.24.0+cu129-cp38-abi3-manylinux_2_28_aarch64.whl", marker = "platform_machine == 'aarch64'" },
]
deep-ep = { url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_ep-1.2.1+29d31c0-cp312-cp312-linux_x86_64.whl" }
deep-gemm = { url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_gemm-2.5.0+891d57b-cp312-cp312-linux_x86_64.whl" }
+2
View File
@@ -34,6 +34,8 @@ Default cadence: **1 hour** (researcher can override). At each check-in:
**Notes**: anything unusual (errors, restarts, hangs). Omit if nothing notable.
```
In W&B, each project auto-gets an **"overview" saved view** (train / eval / stability / performance sections) on its first run — use it for a quick check instead of the auto-generated default workspace.
### Restarting a run
**Never restart unless the researcher explicitly asked.** Confirm the exact restart command and the conditions that warrant one.
+2
View File
@@ -76,6 +76,8 @@ def write_slurm_script(config: InferenceConfig, config_path: Path, script_path:
template_vars.update(
num_prefill_nodes=config.deployment.num_prefill_nodes,
num_decode_nodes=config.deployment.num_decode_nodes,
prefill_nodes_per_replica=config.deployment.prefill_nodes_per_replica,
decode_nodes_per_replica=config.deployment.decode_nodes_per_replica,
num_prefill_replicas=config.deployment.num_prefill_replicas,
num_decode_replicas=config.deployment.num_decode_replicas,
prefill_port=config.deployment.prefill_port,
+5 -3
View File
@@ -410,6 +410,8 @@ def write_slurm_script(config: RLConfig, config_dir: Path, script_path: Path) ->
num_infer_replicas=config.deployment.num_infer_replicas,
num_prefill_nodes=infer_deploy.num_prefill_nodes,
num_decode_nodes=infer_deploy.num_decode_nodes,
prefill_nodes_per_replica=infer_deploy.prefill_nodes_per_replica,
decode_nodes_per_replica=infer_deploy.decode_nodes_per_replica,
num_prefill_replicas=infer_deploy.num_prefill_replicas,
num_decode_replicas=infer_deploy.num_decode_replicas,
gpus_per_node=config.deployment.gpus_per_node,
@@ -441,11 +443,11 @@ def write_slurm_script(config: RLConfig, config_dir: Path, script_path: Path) ->
orchestrator_output_dir=config.orchestrator.output_dir,
num_train_nodes=config.deployment.num_train_nodes,
num_infer_nodes=config.deployment.total_infer_nodes,
nodes_per_infer_replica=config.deployment.num_infer_nodes,
nodes_per_infer_replica=config.deployment.infer_nodes_per_replica,
num_infer_replicas=config.deployment.num_infer_replicas,
gpus_per_node=config.deployment.gpus_per_node,
router=config.inference.deployment.router if config.inference else VllmRouterConfig(),
infer_nodes_per_replica=config.deployment.num_infer_nodes,
infer_nodes_per_replica=config.deployment.infer_nodes_per_replica,
backend_port=config.inference.deployment.backend_port if config.inference else 8100,
inference_tp=config.inference.parallel.tp if config.inference else 1,
inference_enable_expert_parallel=config.inference.enable_expert_parallel if config.inference else False,
@@ -496,7 +498,7 @@ def rl_slurm(config: RLConfig):
train_env_names = [env.resolved_name for env in config.orchestrator.train.env]
eval_env_names = [env.resolved_name for env in config.orchestrator.eval.env] if config.orchestrator.eval else []
has_infer = config.deployment.num_infer_nodes > 0
has_infer = config.deployment.infer_nodes_per_replica > 0
log_message = format_log_message(
log_dir=log_dir,
trainer=True,
+173 -226
View File
@@ -3,20 +3,19 @@ import torch
from prime_rl.inference.vllm.padded_input_scrub import monkey_patch_vllm_padded_input_scrub
def transformers_v5_compat():
"""vLLM general plugin: patch transformers v5 config attrs that vLLM still expects.
def apply_shared_vllm_patches():
"""vLLM general plugin: prime-rl patches that must run in every vLLM process.
Registered as a ``vllm.general_plugins`` entry-point so it runs automatically
in every vLLM process, including spawned workers.
in every vLLM process, including spawned workers. Note vLLM swallows plugin
load failures (``load_plugins_by_group`` logs and continues), so a broken
entry-point target silently skips ALL of these patches.
"""
from transformers import Qwen3VLMoeTextConfig
if not hasattr(Qwen3VLMoeTextConfig, "tie_word_embeddings"):
Qwen3VLMoeTextConfig.tie_word_embeddings = False
_patch_lora_key_prefix()
_patch_qwen35_moe_lora_format()
monkey_patch_nano_v3_reasoning_parser()
monkey_patch_qwen3_coder_param_newline_trim()
monkey_patch_minimax_m2_think_end_passthrough()
monkey_patch_vllm_padded_input_scrub()
monkey_patch_return_routed_experts_with_nixl_connector()
monkey_patch_kv_xfer_finished_tolerate_freed()
@@ -100,6 +99,91 @@ def monkey_patch_nano_v3_reasoning_parser():
ReasoningParserManager.register_module("nano_v3", module=NanoV3ReasoningParser)
def monkey_patch_qwen3_coder_param_newline_trim():
"""Restore vLLM 0.23's single-newline trim for qwen3_coder tool parameters.
vLLM 0.24's parser engine applies a full ``.strip()`` to every parameter
value in ``_qwen3_arg_converter``; 0.23's ``Qwen3CoderToolParser`` trimmed
exactly one leading and one trailing newline. A full strip corrupts
whitespace-significant string parameters (str_replace-style
``old_str``/``new_str``, file content with an indented first line, values
with intentional trailing newlines), silently changing tool execution and
rewards for agentic runs. Copy of ``_qwen3_arg_converter`` with only the
trim changed. Also covers ``nemotron_v3``, which reuses ``qwen3_config``.
"""
import json
from vllm.parser import qwen3
def _trim_one_newline(value: str) -> str:
if value.startswith("\n"):
value = value[1:]
if value.endswith("\n"):
value = value[:-1]
return value
def _patched_arg_converter(raw_args: str, partial: bool) -> str:
params: dict[str, object] = {}
for match in qwen3._PARAM_RE.finditer(raw_args):
name = match.group(1)
value = match.group(2)
## START PATCHED CODE (upstream: value.strip())
params[name] = _trim_one_newline(value)
## END PATCHED CODE
if partial:
remaining = qwen3._PARAM_RE.sub("", raw_args)
m = qwen3._PARTIAL_PARAM_RE.search(remaining)
if m:
name = m.group(1)
value = m.group(2)
if name:
## START PATCHED CODE (upstream: value.strip())
params[name] = _trim_one_newline(value)
## END PATCHED CODE
return json.dumps(params, ensure_ascii=False)
qwen3._qwen3_arg_converter = _patched_arg_converter
# qwen3_config captures the converter when first built; drop any cached configs.
qwen3.qwen3_config.cache_clear()
def monkey_patch_minimax_m2_think_end_passthrough():
"""Keep the literal ``</think>`` in MiniMax-M2 content on tool-calling turns.
prime-rl serves MiniMax-M2 with ``reasoning=minimax_m2_append_think``, which
returns content as ``<think>`` + the full completion so think tags round-trip
through multi-turn re-serialization. vLLM 0.24's minimax_m2 parser engine
added a ``(CONTENT, THINK_END) -> no-events`` transition that silently
swallows the ``</think>`` (0.23's regex tool parser passed it through
untouched), and it also ``.strip()``s content whenever tool calls are
present. Drop the transition — the engine emits unmatched terminals as plain
state content — and disable the content strip.
"""
import dataclasses
import functools
from vllm.parser import minimax_m2
from vllm.parser.engine.parser_engine_config import ParserState
original_config = minimax_m2.minimax_m2_config
@functools.cache
def _patched_config():
config = original_config()
transitions = dict(config.transitions)
del transitions[(ParserState.CONTENT, "THINK_END")]
return dataclasses.replace(
config,
transitions=transitions,
strip_content_whitespace_with_tools=False,
)
minimax_m2.minimax_m2_config = _patched_config
def monkey_patch_return_routed_experts_with_nixl_connector():
from vllm import envs
from vllm.config.vllm import VllmConfig
@@ -185,7 +269,7 @@ def monkey_patch_strip_routed_experts_from_chat():
def _patch_qwen35_moe_lora_format():
"""Force Qwen3.5-MoE onto vLLM's 2D per-expert LoRA format.
vLLM 0.23.0 defaults ``Qwen3_5MoeForConditionalGeneration.is_3d_moe_weight = True``,
vLLM 0.24.0 still defaults ``Qwen3_5MoeForConditionalGeneration.is_3d_moe_weight = True``,
which makes the LoRA loader expect 3D stacked-expert adapters
(``base_layer.lora_{A,B}.weight`` / ``lora_{A,B}.weight``, experts folded into the
rank dim; see ``_stack_moe_lora_weights``). Our trainer instead emits the 2D
@@ -206,16 +290,23 @@ def _patch_qwen35_moe_lora_format():
def _patch_lora_key_prefix():
"""Patch vLLM's LoRA loading to handle keys without base_model.model. prefix.
"""Accept both bare-suffix and fully-qualified expert module names in LoRA adapters.
This is a copy of the upstream patch: https://github.com/vllm-project/vllm/pull/38522
We can remove this patch once that PR makes it into a release.
Copy of vLLM 0.24.0's ``LoRAModel.from_local_checkpoint`` with one change: the
``.experts`` branch of ``check_unexpected_modules`` accepts either the bare suffix
(``down_proj``) or the qualified per-expert name (``experts.N.down_proj``), where
upstream only accepts the qualified form. Our trainer's 2D per-expert adapters
(Qwen3.5-MoE) carry names whose qualified form is not in the expected set while
the bare suffix is; Qwen3-30B-A3B adapters go the other way. Upstream fix
vllm-project/vllm#38522 was closed unmerged, so this stays.
"""
from vllm.lora.lora_model import (
LoRAModel,
MoEEPLoadSpec,
PEFTHelper,
TensorizerConfig,
WeightsMapper,
_is_remote_expert_key,
get_lora_id,
is_base_embedding_weights,
os,
@@ -236,6 +327,7 @@ def _patch_lora_key_prefix():
weights_mapper: WeightsMapper | None = None,
tensorizer_config_dict: dict | None = None,
skip_prefixes: list[str] | None = None,
moe_ep_spec: MoEEPLoadSpec | None = None,
) -> "LoRAModel":
"""Create a LoRAModel from a local checkpoint.
@@ -251,6 +343,11 @@ def _patch_lora_key_prefix():
skip_prefixes: List of module name prefixes to skip during loading.
Models can define this to skip modules not used in inference
(e.g., MTP layers). Format: ["mtp."]
moe_ep_spec: When 2D FusedMoE LoRA modules are present with
expert parallelism enabled, the (ep_rank, local, global)
slicing metadata shared across all MoE layers. Non-local
expert weights are skipped at read time instead of being
loaded and discarded later.
Returns:
Loaded LoRA Model.
@@ -275,22 +372,13 @@ def _patch_lora_key_prefix():
continue
module_name, _ = parse_fine_tuned_lora_name(lora_module, weights_mapper)
# Case for expert lora weights.
# For standard MoE models the name ends in "...experts",
# so expert_idx+1 yields "experts" which is in
# expected_lora_modules.
# For Qwen 3.5 MoE (and similar models) the expert index
# is embedded: "...experts.N.down_proj". Taking everything
# after ".experts" gives "experts.N.down_proj" which is
# never in the expected set even though "down_proj" is.
# Qwen3-30B-A3B goes the other way: the expected set
# contains the fully-qualified per-expert name
# ("experts.N.down_proj") but not the bare suffix.
# Accept either form.
## START PATCHED CODE (upstream only accepts the qualified form)
if ".experts" in module_name:
expert_suffix = module_name.split(".")[-1]
experts_qualified = "experts" + module_name.split(".experts", 1)[-1]
if expert_suffix not in expected_lora_modules and experts_qualified not in expected_lora_modules:
unexpected_modules.append(module_name)
## END PATCHED CODE
elif module_name.rsplit(".", 1)[-1] not in expected_lora_modules:
unexpected_modules.append(module_name)
@@ -307,11 +395,15 @@ def _patch_lora_key_prefix():
from tensorizer import TensorDeserializer
tensorizer_config = TensorizerConfig(**tensorizer_config_dict)
lora_tensor_path = os.path.join(tensorizer_config.tensorizer_dir, "adapter_model.tensors")
tensorizer_dir = tensorizer_config.tensorizer_dir
if tensorizer_dir is None:
raise ValueError("tensorizer_dir must be set in tensorizer config.")
lora_tensor_path = os.path.join(tensorizer_dir, "adapter_model.tensors")
tensorizer_args = tensorizer_config._construct_tensorizer_args()
tensors = TensorDeserializer(
lora_tensor_path,
dtype=tensorizer_config.dtype,
device=device,
**tensorizer_args.deserialization_kwargs,
)
check_unexpected_modules(tensors)
@@ -328,11 +420,18 @@ def _patch_lora_key_prefix():
# Load tensors if there are only expected modules.
check_unexpected_modules(f)
for module in f.keys(): # noqa
if moe_ep_spec is not None and _is_remote_expert_key(module, moe_ep_spec):
continue
tensors[module] = f.get_tensor(module)
elif os.path.isfile(lora_bin_file_path) or os.path.isfile(lora_pt_file_path):
lora_file_path = lora_bin_file_path if os.path.isfile(lora_bin_file_path) else lora_pt_file_path
tensors = torch.load(lora_file_path, map_location=device, weights_only=True)
check_unexpected_modules(tensors)
if moe_ep_spec is not None:
# `.bin`/`.pt` adapters can't be lazy-loaded, but pruning
# the dict here still frees the non-local expert tensors
# before the dtype cast / pin_memory work that follows.
tensors = {k: v for k, v in tensors.items() if not _is_remote_expert_key(k, moe_ep_spec)}
else:
raise ValueError(f"{lora_dir} doesn't contain tensors")
@@ -350,177 +449,6 @@ def _patch_lora_key_prefix():
LoRAModel.from_local_checkpoint = classmethod(_patched_from_local_checkpoint)
# Monkeypatch LoadLoRAAdapter to allow loading the same adapter multiple times
# TODO: may be removable if we pass load_inplace=True (supported since vLLM 0.18, PR #31326)
def monkey_patch_load_lora_adapter():
from http import HTTPStatus
from vllm.entrypoints.openai.engine.protocol import ErrorResponse
from vllm.entrypoints.openai.models.serving import (
OpenAIServingModels,
create_error_response,
)
from vllm.entrypoints.serve.lora.protocol import LoadLoRAAdapterRequest
from vllm.logger import init_logger
from vllm.lora.request import LoRARequest
logger = init_logger(__name__)
async def _patched_load_lora_adapter(
self: OpenAIServingModels, request: LoadLoRAAdapterRequest, base_model_name: str | None = None
) -> ErrorResponse | str:
lora_name = request.lora_name
# Ensure atomicity based on the lora name
async with self.lora_resolver_lock[lora_name]:
lora_path = request.lora_path
## START PATCHED CODE
if lora_name in self.lora_requests:
lora_request = self.lora_requests[lora_name]
lora_request.lora_path = lora_path
else:
unique_id = self.lora_id_counter.inc(1)
lora_request = LoRARequest(lora_name=lora_name, lora_int_id=unique_id, lora_path=lora_path)
## END PATCHED CODE
if base_model_name is not None and self.is_base_model(base_model_name):
lora_request.base_model_name = base_model_name
# Validate that the adapter can be loaded into the engine
# This will also preload it for incoming requests
try:
await self.engine_client.add_lora(lora_request)
except Exception as e:
error_type = "BadRequestError"
status_code = HTTPStatus.BAD_REQUEST
if "No adapter found" in str(e):
error_type = "NotFoundError"
status_code = HTTPStatus.NOT_FOUND
return create_error_response(message=str(e), err_type=error_type, status_code=status_code)
self.lora_requests[lora_name] = lora_request
logger.info("Loaded new LoRA adapter: name '%s', path '%s'", lora_name, lora_path)
return f"Success: LoRA adapter '{lora_name}' added successfully."
OpenAIServingModels.load_lora_adapter = _patched_load_lora_adapter
# Monkeypatch LRUCacheWorkerLoRAManager to allow loading adapter inplace without doing it every request
# TODO: may be removable if we pass load_inplace=True (supported since vLLM 0.18, PR #31326)
def monkey_patch_LRUCacheWorkerLoRAManager():
from vllm.lora.worker_manager import LoRARequest, LRUCacheLoRAModelManager, LRUCacheWorkerLoRAManager
# The dunder is intended. It's a private method that we're patching.
def _patched__apply_adapters(self: LRUCacheWorkerLoRAManager, lora_requests: set[LoRARequest]) -> None:
loras_map = {lora_request.lora_int_id: lora_request for lora_request in lora_requests if lora_request}
if len(loras_map) > self._adapter_manager.lora_slots:
raise RuntimeError(
f"Number of requested LoRAs ({len(loras_map)}) is greater "
"than the number of GPU LoRA slots "
f"({self._adapter_manager.lora_slots})."
)
for lora in loras_map.values():
## START PATCHED CODE
self.add_adapter(lora, force_load=False)
## END PATCHED CODE
def _patched_add_adapter(
self: LRUCacheWorkerLoRAManager, lora_request: LoRARequest, force_load: bool = True
) -> bool:
# Note that this method is not thread-safe. It may be invoked multiple
# times for the same adapter when using multiple API servers.
# This is ok because it's currently only called from
# the single-threaded core engine loop.
## START PATCHED CODE
if lora_request.lora_int_id not in self.list_adapters() or force_load:
## END PATCHED CODE
# Load the new adapter first to ensure it is actually valid, before
# evicting any existing adapters.
# This may cause the # of loaded lora adapters to very temporarily
# exceed `--max-cpu-loras`.
lora = self._load_adapter(lora_request)
## START PATCHED CODE
self._adapter_manager.remove_adapter(lora.id)
## END PATCHED CODE
# Loading succeeded, now check if we will exceed cache capacity and
# evict if the oldest adapter if so
if len(self._adapter_manager) + 1 > self._adapter_manager.capacity:
assert isinstance(self._adapter_manager, LRUCacheLoRAModelManager)
self._adapter_manager.remove_oldest_adapter()
# Then add the new adapter to the cache
loaded = self._adapter_manager.add_adapter(lora)
else:
# If the lora is already loaded, just touch it to
# update its position in the caches
loaded = self._adapter_manager.get_adapter(lora_request.lora_int_id) is not None
self._adapter_manager.activate_adapter(lora_request.lora_int_id)
return loaded
LRUCacheWorkerLoRAManager._apply_adapters = _patched__apply_adapters
LRUCacheWorkerLoRAManager.add_adapter = _patched_add_adapter
# Monkeypatch WorkerLoRAManager._load_adapter to skip the per-module regex
# warning loop. On wide MoE models (Qwen3.5-35B-A3B) it spends minutes
# recompiling regex patterns inside is_supported_lora_module — purely to emit
# logger.warning_once about modules that will be ignored. Adapter validity is
# already enforced by from_local_checkpoint, so dropping the warnings is safe.
def monkey_patch_skip_lora_module_warnings():
from vllm.exceptions import LoRAAdapterNotFoundError
from vllm.lora.lora_model import LoRAModel
from vllm.lora.peft_helper import PEFTHelper
from vllm.lora.request import LoRARequest
from vllm.lora.utils import get_adapter_absolute_path
from vllm.lora.worker_manager import WorkerLoRAManager
def _patched_load_adapter(self: WorkerLoRAManager, lora_request: LoRARequest) -> LoRAModel:
try:
supported_lora_modules = self._adapter_manager.supported_lora_modules
packed_modules_mapping = self._adapter_manager.packed_modules_mapping
expected_lora_lst: list[str] = []
for module in supported_lora_modules:
if module in packed_modules_mapping:
expected_lora_lst.extend(packed_modules_mapping[module])
else:
expected_lora_lst.append(module)
if module == "experts":
expected_lora_lst.append(module)
expected_lora_modules = set(expected_lora_lst)
lora_path = get_adapter_absolute_path(lora_request.lora_path)
peft_helper = PEFTHelper.from_local_dir(
lora_path,
self.max_position_embeddings,
lora_request.tensorizer_config_dict,
)
peft_helper.validate_legal(self.lora_config)
model = self._adapter_manager.model
hf_to_vllm_mapper = getattr(model, "hf_to_vllm_mapper", None)
lora_skip_prefixes = getattr(model, "lora_skip_prefixes", None)
lora = self._lora_model_cls.from_local_checkpoint(
lora_path,
expected_lora_modules,
peft_helper=peft_helper,
lora_model_id=lora_request.lora_int_id,
device="cpu",
dtype=self.lora_config.lora_dtype,
model_vocab_size=self.vocab_size,
tensorizer_config_dict=lora_request.tensorizer_config_dict,
weights_mapper=hf_to_vllm_mapper,
skip_prefixes=lora_skip_prefixes,
)
except FileNotFoundError as e:
raise LoRAAdapterNotFoundError(lora_request.lora_name, lora_request.lora_path) from e
return lora
WorkerLoRAManager._load_adapter = _patched_load_adapter
# Monkeypatch TokenizeParams to fix overly conservative validation
def monkey_patch_tokenize_params_validation():
"""
@@ -608,7 +536,7 @@ def monkey_patch_minimax_m2_for_lora():
asserts inputs are float16/bfloat16. Qwen3 MoE doesn't have this
problem because its gate uses the model dtype.
Fix: rebuild the gate as GateLinear with a bf16 weight (out_dtype=float32
keeps fp32 router logits). vLLM 0.23.0's own forward already drops the
keeps fp32 router logits). vLLM 0.24.0's own forward already drops the
float32 input cast. FusedMoE also has router_logits_dtype=float32, so
routing precision is preserved inside the expert dispatch.
@@ -634,7 +562,7 @@ def monkey_patch_minimax_m2_for_lora():
_original_init(self, config, quant_config, prefix)
from vllm.model_executor.layers.fused_moe.router.gate_linear import GateLinear
# vLLM 0.23.0 builds the gate as GateLinear with a float32 weight; rebuild it
# vLLM 0.24.0 builds the gate as GateLinear with a float32 weight; rebuild it
# with a bf16 weight (model dtype) so the LoRA Triton kernel's float16/bfloat16
# assertion passes, keeping out_dtype=float32 so router logits stay fp32 (the
# GateLinear bf16xbf16->fp32 path).
@@ -646,19 +574,7 @@ def monkey_patch_minimax_m2_for_lora():
prefix=f"{prefix}.gate",
)
def _patched_forward(self, hidden_states):
from vllm.distributed import tensor_model_parallel_all_reduce
num_tokens, hidden_dim = hidden_states.shape
hidden_states = hidden_states.view(-1, hidden_dim)
router_logits, _ = self.gate(hidden_states)
final_hidden_states = self.experts(hidden_states=hidden_states, router_logits=router_logits)
if self.tp_size > 1:
final_hidden_states = tensor_model_parallel_all_reduce(final_hidden_states)
return final_hidden_states.view(num_tokens, hidden_dim)
MiniMaxM2MoE.__init__ = _patched_init
MiniMaxM2MoE.forward = _patched_forward
# --- Adapter key remapping (only read by vLLM's LoRA adapter loader) ---
MiniMaxM2ForCausalLM.hf_to_vllm_mapper = WeightsMapper(
@@ -703,23 +619,15 @@ def monkey_patch_no_moe_lora():
Otherwise, the oracle will always try to pick TritonExperts.
For blackwells, we want TRTLLMFlashInfer.
"""
from vllm.model_executor.layers.fused_moe.config import FusedMoEConfig, logger
from vllm.model_executor.layers.fused_moe.config import FusedMoEConfig
original_post_init = FusedMoEConfig.__post_init__
def _patched__post_init__(self: FusedMoEConfig):
if self.dp_size > 1:
logger.debug_once("Using FusedMoEConfig::max_num_tokens=%d", self.max_num_tokens)
assert self.max_num_tokens > 0
if self.router_logits_dtype is None:
self.router_logits_dtype = self.in_dtype
if self.hidden_dim_unpadded is None:
self.hidden_dim_unpadded = self.hidden_dim
if self.intermediate_size_per_partition_unpadded is None:
self.intermediate_size_per_partition_unpadded = self.intermediate_size_per_partition
# Disable LoRA for MoE layers
original_post_init(self)
# Disable LoRA for MoE layers. `is_lora_enabled` is only read later during
# kernel selection (modular_kernel / unquantized oracle), never inside
# `__post_init__`, so flipping it after the original runs is sufficient.
self.is_lora_enabled = False
FusedMoEConfig.__post_init__ = _patched__post_init__
@@ -787,12 +695,51 @@ def monkey_patch_fp32_lm_head():
logger.info("Installed fp32 lm_head patch (native out_dtype=fp32 mm).")
def monkey_patch_fp32_router_logits():
"""Emit fp32 MoE router logits for DeepSeek-family models (incl. GLM-5.x glm_moe_dsa).
vLLM's DeepseekV2MoE gate is a GateLinear with a bf16 weight and no out_dtype,
so router logits are rounded to bf16 before expert scoring. GLM-5.x was trained
with fp32 routing (Megatron ``--moe-router-dtype fp32``); upstream now runs its
gate fully in fp32 (vllm-project/vllm#47410, not in the pinned release).
Setting ``out_dtype=float32`` routes the gate through GateLinear's cuBLAS
bf16xbf16->fp32 tier: same GEMM, but the fp32 accumulator is written out
unrounded. Unlike the upstream PR, the gate weight stays bf16, so the LoRA
Triton kernel dtype assert and the bf16 weight-broadcast path are unaffected.
Activated by ``additional_config["fp32_router_logits"] = True``; the launcher
sets this when ``inference.enable_fp32_router_logits`` is set. The flag is read
at module construction, where vLLM guarantees a ``set_current_vllm_config()``
context. No-op if something else already set an out_dtype (e.g. the ROCm AITER
branch, whose kernel wants matching dtypes).
"""
import torch
from vllm.config import get_current_vllm_config
from vllm.logger import init_logger
from vllm.model_executor.models.deepseek_v2 import DeepseekV2MoE
logger = init_logger(__name__)
_original_init = DeepseekV2MoE.__init__
def _patched_init(self, *args, **kwargs):
_original_init(self, *args, **kwargs)
additional_config = get_current_vllm_config().additional_config or {}
if not additional_config.get("fp32_router_logits", False):
return
if self.gate.out_dtype is None:
self.gate.set_out_dtype(torch.float32)
DeepseekV2MoE.__init__ = _patched_init
logger.info("Installed fp32 router logits patch (self-gates on additional_config['fp32_router_logits']).")
def monkey_patch_dp_coordinator_startup_timeout():
"""Raise the DP coordinator startup timeout from vLLM's hard-coded 30s.
"""Raise the DP coordinator startup timeout from vLLM's hard-coded 120s.
The coordinator child process is spawned on the DP-rank-0 API server while
every engine-core rank on the node is importing and loading weights, so its
own spawn-time re-import can take well over 30s under that CPU/IO
own spawn-time re-import can exceed the hard-coded timeout under that CPU/IO
contention (seen on multi-node disaggregated GLM-5.1 launches). Configurable
via PRIME_DP_COORDINATOR_STARTUP_TIMEOUT (seconds, default 300).
"""
+8 -1
View File
@@ -10,7 +10,8 @@ def setup_vllm_env(config: InferenceConfig):
# spawn is more robust in vLLM nightlies and Qwen3-VL (fork can deadlock with multithreaded processes)
os.environ.setdefault("VLLM_WORKER_MULTIPROC_METHOD", "spawn")
# Force the V1 GPU model runner. vLLM 0.23.0 routes dense Llama/Mistral/Qwen3 to the
# Force the V1 GPU model runner. vLLM 0.24.0 routes Llama/Mistral/Qwen3 plus MoE archs
# (DeepseekV2, Qwen2Moe, GraniteMoe; the 0.23 MoE/quantized guard was removed) to the
# V2 runner, which has no `_preprocess` hook for our padded-input scrub (see
# inference/vllm/padded_input_scrub.py) and doesn't zero the padded decode tail
# itself; that stale tail poisons CUDA-graph replay as NaN logits (reproduced on
@@ -19,6 +20,12 @@ def setup_vllm_env(config: InferenceConfig):
# (the NIXL PD path rejects V2). setdefault so it stays overridable.
os.environ.setdefault("VLLM_USE_V2_MODEL_RUNNER", "0")
# vLLM 0.24.0 flipped VLLM_ENFORCE_STRICT_TOOL_CALLING's default to True, which
# grammar-constrains generation (xgrammar structural tags) for tool_choice
# "required"/named and strict tools — a sampling distribution the trainer never
# sees. Keep it off so rollout logprobs stay faithful for importance ratios.
os.environ.setdefault("VLLM_ENFORCE_STRICT_TOOL_CALLING", "0")
deep_gemm_enabled = "1" if config.use_deep_gemm else "0"
os.environ["VLLM_USE_DEEP_GEMM"] = deep_gemm_enabled
os.environ["VLLM_MOE_USE_DEEP_GEMM"] = deep_gemm_enabled
+22 -6
View File
@@ -22,7 +22,6 @@ logger = get_logger()
from prime_rl.inference.patches import (
monkey_patch_dp_coordinator_startup_timeout,
monkey_patch_harmony_stop_token_propagation,
monkey_patch_load_lora_adapter,
monkey_patch_nano_v3_reasoning_parser,
monkey_patch_strip_routed_experts_from_chat,
monkey_patch_tokenize_params_validation,
@@ -32,9 +31,6 @@ from prime_rl.inference.patches import (
# NOTE: Fix harmony stop token propagation for GPT-OSS models
# Upstream issue still open: https://github.com/vllm-project/vllm/issues/22519
monkey_patch_harmony_stop_token_propagation()
# NOTE: Monkeypatch LoadLoRAAdapter to allow loading the same adapter multiple times
# May be removable if we pass load_inplace=True (supported since vLLM 0.18, PR #31326)
monkey_patch_load_lora_adapter()
# NOTE: Monkeypatch TokenizeParams to fix overly conservative validation
# Still needed in vLLM 0.20 — upstream rejects prompt_len > max_model_len - max_tokens
monkey_patch_tokenize_params_validation()
@@ -50,7 +46,7 @@ monkey_patch_vllm_padded_input_scrub()
# routed_experts from chat responses since the server-wide enable flag has no
# per-request toggle.
monkey_patch_strip_routed_experts_from_chat()
# NOTE: vLLM hard-codes a 30s DP coordinator startup timeout, which the rank-0
# NOTE: vLLM hard-codes a 120s DP coordinator startup timeout, which the rank-0
# API server blows through when all engine-core ranks on the node are loading
# weights concurrently (multi-node disaggregated deployments).
monkey_patch_dp_coordinator_startup_timeout()
@@ -97,9 +93,29 @@ async def update_weights(request: Request):
@router.post("/load_lora_adapter")
async def load_lora_adapter(lora_request: LoadLoRAAdapterRequest, raw_request: Request):
"""Wrapper around vLLM's /v1/load_lora_adapter."""
"""Wrapper around vLLM's /v1/load_lora_adapter.
prime-rl reloads a fixed-name adapter with fresh weights every step (the path
changes per policy version; the name is constant, see orchestrator.lora_name).
vLLM's native loader rejects a same-name reload unless ``load_inplace=True``,
so we force it here — that makes the worker re-read the new weights during
``add_lora``, reusing the existing ``lora_int_id``.
We then reset the stored request's flag back to ``False``. ``load_inplace`` is
a sticky field on the ``LoRARequest`` that ``_maybe_get_adapters`` hands to
every generation request; left ``True`` it would force a disk reload on each
scheduler step. The orchestrator awaits this endpoint before dispatching
rollouts for the new version, so the reset always lands before generation.
The reset runs regardless of success/error: vLLM only stores the adapter on
success today, but resetting whatever is stored keeps us correct even if a
future version were to leave a ``load_inplace=True`` request behind on error.
"""
handler = models(raw_request)
lora_request.load_inplace = True
response = await handler.load_lora_adapter(lora_request)
stored = handler.lora_requests.get(lora_request.lora_name)
if stored is not None:
stored.load_inplace = False
if isinstance(response, ErrorResponse):
return JSONResponse(content=response.model_dump(), status_code=response.error.code)
return {"status": "ok"}
@@ -3,19 +3,13 @@ import os
from prime_rl.inference.patches import (
monkey_patch_fp32_lm_head,
monkey_patch_LRUCacheWorkerLoRAManager,
monkey_patch_fp32_router_logits,
monkey_patch_minimax_m2_for_lora,
monkey_patch_no_moe_lora,
monkey_patch_skip_lora_module_warnings,
)
logger = logging.getLogger(__name__)
# Monkeypatch LRUCacheWorkerLoRAManager to allow loading adapter inplace without doing it every request
monkey_patch_LRUCacheWorkerLoRAManager()
# Skip the per-module regex warning loop in WorkerLoRAManager._load_adapter
# (minutes-long stall on wide MoE models like Qwen3.5-35B-A3B)
monkey_patch_skip_lora_module_warnings()
# Monkeypatch MiniMaxM2 MoE gate dtype and adapter key mapping for LoRA compatibility
monkey_patch_minimax_m2_for_lora()
# Disable LoRA on MoE layers so vLLM picks better kernels (e.g. TRTLLMFlashInfer on Blackwell)
@@ -27,3 +21,6 @@ else:
# Install fp32 lm_head patch; self-gates on additional_config["fp32_lm_head"] at call time
monkey_patch_fp32_lm_head()
# Install fp32 router logits patch; self-gates on additional_config["fp32_router_logits"]
monkey_patch_fp32_router_logits()
+1 -48
View File
@@ -24,42 +24,6 @@ else:
logger = init_logger("vllm.inference.vllm.worker_nccl")
# NemotronH mixer.D is dropped by vLLM's layerwise online-reload path (left uninitialized).
_RELOAD_CORRUPTED_SUFFIXES = (".mixer.D",)
def _restore_reload_corrupted_params(model: Module, received: dict[str, torch.Tensor]) -> None:
"""Work around a vLLM layerwise-reload bug for NemotronH (present through vLLM 0.23.0).
The online reload drops the weight load for every Mamba layer's ``mixer.D`` (the SSD skip
connection), leaving it as uninitialized ``empty_strided`` memory -- it reads back as garbage
(NaN/inf) and the logits go NaN after a weight update. Root cause: ``mixer.A`` is loaded with
``composed_weight_loader`` (an extra in-place transform copy), so the reload element counter
double-counts ``A`` and finalizes the layer before ``D`` (loaded last) is loaded. The received
broadcast value is correct, so restore D from it via the param's own ``weight_loader``.
Fixed upstream by vllm-project/vllm#44814 (merged 2026-06-10) but NOT in the pinned 0.23.0
release; remove this shim once we bump to a vLLM release that includes it.
"""
def _layer_key(name: str) -> str:
index = name.find("layers.")
return name[index:] if index >= 0 else name
received_by_key = {_layer_key(name): tensor for name, tensor in received.items()}
for name, param in model.named_parameters():
if not name.endswith(_RELOAD_CORRUPTED_SUFFIXES):
continue
tensor = received_by_key.get(_layer_key(name))
if tensor is None:
continue
tensor = tensor.to(device=param.device)
weight_loader = getattr(param, "weight_loader", None)
if weight_loader is not None:
weight_loader(param, tensor)
elif tensor.shape == param.shape:
param.data.copy_(tensor.to(param.dtype))
def receive_integer(communicator: PyNcclCommunicator) -> int:
"""Receive an integer from the trainer master rank using NCCL communicator."""
@@ -184,20 +148,9 @@ class NCCLWeightUpdateWorker(Worker):
update_mla_absorbed_weights(model)
return
# vLLM's layerwise reload drops NemotronH mixer.D's weight load (see
# _restore_reload_corrupted_params). Capture the correct received value to restore after.
received_reload_fix: dict[str, torch.Tensor] = {}
def _capture_reload_fix(weights):
for name, tensor in weights:
if name.endswith(_RELOAD_CORRUPTED_SUFFIXES):
received_reload_fix[name] = tensor.detach().to("cpu", copy=True)
yield name, tensor
load_weights_checkpoint_layerwise(
model,
_capture_reload_fix(state_iter),
state_iter,
self.model_runner.model_config,
self.vllm_config,
)
_restore_reload_corrupted_params(model, received_reload_fix)
@@ -5,6 +5,7 @@ from torch.nn import Module
from vllm.config import set_current_vllm_config
from vllm.logger import init_logger
from vllm.model_executor.model_loader.reload import finalize_layerwise_reload, initialize_layerwise_reload
from vllm.model_executor.model_loader.weight_utils import remap_moe_expert_weights
logger = init_logger("vllm.inference.vllm.worker_weight_transfer")
@@ -47,20 +48,20 @@ def _invert_logical_to_physical_map(logical_to_physical_map: torch.Tensor, num_p
return physical_to_logical
def _build_expert_source_indices(module) -> torch.Tensor | None:
if module._expert_map is None:
def _build_expert_source_indices(routed_experts, router) -> torch.Tensor | None:
if routed_experts._expert_map is None:
return None
physical_indices = torch.where(module._expert_map >= 0)[0]
local_indices = module._expert_map[physical_indices]
physical_indices = torch.where(routed_experts._expert_map >= 0)[0]
local_indices = routed_experts._expert_map[physical_indices]
physical_indices = physical_indices[local_indices.argsort()]
eplb_layer_state = getattr(module, "eplb_state", None)
eplb_layer_state = getattr(router, "eplb_state", None)
logical_to_physical_map = getattr(eplb_layer_state, "logical_to_physical_map", None)
if logical_to_physical_map is None:
return physical_indices
physical_to_logical = _invert_logical_to_physical_map(logical_to_physical_map, module.global_num_experts)
physical_to_logical = _invert_logical_to_physical_map(logical_to_physical_map, routed_experts.global_num_experts)
logical_indices = physical_to_logical[physical_indices.to(physical_to_logical.device)]
if (logical_indices < 0).any():
missing = physical_indices[(logical_indices < 0).to(physical_indices.device)].tolist()
@@ -70,14 +71,23 @@ def _build_expert_source_indices(module) -> torch.Tensor | None:
def build_expert_map(model: Module) -> dict[str, torch.Tensor]:
"""Map FusedMoE module names to source expert indices local to this worker."""
from vllm.model_executor.layers.fused_moe.layer import FusedMoE
"""Map MoE module names to source expert indices local to this worker.
vLLM 0.24 turned ``FusedMoE`` into a factory returning a ``MoERunner`` and
split the state that used to live on the ``FusedMoE`` module: the expert map
(``_expert_map`` / ``global_num_experts``) now lives on
``MoERunner.routed_experts`` (a ``RoutedExperts``), and the EPLB state on
``MoERunner.router``. Keying by the ``MoERunner`` name prefix-matches the
nested ``routed_experts.*`` weight params after ``load_weights_kernel``
remaps incoming flat names via ``remap_moe_expert_weights``.
"""
from vllm.model_executor.layers.fused_moe import MoERunner
source_indices_by_module: dict[str, torch.Tensor] = {}
for module_name, module in model.named_modules():
if not isinstance(module, FusedMoE):
if not isinstance(module, MoERunner):
continue
source_indices = _build_expert_source_indices(module)
source_indices = _build_expert_source_indices(module.routed_experts, module.router)
if source_indices is None:
continue
source_indices_by_module[module_name] = source_indices
@@ -94,7 +104,10 @@ def load_weights_kernel(model: Module, state_iter: Generator[tuple[str, torch.Te
skipped: list[str] = []
shape_mismatches: list[str] = []
for name, tensor in state_iter:
# The trainer emits pre-0.24 flat kernel names (``...experts.w13_weight``); since
# vLLM 0.24 the expert params are nested (``...experts.routed_experts.w13_weight``).
# ``remap_moe_expert_weights`` is upstream's compat shim for exactly this transition.
for name, tensor in remap_moe_expert_weights(state_iter, params):
if name not in params:
skipped.append(name)
continue
+4 -1
View File
@@ -5,6 +5,7 @@ from typing import TYPE_CHECKING, Callable
from prime_rl.configs.algorithm import EchoAlgoConfig
from prime_rl.orchestrator.algo.grpo import GRPOAlgorithm
from prime_rl.orchestrator.trajectories import iter_trainable_branches
from prime_rl.utils.utils import import_object
if TYPE_CHECKING:
@@ -55,7 +56,9 @@ class EchoAlgorithm(GRPOAlgorithm):
(role tags, separators, tool-response wraps) is excluded. Nodes without
attribution (the default renderer, or relay turns with no token ids)
fall back to weighting the whole non-sampled span."""
trainable_branches = [branch for branch in rollout.branches if any(branch.sampled_mask)]
# Same branch selection as ``trace_to_samples``, so the zip with ``rollout.samples``
# stays aligned when fork dedup drops a branch.
trainable_branches = [branch for branch, _ in iter_trainable_branches(rollout)]
filter_masks = self._filter_masks(rollout, trainable_branches) if self.filter_fn is not None else None
for sample_idx, (sample, branch) in enumerate(zip(rollout.samples, trainable_branches)):
weights = [0.0] * len(sample.token_ids)
+41 -27
View File
@@ -165,6 +165,8 @@ class Orchestrator:
# Trigger timestamps so eval success logs can report epoch duration
self.eval_triggered_at = {}
self.consecutive_empty_batches = 0
self.gate_closed_at = None
self.wait_for_policy_time = 0.0
self.component_tasks = []
# Optional attributes — ``setup()`` populates them when the relevant
@@ -222,6 +224,8 @@ class Orchestrator:
tokenizer=self.tokenizer,
run_config=config,
keep_full_history=config.bench,
train_env_names=[env.resolved_name for env in config.train.env],
eval_env_names=[env.resolved_name for env in config.eval.env] if config.eval is not None else [],
)
if config.heartbeat is not None:
@@ -305,17 +309,21 @@ class Orchestrator:
if self.resume_step is not None and self.ckpt_manager is not None:
self.ckpt_manager.load(self.progress, step=self.resume_step)
# The checkpoint finished step ``resume_step``; resume at the next step. Derive the step
# from ``resume_step`` (not the loaded progress.step) so it stays coordinated with the
# trainer even when ``ckpt.skip_progress`` left the counter unrestored.
self.progress.step = self.resume_step + 1
get_logger().info(f"Resuming orchestrator from checkpoint step {self.resume_step}")
check_exists = config.weight_broadcast.type != "nccl"
wait_timeout = config.ckpt.wait_for_weights_timeout if config.ckpt else None
weights_path = get_weight_dir(
config.output_dir, self.progress.step, check_exists=check_exists, wait_timeout=wait_timeout
config.output_dir, self.resume_step, check_exists=check_exists, wait_timeout=wait_timeout
)
await self.policy_inference.update_weights(weights_path, lora_name=self.lora_name, step=self.progress.step)
await self.policy_inference.update_weights(weights_path, lora_name=self.lora_name, step=self.resume_step)
if self.lora_name is not None:
self.policy_inference.update_model_name(self.lora_name)
self.policy.model_name = self.lora_name
self.policy.version = self.progress.step
self.policy.version = self.resume_step
else:
get_logger().info("Training from scratch")
@@ -361,7 +369,7 @@ class Orchestrator:
inference=self.policy_inference,
observers=[self.dispatcher, self],
lora_name=self.lora_name,
ckpt_step=self.progress.step,
ckpt_step=self.policy.version,
)
# Single periodic logger for the whole pipeline. It's the only
# consumer of ``dispatcher.metrics.drained()`` (which clears on read)
@@ -407,11 +415,11 @@ class Orchestrator:
asyncio.create_task(self.watcher.start(), name="watcher"),
]
# Default step-0 base-model eval — fires before any train rollouts
# unless ``eval.skip_first_step=True`` (or this is a resume)
# Base-model eval (policy v0) — fires before any train rollouts, logged at the first
# step, unless ``eval.skip_first_step=True`` (or this is a resume)
self.maybe_trigger_eval(self.progress.step)
# Anchor step-time clock so step 0 measures startup → first batch
# Anchor step-time clock so the first step measures startup → first batch
self.last_batch_at = time.perf_counter()
# ``clean_exit`` stays False if ``main_loop`` raises (signal-driven
@@ -428,7 +436,11 @@ class Orchestrator:
else:
get_logger().warning(f"Orchestrator interrupted after {elapsed} — forcing cleanup (not a clean exit)")
self.monitor.save_final_summary()
if self.ckpt_manager is not None:
# ``progress.step`` points at the next (unshipped) step; the last finished step is
# ``progress.step - 1``. Checkpoint it as ``step_{progress.step - 1}`` (no-op before the
# first ship).
if self.ckpt_manager is not None and self.progress.step > 1:
self.progress.step -= 1
get_logger().info("Writing final checkpoint")
self.ckpt_manager.save(self.progress, step=self.progress.step)
await self.stop()
@@ -481,9 +493,7 @@ class Orchestrator:
step_time = (now - self.last_batch_at) if self.last_batch_at is not None else 0.0
self.last_batch_at = now
save_ckpt_time = await self.maybe_save_ckpt(step)
if config.max_steps is not None and step >= config.max_steps:
if config.max_steps is not None and step > config.max_steps:
self.draining = True
self.dispatcher.disable_train_scheduling()
n_cancelled = await self.dispatcher.cancel_inflight_train_rollouts()
@@ -522,7 +532,10 @@ class Orchestrator:
await asyncio.to_thread(save_rollouts, rollout_dicts, step_path / "train_rollouts.jsonl")
await self.sender.send(TrainingBatch(examples=batch.samples, step=step))
self.progress.step += 1
self.update_dispatch_gate()
# Checkpoint the step we just shipped (resume point: continue at step + 1).
save_ckpt_time = await self.maybe_save_ckpt(step)
trim_process_memory()
# Rollout metrics over the {agg,<env>} × {all,effective} matrix. ``batch.rollouts`` is the
@@ -554,6 +567,7 @@ class Orchestrator:
"progress/total_tasks": self.progress.total_problems,
"time/step": step_time,
"time/save_ckpt": save_ckpt_time,
"time/wait_for_policy": self.wait_for_policy_time,
"step": step,
}
for env_name, env_pool in batch.rollouts.by_env().items():
@@ -565,6 +579,7 @@ class Orchestrator:
for name, count in self.train_sink.pre_filter_dropped_by_name.items():
metrics[f"pre_filters/all/{name}/rate"] = count / self.train_sink.pre_filter_seen
self.monitor.log(metrics, step=step)
self.wait_for_policy_time = 0.0
self.monitor.log_samples(effective.rollouts, step=step)
self.monitor.log_distributions(
distributions={
@@ -592,7 +607,6 @@ class Orchestrator:
self.log_train_batch(batch, step=step, step_time=step_time)
self.train_sink.reset_pre_filter_stats()
self.progress.step += 1
self.maybe_trigger_eval(self.progress.step)
trim_process_memory()
@@ -764,19 +778,13 @@ class Orchestrator:
)
async def maybe_save_ckpt(self, step: int) -> float:
"""Save the checkpoint if we're at an interval boundary. Returns
"""Checkpoint the step just shipped if it's an interval boundary. Returns
elapsed time (0.0 when no save happened)."""
if self.ckpt_manager is None or self.config.ckpt is None or not self.config.ckpt.interval:
return 0.0
if step <= 0:
return 0.0
# Skip only the drain-entry step (step == max_steps, which never ships):
# it would double-save with the final checkpoint in ``start()`` (also at
# progress.step == max_steps). The last *shipped* step (max_steps - 1) is
# NOT skipped — the trainer saves there (its is_last_step is max_steps),
# so the orchestrator must too or resume from that interval ckpt breaks.
near_end = self.config.max_steps is not None and step >= self.config.max_steps
if near_end:
# The final step's checkpoint is written once in ``start()``'s teardown; skip it here so
# we don't double-save. This mirrors the trainer (its is_last_step skips the in-loop save).
if self.config.max_steps is not None and step >= self.config.max_steps:
return 0.0
if step % self.config.ckpt.interval != 0:
return 0.0
@@ -786,11 +794,13 @@ class Orchestrator:
return time.perf_counter() - t
def update_dispatch_gate(self) -> None:
"""Pause/resume the dispatcher based on how far the orchestrator's
next batch would run ahead of ``policy.version``. Called from two
sites: after shipping a batch (step advances) and from
``on_new_version`` (policy advances)."""
lead = (self.progress.step + 1) - self.policy.version
"""Pause/resume the dispatcher based on how far the in-flight batch runs
ahead of ``policy.version``. ``progress.step`` is always the batch being
collected — advanced right after shipping — so both call sites (ship time
here, policy update in ``on_new_version``) share one lead formula. Steps
are 1-indexed while policy versions stay 0-indexed, so the shipped-batch
count is ``progress.step - 1``."""
lead = (self.progress.step - 1) - self.policy.version
gate = self.dispatcher.dispatch_allowed
was_set = gate.is_set()
if lead > TARGET_LAG:
@@ -798,10 +808,14 @@ class Orchestrator:
get_logger().info(
"Pausing dispatcher to prevent orchestrator from racing from trainer. Waiting for new policy..."
)
self.gate_closed_at = time.perf_counter()
gate.clear()
else:
if not was_set:
get_logger().info("Resuming dispatcher")
if self.gate_closed_at is not None:
self.wait_for_policy_time += time.perf_counter() - self.gate_closed_at
self.gate_closed_at = None
gate.set()
async def on_version_pending(self, step: int) -> None:
+26 -4
View File
@@ -15,6 +15,8 @@ the images it introduced (`branch.multi_modal_data`), rebuilt here into the flat
from __future__ import annotations
from collections.abc import Iterator
import numpy as np
import verifiers.v1 as vf
@@ -64,6 +66,29 @@ def _encode_routed_experts(arr: np.ndarray | None, num_tokens: int) -> RoutedExp
return RoutedExperts(data=arr.tobytes(), shape=list(arr.shape), dtype=str(arr.dtype))
def iter_trainable_branches(trace: vf.Trace) -> Iterator[tuple[vf.Branch, list[bool]]]:
"""Yield each branch that yields a training sample, with its trainable-token mask.
The mask is `branch.sampled_mask` except that a sampled node shared by several branches
(a mid-trajectory fork) is trainable only in the first branch containing it; later
branches carry its tokens as context (mask False). Branches left with no trainable
tokens are skipped, so consumers pairing branches with `trace_to_samples` output
(e.g. echo's observation weighting) must filter through here to stay aligned.
"""
trained_nodes: set[int] = set()
for branch in trace.branches:
mask: list[bool] = []
for node in branch.nodes:
if node.sampled and any(node.mask) and id(node) in trained_nodes:
mask.extend([False] * len(node.mask))
else:
if node.sampled and any(node.mask):
trained_nodes.add(id(node))
mask.extend(node.mask)
if any(mask):
yield branch, mask
def trace_to_samples(
trace: vf.Trace,
*,
@@ -82,10 +107,7 @@ def trace_to_samples(
yield nothing.
"""
samples: list[TrainingSample] = []
for branch in trace.branches:
mask = branch.sampled_mask
if not any(mask):
continue
for branch, mask in iter_trainable_branches(trace):
token_ids = branch.token_ids
mm_kwargs: dict[str, EncodedTensor] | None = None
mm_token_type_ids: list[int] | None = None
+2 -2
View File
@@ -27,9 +27,9 @@ class Policy:
@dataclass
class Progress:
"""Persistent counters; ``step`` is the trainer-aligned step."""
"""Persistent counters; ``step`` is the trainer-aligned step (1-indexed)."""
step: int = 0
step: int = 1
total_tokens: int = 0
total_samples: int = 0
total_problems: int = 0
+12 -2
View File
@@ -34,8 +34,8 @@ export NUM_DECODE_NODES={{ num_decode_nodes }}
export NUM_PREFILL_REPLICAS={{ num_prefill_replicas }}
export NUM_DECODE_REPLICAS={{ num_decode_replicas }}
export NODES_PER_REPLICA=$((NUM_PREFILL_NODES + NUM_DECODE_NODES))
export NODES_PER_PREFILL_REPLICA=$((NUM_PREFILL_NODES / NUM_PREFILL_REPLICAS))
export NODES_PER_DECODE_REPLICA=$((NUM_DECODE_NODES / NUM_DECODE_REPLICAS))
export NODES_PER_PREFILL_REPLICA={{ prefill_nodes_per_replica }}
export NODES_PER_DECODE_REPLICA={{ decode_nodes_per_replica }}
export PREFILL_PORT={{ prefill_port }}
export DECODE_PORT={{ decode_port }}
export ROUTER_PORT={{ router.port }}
@@ -61,7 +61,17 @@ ln -sfn inference/node_0.log $OUTPUT_DIR/logs/inference.log
cd $PROJECT_DIR
[ -f .env ] && source .env
source .venv/bin/activate
{% if not shared_fs %}
# Node-local venv (e.g. UV_PROJECT_ENVIRONMENT on /tmp): a bare `uv sync` would only
# build the batch node, so srun runs it on every node (one task each) and blocks until
# all finish. `set -e` above aborts the job if any node's sync fails. Re-source .env
# inside the task because unexported vars in .env don't cross srun even with normal
# SLURM env propagation; otherwise uv would silently fall back to the shared .venv.
srun --ntasks-per-node=1 bash -c 'cd $PROJECT_DIR && { [ -f .env ] && source .env || true; } && uv sync --all-extras'
{% else %}
# Shared (NFS) venv: one sync on the batch node populates it for all nodes.
uv sync --all-extras
{% endif %}
# Print inference URLs
export HOSTNAMES=( $( scontrol show hostnames $SLURM_JOB_NODELIST ) )
+12 -2
View File
@@ -41,8 +41,8 @@ export NUM_PREFILL_NODES={{ num_prefill_nodes }}
export NUM_DECODE_NODES={{ num_decode_nodes }}
export NUM_PREFILL_REPLICAS={{ num_prefill_replicas }}
export NUM_DECODE_REPLICAS={{ num_decode_replicas }}
export NODES_PER_PREFILL_REPLICA=$((NUM_PREFILL_NODES / NUM_PREFILL_REPLICAS))
export NODES_PER_DECODE_REPLICA=$((NUM_DECODE_NODES / NUM_DECODE_REPLICAS))
export NODES_PER_PREFILL_REPLICA={{ prefill_nodes_per_replica }}
export NODES_PER_DECODE_REPLICA={{ decode_nodes_per_replica }}
export PREFILL_PORT={{ prefill_port }}
export DECODE_PORT={{ decode_port }}
{%- if router.type == "llm-d" %}
@@ -144,7 +144,17 @@ echo "MASTER_PORT=${MASTER_PORT}"
cd $PROJECT_DIR
[ -f .env ] && source .env
source .venv/bin/activate
{% if not shared_fs %}
# Node-local venv (e.g. UV_PROJECT_ENVIRONMENT on /tmp): a bare `uv sync` would only
# build the batch node, so srun runs it on every node (one task each) and blocks until
# all finish. `set -e` above aborts the job if any node's sync fails. Re-source .env
# inside the task because unexported vars in .env don't cross srun even with normal
# SLURM env propagation; otherwise uv would silently fall back to the shared .venv.
srun --ntasks-per-node=1 bash -c 'cd $PROJECT_DIR && { [ -f .env ] && source .env || true; } && uv sync --all-extras'
{% else %}
# Shared (NFS) venv: one sync on the batch node populates it for all nodes.
uv sync --all-extras
{% endif %}
{% if pre_run_command %}
# Pre-run command
@@ -48,9 +48,17 @@ echo "MASTER_PORT=${MASTER_PORT}"
# Install environment
[ -f $PROJECT_DIR/.env ] && source $PROJECT_DIR/.env
source $PROJECT_DIR/.venv/bin/activate
# Install environment as local package
{% if not shared_fs %}
# Node-local venv (e.g. UV_PROJECT_ENVIRONMENT on /tmp): a bare `uv sync` would only
# build the batch node, so srun runs it on every node (one task each) and blocks until
# all finish. `set -e` above aborts the job if any node's sync fails. Re-source .env
# inside the task because unexported vars in .env don't cross srun even with normal
# SLURM env propagation; otherwise uv would silently fall back to the shared .venv.
srun --ntasks-per-node=1 bash -c 'cd $PROJECT_DIR && { [ -f .env ] && source .env || true; } && uv sync --all-extras'
{% else %}
# Shared (NFS) venv: one sync on the batch node populates it for all nodes.
cd $PROJECT_DIR && uv sync --all-extras
{% endif %}
{% if pre_run_command %}
+47 -3
View File
@@ -45,7 +45,7 @@ from prime_rl.trainer.models.layers.checkpointing import (
)
from prime_rl.trainer.models.layers.fp8_linear import replace_linear_with_fp8_blockwise_linear
from prime_rl.trainer.models.layers.lm_head import inject_prime_lm_head
from prime_rl.trainer.models.layers.moe import LatentMoE, MoE
from prime_rl.trainer.models.layers.moe import LatentMoE, MoE, TokenChoiceTopKRouter
from prime_rl.trainer.parallel_dims import ParallelDims
from prime_rl.trainer.weights import (
load_state_dict,
@@ -351,6 +351,29 @@ def freeze_moe_router(model: nn.Module) -> None:
logger.info(f"Froze {num_frozen} MoE router parameters")
def apply_fp32_moe_router(model: nn.Module) -> None:
"""Cast MoE router gates to fp32 so routing runs in fp32 in forward and backward.
The FSDP bf16 cast exemption is applied separately in `setup_fsdp`.
"""
logger = get_logger()
language_model = get_language_model(model)
num_routers = 0
for layer in language_model.layers:
mlp = layer.mlp if hasattr(layer, "mlp") else layer.feed_forward if hasattr(layer, "feed_forward") else None
if isinstance(mlp, (MoE, LatentMoE)):
mlp.router.to(torch.float32)
if isinstance(mlp.router, TokenChoiceTopKRouter):
mlp.router.fp32_gate = True
num_routers += 1
# No-op for non-MoE and HF-impl models: moe_router_dtype='float32' is the default,
# so absence of custom-impl MoE routers is the common case, not an error.
if num_routers > 0:
logger.info(f"Running {num_routers} MoE router gates in fp32")
def freeze_sparse_indexer(model: nn.Module) -> None:
"""Freeze DSA sparse-attention indexer parameters.
@@ -681,6 +704,17 @@ def setup_fsdp(model: nn.Module, config: ModelConfig, parallel_dims: ParallelDim
block_mlp.experts.set_gradient_divide_factor(parallel_dims.fsdp_gradient_divide_factor)
if config.moe_router_dtype == "float32" and isinstance(block_mlp, (MoE, LatentMoE)):
# Own FSDP unit with an fp32 policy so the gate weight is not cast to
# bf16 for forward and its gradients reduce in fp32.
fully_shard(
block_mlp.router,
mesh=hsdp_mesh,
mp_policy=MixedPrecisionPolicy(param_dtype=torch.float32, reduce_dtype=torch.float32),
offload_policy=offload_policy,
reshard_after_forward=config.reshard_after_forward,
)
fully_shard(
transformer_block,
mesh=hsdp_mesh,
@@ -734,7 +768,11 @@ def setup_fsdp(model: nn.Module, config: ModelConfig, parallel_dims: ParallelDim
if next_transformer_block is not None:
next_mlp = getattr(next_transformer_block, "mlp", None)
if next_mlp is not None and isinstance(next_mlp, (MoE, LatentMoE)):
transformer_block.set_modules_to_forward_prefetch([next_transformer_block, next_mlp.experts])
prefetch_modules = [next_transformer_block]
if isinstance(next_mlp.router, FSDPModule):
prefetch_modules.append(next_mlp.router)
prefetch_modules.append(next_mlp.experts)
transformer_block.set_modules_to_forward_prefetch(prefetch_modules)
else:
transformer_block.set_modules_to_forward_prefetch([next_transformer_block])
elif language_model.norm is not None and model.lm_head is not None:
@@ -755,7 +793,10 @@ def setup_fsdp(model: nn.Module, config: ModelConfig, parallel_dims: ParallelDim
if prev_transformer_block is not None:
prev_mlp = getattr(prev_transformer_block, "mlp", None)
if prev_mlp is not None and isinstance(prev_mlp, (MoE, LatentMoE)):
transformer_block.set_modules_to_backward_prefetch([prev_transformer_block, prev_mlp.experts])
prefetch_modules = [prev_transformer_block, prev_mlp.experts]
if isinstance(prev_mlp.router, FSDPModule):
prefetch_modules.append(prev_mlp.router)
transformer_block.set_modules_to_backward_prefetch(prefetch_modules)
else:
transformer_block.set_modules_to_backward_prefetch([prev_transformer_block])
elif embed_module is not None:
@@ -1111,6 +1152,9 @@ def setup_model(
if config.freeze_moe_router:
freeze_moe_router(model)
if config.moe_router_dtype == "float32":
apply_fp32_moe_router(model)
# The DSA sparse-attention indexer runs its forward under torch.no_grad(), so it is
# never trainable. Freeze it so optimizer state stays symmetric across checkpoint
# save/resume. No-op for models without a sparse indexer.
+4 -1
View File
@@ -426,6 +426,9 @@ class TokenChoiceTopKRouter(nn.Module):
self.route_norm = route_norm
self.route_scale = route_scale
self.force_balanced = False
# Set via model.moe_router_dtype='float32': the gate weight is kept in fp32
# (exempt from FSDP bf16 casting) and the gate GEMM runs in fp32.
self.fp32_gate = False
def forward(
self, x: torch.Tensor, expert_bias: torch.Tensor | None = None, routed_experts: torch.Tensor | None = None
@@ -452,7 +455,7 @@ class TokenChoiceTopKRouter(nn.Module):
assert routed_experts is None or routed_experts.shape[-1] == self.top_k, (
f"routed_experts shape: {routed_experts.shape}, top_k: {self.top_k}"
)
scores = self.gate(x)
scores = self.gate(x.to(torch.float32)) if self.fp32_gate else self.gate(x)
# By default, sigmoid or softmax is performed in float32 to avoid loss explosion
if self.score_func == "sigmoid":
+3 -1
View File
@@ -116,7 +116,9 @@ class MultiCheckpointManager:
scheduler: "MultiLoRAScheduler",
) -> None:
for idx in self.multi_run_manager.used_idxs:
step = self.multi_run_manager.progress[idx].step
# pack() already advanced progress to the next step, so the step just finished
# (and its broadcasts/step_{step} weights) is progress - 1.
step = self.multi_run_manager.progress[idx].step - 1
if not self._should_save(idx, step):
continue
@@ -68,9 +68,11 @@ class FileSystemWeightBroadcast(WeightBroadcast):
# TODO: Broadcast ready to update in sync, then we dont need to gather on not ready
if self.world.is_master:
try:
# pack() already advanced progress to the next step, so the model we just
# trained — policy v(step-1) — broadcasts to broadcasts/step_{step-1}.
save_dir = get_step_path(
get_broadcast_dir(self.multi_run_manager.get_run_dir(idx)),
self.multi_run_manager.progress[idx].step,
self.multi_run_manager.progress[idx].step - 1,
)
save_dir.mkdir(parents=True, exist_ok=True)
@@ -112,6 +114,6 @@ class FileSystemWeightBroadcast(WeightBroadcast):
for idx in self.multi_run_manager.used_idxs:
maybe_clean(
get_broadcast_dir(self.multi_run_manager.get_run_dir(idx)),
self.multi_run_manager.progress[idx].step,
self.multi_run_manager.progress[idx].step - 1,
interval_to_keep,
)
+3 -1
View File
@@ -224,9 +224,11 @@ class NCCLWeightBroadcast(WeightBroadcast):
if not self.multi_run_manager.ready_to_update[idx]:
continue
try:
# pack() already advanced progress to the next step, so the model we just
# trained — policy v(step-1) — broadcasts to broadcasts/step_{step-1}.
save_dir = get_step_path(
get_broadcast_dir(self.multi_run_manager.get_run_dir(idx)),
self.multi_run_manager.progress[idx].step,
self.multi_run_manager.progress[idx].step - 1,
)
notified_runs.append((idx, save_dir))
except FileNotFoundError:
+69 -71
View File
@@ -222,6 +222,8 @@ def train(config: TrainerConfig):
progress = Progress()
if checkpoint_step is not None:
ckpt_manager.load(checkpoint_step, model, [optimizer], scheduler, progress)
# The checkpoint finished step ``checkpoint_step``; resume training at the next step.
progress.step += 1
logger.info(f"Resuming training from checkpoint step {checkpoint_step}")
logger.info(
@@ -248,7 +250,6 @@ def train(config: TrainerConfig):
gc_handler = GarbageCollection(config.gc.interval) if config.gc else None
logger.info(f"Starting training loop (max_steps={config.max_steps or 'infinite'})")
is_first_step = True
maybe_record_function = nullcontext
if config.trace_path:
logger.info(f"Tracing to {config.trace_path}")
@@ -261,73 +262,6 @@ def train(config: TrainerConfig):
gc_handler.run(progress.step)
is_last_step = config.max_steps is not None and progress.step == config.max_steps
# Broadcast weights every step except:
# - step 0: nothing has changed yet, the orchestrator has the base model.
# - the final NCCL broadcast: with a 1-step async barrier the orchestrator's last step
# uses the trainer's penultimate ckpt, so the trainer's last broadcast has no receiver
# (the inference NCCL group has been torn down). Filesystem broadcast still writes the
# final step so we can resume from the broadcast directory.
if weight_broadcast is None:
broadcast_weights_time = 0
else:
nccl_broadcast_unused = (
config.weight_broadcast.type == "nccl"
and config.max_steps is not None
and progress.step >= config.max_steps - 1
)
if progress.step > 0 and not nccl_broadcast_unused:
broadcast_weights_start_time = time.perf_counter()
weight_broadcast.broadcast_weights(model, step=progress.step)
broadcast_weights_time = time.perf_counter() - broadcast_weights_start_time
# Clean up old broadcast directories (unless at ckpt interval if using filesystem weight broadcast)
if config.weight_broadcast.type == "filesystem":
interval_to_keep = config.ckpt and config.ckpt.interval
weight_broadcast.maybe_clean(interval_to_keep)
else:
broadcast_weights_time = 0
# Usually the broadcast will set this. If broadcast is skipped, we need to reset this here.
for idx in multi_run_manager.used_idxs:
multi_run_manager.ready_to_update[idx] = False
if config.max_concurrent_runs > 1:
# Multi-run: Save per-run checkpoints using each run's orchestrator config.
# Trainer-level ckpt config can be set by the combined rl entrypoint,
# but MultiCheckpointManager has a different save signature.
save_ckpt_start_time = time.perf_counter()
ckpt_manager.save(optimizer, scheduler)
save_ckpt_time = time.perf_counter() - save_ckpt_start_time
ckpt_manager.maybe_clean()
elif (
ckpt_manager is not None
and (config.ckpt and config.ckpt.interval)
and not (is_first_step or is_last_step)
and progress.step % config.ckpt.interval == 0
):
save_ckpt_time = 0
if not config.ckpt.weights_only:
# Single-run: Save full checkpoint
logger.info(f"Saving checkpoint at step {progress.step}")
save_ckpt_start_time = time.perf_counter()
ckpt_manager.save(progress.step, model, [optimizer], scheduler, progress)
save_ckpt_time += time.perf_counter() - save_ckpt_start_time
ckpt_manager.maybe_clean()
# Save weight checkpoint
if weight_ckpt_manager is not None:
logger.info(f"Saving weight checkpoint at step {progress.step}")
save_ckpt_start_time = time.perf_counter()
weight_ckpt_manager.save(progress.step, model, tokenizer)
save_ckpt_time += time.perf_counter() - save_ckpt_start_time
weight_ckpt_manager.maybe_clean()
else:
save_ckpt_time = 0
# Break if we have reached the maximum number of steps
if config.max_steps is not None and progress.step >= config.max_steps:
break
logger.debug(f"Starting training step {progress.step}")
step_start_time = time.perf_counter()
@@ -620,6 +554,69 @@ def train(config: TrainerConfig):
current_lr = optimizer.get_current_lr()
forward_backward_time = time.perf_counter() - forward_backward_start_time
# Broadcast the model just produced (policy v{progress.step}) so the orchestrator can
# sample its next step from it. Skip the final NCCL broadcasts: with a 1-step async barrier
# the orchestrator's last step uses the trainer's penultimate ckpt, so they have no receiver
# (the inference NCCL group is torn down). Filesystem broadcast still writes them so we can
# resume from the broadcast directory.
if weight_broadcast is None:
broadcast_weights_time = 0
else:
nccl_broadcast_unused = (
config.weight_broadcast.type == "nccl"
and config.max_steps is not None
and progress.step >= config.max_steps - 1
)
if not nccl_broadcast_unused:
broadcast_weights_start_time = time.perf_counter()
weight_broadcast.broadcast_weights(model, step=progress.step)
broadcast_weights_time = time.perf_counter() - broadcast_weights_start_time
# Clean up old broadcast directories (unless at ckpt interval if using filesystem weight broadcast)
if config.weight_broadcast.type == "filesystem":
interval_to_keep = config.ckpt and config.ckpt.interval
weight_broadcast.maybe_clean(interval_to_keep)
else:
broadcast_weights_time = 0
# Usually the broadcast will set this. If broadcast is skipped, we need to reset this here.
for idx in multi_run_manager.used_idxs:
multi_run_manager.ready_to_update[idx] = False
# Checkpoint the step we just finished (model = policy v{progress.step}).
if config.max_concurrent_runs > 1:
# Multi-run: save per-run checkpoints every step (interval-gated inside
# MultiCheckpointManager); there is no after-loop final save for multi-run.
save_ckpt_start_time = time.perf_counter()
ckpt_manager.save(optimizer, scheduler)
save_ckpt_time = time.perf_counter() - save_ckpt_start_time
ckpt_manager.maybe_clean()
elif (
ckpt_manager is not None
and (config.ckpt and config.ckpt.interval)
# the last step is written once after the loop (final ckpt), so skip it here
and not is_last_step
and progress.step % config.ckpt.interval == 0
):
save_ckpt_time = 0
if not config.ckpt.weights_only:
# Single-run: Save full checkpoint
logger.info(f"Saving checkpoint at step {progress.step}")
save_ckpt_start_time = time.perf_counter()
ckpt_manager.save(progress.step, model, [optimizer], scheduler, progress)
save_ckpt_time += time.perf_counter() - save_ckpt_start_time
ckpt_manager.maybe_clean()
# Save weight checkpoint
if weight_ckpt_manager is not None:
logger.info(f"Saving weight checkpoint at step {progress.step}")
save_ckpt_start_time = time.perf_counter()
weight_ckpt_manager.save(progress.step, model, tokenizer)
save_ckpt_time += time.perf_counter() - save_ckpt_start_time
weight_ckpt_manager.maybe_clean()
else:
save_ckpt_time = 0
# Optionally, dump memory snapshot
if memory_profiler is not None:
memory_profiler.step()
@@ -737,13 +734,14 @@ def train(config: TrainerConfig):
run_stats=run_stats,
)
progress.step += 1
is_first_step = False
# Send heartbeat if configured
if heart is not None:
heart.beat()
if is_last_step:
break
progress.step += 1
if config.trace_path:
prof.__exit__(None, None, None)
config.trace_path.mkdir(parents=True, exist_ok=True)
+5 -4
View File
@@ -20,7 +20,7 @@ if TYPE_CHECKING:
@dataclass
class Progress:
step: int = 0
step: int = 1
total_tokens: int = 0
total_samples: int = 0
@@ -278,16 +278,17 @@ class MultiRunManager:
# Set progress based on resume_step config (match orchestrator behavior)
self.progress[new_id] = Progress()
# ``step_S`` means step S finished; resume continues at S+1.
if config.ckpt is None or config.ckpt.resume_step is None:
self.progress[new_id].step = 0
self.progress[new_id].step = 1
elif config.ckpt.resume_step == -1:
ckpt_dir = self.get_run_dir(new_id) / "checkpoints"
# In multi-run, the trainer writes STABLE after saving LoRA weights to the run's checkpoint dir.
# In single-run, only the orchestrator writes checkpoints here (trainer has its own dir), so no STABLE exists.
steps = get_stable_ckpt_steps(ckpt_dir) if self.max_runs > 1 else get_all_ckpt_steps(ckpt_dir)
self.progress[new_id].step = max(steps) if steps else 0
self.progress[new_id].step = max(steps) + 1 if steps else 1
else:
self.progress[new_id].step = config.ckpt.resume_step
self.progress[new_id].step = config.ckpt.resume_step + 1
# Store the parsed config
self.config[new_id] = config
+36 -32
View File
@@ -215,6 +215,9 @@ def train(config: SFTConfig):
dataloader=dataloader if not config.ckpt.skip_dataloader else None,
)
logger.info(f"Resuming training from checkpoint step {checkpoint_step}")
# The checkpoint finished step ``checkpoint_step``; resume training at the next step.
if not config.ckpt.skip_progress:
progress.step += 1
# This redundant setup is necessary because loading the optimizer's state has side effects on the scheduler state dict
if config.ckpt.skip_scheduler:
scheduler = setup_scheduler(optimizer, config.scheduler, scheduler_steps, config.optim.lr)
@@ -347,37 +350,6 @@ def train(config: SFTConfig):
gc_handler.run(progress.step)
is_last_step = config.max_steps is not None and progress.step == config.max_steps
if (
ckpt_manager is not None
and (config.ckpt and config.ckpt.interval)
and not (is_first_step or is_last_step)
and progress.step % config.ckpt.interval == 0
):
save_ckpt_time = 0
if not config.ckpt.weights_only:
# Save full checkpoint
logger.info(f"Saving checkpoint at step {progress.step}")
save_ckpt_start_time = time.perf_counter()
ckpt_manager.save(progress.step, model, [optimizer], scheduler, progress, dataloader=dataloader)
save_ckpt_time += time.perf_counter() - save_ckpt_start_time
ckpt_manager.maybe_clean()
# Save weight checkpoint
if weight_ckpt_manager is not None:
logger.info(f"Saving weight checkpoint at step {progress.step}")
save_ckpt_start_time = time.perf_counter()
weight_ckpt_manager.save(progress.step, model, tokenizer)
save_ckpt_time += time.perf_counter() - save_ckpt_start_time
weight_ckpt_manager.maybe_clean()
else:
save_ckpt_time = 0
# Break if we have reached the maximum number of steps
if config.max_steps is not None and progress.step >= config.max_steps:
break
memory_profiler = (
MemoryProfiler(progress.step, config.memory_profiler_path) if config.memory_profiler_path else None
)
@@ -482,6 +454,35 @@ def train(config: SFTConfig):
current_lr = optimizer.param_groups[0]["lr"]
scheduler.step()
# Checkpoint the step we just finished. The last step's checkpoint is written once after
# the loop, so skip it here to avoid a double-save.
if (
ckpt_manager is not None
and (config.ckpt and config.ckpt.interval)
and not is_last_step
and progress.step % config.ckpt.interval == 0
):
save_ckpt_time = 0
if not config.ckpt.weights_only:
# Save full checkpoint
logger.info(f"Saving checkpoint at step {progress.step}")
save_ckpt_start_time = time.perf_counter()
ckpt_manager.save(progress.step, model, [optimizer], scheduler, progress, dataloader=dataloader)
save_ckpt_time += time.perf_counter() - save_ckpt_start_time
ckpt_manager.maybe_clean()
# Save weight checkpoint
if weight_ckpt_manager is not None:
logger.info(f"Saving weight checkpoint at step {progress.step}")
save_ckpt_start_time = time.perf_counter()
weight_ckpt_manager.save(progress.step, model, tokenizer)
save_ckpt_time += time.perf_counter() - save_ckpt_start_time
weight_ckpt_manager.maybe_clean()
else:
save_ckpt_time = 0
# Optionally, dump memory snapshot
if memory_profiler is not None:
memory_profiler.step()
@@ -585,12 +586,15 @@ def train(config: SFTConfig):
monitor.log({**moe_log_metrics, "step": progress.step}, step=progress.step)
is_first_step = False
progress.step += 1
# Send heartbeat if configured
if heart is not None:
heart.beat()
if is_last_step:
break
progress.step += 1
if config.trace_path:
prof.__exit__(None, None, None)
config.trace_path.mkdir(parents=True, exist_ok=True)
+4
View File
@@ -38,6 +38,8 @@ def setup_monitor(
*,
prime_config: PrimeMonitorConfig | None = None,
keep_full_history: bool = True,
train_env_names: list[str] = [],
eval_env_names: list[str] = [],
# Backward compatibility: support old 'config' keyword argument
config: WandbWithExtrasConfig | None = None,
) -> Monitor:
@@ -65,6 +67,8 @@ def setup_monitor(
tokenizer=tokenizer,
run_config=run_config,
keep_full_history=keep_full_history,
train_env_names=train_env_names,
eval_env_names=eval_env_names,
)
)
+184
View File
@@ -2,15 +2,20 @@ from __future__ import annotations
import json
import os
import re
import sys
import time
from collections.abc import Sequence
from pathlib import Path
from typing import TYPE_CHECKING, Any
import wandb
import wandb_workspaces.reports.v2 as wr
import wandb_workspaces.workspaces as ws
from transformers.tokenization_utils import PreTrainedTokenizer
from wandb.errors import CommError
from wandb.sdk.mailbox.mailbox_handle import ServerResponseError
from wandb_gql import gql
from prime_rl.configs.shared import WandbConfig, WandbWithExtrasConfig
from prime_rl.utils.config import BaseConfig
@@ -48,6 +53,8 @@ class WandbMonitor(Monitor):
tokenizer: PreTrainedTokenizer | None = None,
run_config: BaseConfig | None = None,
keep_full_history: bool = True,
train_env_names: list[str] = [],
eval_env_names: list[str] = [],
):
self.config = config
self.logger = get_logger()
@@ -82,11 +89,13 @@ class WandbMonitor(Monitor):
x_update_finish_state=primary,
)
self.logger.info(f"Using shared W&B mode ({label=}, {primary=})")
is_online = True
else:
run_id = None
primary = False
mode = os.environ.get("WANDB_MODE", "offline" if config.offline else "online")
settings = wandb.Settings(mode=mode)
is_online = mode == "online"
retryable_errors = (CommError, ServerResponseError) if shared_mode else (CommError,)
@@ -129,6 +138,22 @@ class WandbMonitor(Monitor):
wandb.define_metric("*", step_metric="step")
# Provision the curated "overview" saved view once per project (the run's primary process
# in shared mode, else the single master). Best-effort: a workspaces/API failure must never
# take down training.
if is_online and (primary if shared_mode else True):
try:
url = ensure_overview_view(
self.wandb.entity,
self.wandb.project,
train_envs=train_env_names,
eval_envs=eval_env_names,
)
if url:
self.logger.info(f"Created W&B overview view - {url}")
except Exception as e:
self.logger.warning(f"Failed to create W&B overview view - {e}")
# Optionally, initialize sample logging attributes
if config is not None and isinstance(config, WandbWithExtrasConfig) and config.log_extras:
if config.log_extras.samples:
@@ -262,3 +287,162 @@ class WandbMonitor(Monitor):
dir_path.mkdir(parents=True, exist_ok=True)
with open(dir_path / filename, "w") as f:
json.dump(wandb.summary._as_dict(), f)
# --- curated "overview" saved view -------------------------------------------------------------
# prime-rl logs many metrics; the default workspace auto-generates a panel per key, which buries the
# few that matter. These build a named saved view grouping the important metrics into sections, so a
# new project gets a usable overview without hand-picking panels. Panels are untitled — each shows
# its raw metric name.
OVERVIEW_NAME = "overview"
# Per-rollout metrics (under "<scope>/all/") shown for BOTH train and eval. Only the reward metric
# differs — train uses "reward/mean", eval uses "avg@k" — and each section builder prepends its own.
COMMON_METRICS = [
"has_error/mean",
"is_truncated/mean",
"num_total_tokens/mean",
"num_turns/mean",
"num_branches/mean",
]
STABILITY_METRICS = ["optim/grad_norm", "entropy/all/mean", "mismatch_kl/all/mean", "kl_ent_ratio/mean"]
PERFORMANCE_METRICS = [
"perf/mfu",
"time/step",
"time/wait_for_batch",
"time/wait_for_policy",
"inference/agg/throughput",
"inference/agg/running_requests",
"inference/agg/waiting_requests",
"inference/agg/kv_cache_usage_mean",
"inference/agg/prefix_cache_hit_rate",
]
# Dense grid: more, smaller panels per row and enough rows that sections don't paginate.
COLUMNS = 4
ROWS = 6
def line_panels(metrics: Sequence[str], regexes: Sequence[str]) -> list[wr.LinePlot]:
# inference/* is logged against wall time (step_metric="_timestamp") → "WallTime" (== W&B's
# "_timestamp"); everything else on "step" (prime-rl's logged training step, not internal "Step").
# x is set per-panel because LinePlot defaults it to "Step", which overrides the workspace x_axis.
return [wr.LinePlot(x="WallTime" if m.startswith("inference/") else "step", y=[m]) for m in metrics] + [
wr.LinePlot(x="step", metric_regex=r) for r in regexes
]
def section(name: str, metrics: Sequence[str] = (), regexes: Sequence[str] = ()) -> ws.Section:
return ws.Section(
name=name,
is_open=True,
panels=line_panels(metrics, regexes),
layout_settings=ws.SectionLayoutSettings(columns=COLUMNS, rows=ROWS),
)
def train_section(name: str, scope: str) -> ws.Section:
return section(name, metrics=[f"{scope}/all/reward/mean"] + [f"{scope}/all/{m}" for m in COMMON_METRICS])
def eval_section(name: str, env_pattern: str) -> ws.Section:
# Same metrics as train, but eval's reward is "avg@k" (dynamic k → regex). Everything is a regex so
# one section can also serve any env (env_pattern=".*"). Only the "all" subset, like train.
return section(
name,
regexes=[f"eval/{env_pattern}/all/avg@.*"] + [f"eval/{env_pattern}/all/{m}" for m in COMMON_METRICS],
)
def build_sections(train_envs: Sequence[str] = (), eval_envs: Sequence[str] = ()) -> list[ws.Section]:
# With one env the aggregate == that env, so show only its section. With several, put the
# cross-env aggregate on top followed by a section per env.
if len(train_envs) == 1:
sections = [train_section(f"train/{train_envs[0]}", f"train/{train_envs[0]}")]
elif len(train_envs) > 1:
sections = [train_section("train/agg", "train/agg")]
sections += [train_section(f"train/{env}", f"train/{env}") for env in train_envs]
else:
# Env names unknown (e.g. SFT): fall back to the aggregate.
sections = [train_section("train", "train/agg")]
if eval_envs:
sections += [eval_section(f"eval/{env}", re.escape(env)) for env in eval_envs]
else:
# Env names unknown (e.g. SFT): one regex section matching any eval env.
sections.append(eval_section("eval", ".*"))
sections.append(section("stability", metrics=STABILITY_METRICS))
sections.append(section("performance", metrics=PERFORMANCE_METRICS))
return sections
def list_views(entity: str, project: str) -> list[tuple[str, str]]:
"""``(display_name, internal_name)`` for every saved view in the project."""
query = gql(
"""
query Views($entity: String!, $project: String!) {
project(name: $project, entityName: $entity) {
allViews(viewType: "project-view") { edges { node { name displayName } } }
}
}
"""
)
res = wandb.Api().client.execute(query, variable_values={"entity": entity, "project": project})
edges = ((res.get("project") or {}).get("allViews") or {}).get("edges") or []
return [(e["node"]["displayName"], e["node"]["name"]) for e in edges if e.get("node")]
def env_signature(train_envs: Sequence[str], eval_envs: Sequence[str]) -> tuple:
return (tuple(sorted(train_envs)), tuple(sorted(eval_envs)))
def view_env_signature(sections: Sequence[ws.Section]) -> tuple:
"""Reconstruct the ``(train, eval)`` env set a view was built for from its section names."""
train = sorted(s.name[len("train/") :] for s in sections if s.name.startswith("train/") and s.name != "train/agg")
evals = sorted(s.name[len("eval/") :] for s in sections if s.name.startswith("eval/"))
return (tuple(train), tuple(evals))
def next_overview_name(base: str, existing: Sequence[str]) -> str:
if base not in existing:
return base
prefix = f"{base}-v"
versions = [1] + [int(n[len(prefix) :]) for n in existing if n.startswith(prefix) and n[len(prefix) :].isdigit()]
return f"{base}-v{max(versions) + 1}"
def ensure_overview_view(
entity: str,
project: str,
name: str = OVERVIEW_NAME,
train_envs: Sequence[str] = (),
eval_envs: Sequence[str] = (),
) -> str | None:
"""Ensure an overview saved view exists for this run's env set. Reuses an existing overview built
for the same envs; when the env set is new, creates a fresh versioned view (``overview`` →
``overview-v2`` → …). Returns the URL of a newly created view, else None."""
target = env_signature(train_envs, eval_envs)
overviews = [(dn, iname) for dn, iname in list_views(entity, project) if dn == name or dn.startswith(f"{name}-v")]
for _, internal_name in overviews:
slug = internal_name.removeprefix("nw-").removesuffix("-v")
try:
existing = ws.Workspace.from_url(f"https://wandb.ai/{entity}/{project}?nw={slug}")
matches = view_env_signature(existing.sections) == target
except Exception as e:
# A single unreadable view must not abort reuse detection / versioning for the rest.
get_logger().warning(f"Could not inspect overview view {internal_name} - {e}")
continue
if matches:
return None
workspace = ws.Workspace(
entity=entity,
project=project,
name=next_overview_name(name, [dn for dn, _ in overviews]),
sections=build_sections(train_envs, eval_envs),
auto_generate_panels=False,
settings=ws.WorkspaceSettings(x_axis="step"),
)
workspace.save()
return workspace.url
+5 -4
View File
@@ -97,19 +97,20 @@ def test_packer_progress_updates_once_per_run(tmp_path: Path, monkeypatch: pytes
start_step=0,
)
packer.buffers[run_idx].append((make_training_sample(), 0))
packer.buffers[run_idx].append((make_training_sample(), 0))
# Steps are 1-indexed: a fresh run starts at step 1, so the first batch's samples carry step 1.
packer.buffers[run_idx].append((make_training_sample(), 1))
packer.buffers[run_idx].append((make_training_sample(), 1))
packer.pack()
progress = manager.progress[run_idx]
assert progress.total_samples == 2
assert progress.total_tokens == 4
assert progress.step == 1
assert progress.step == 2
sender = sender_holder["sender"]
assert len(sender.sent) == 1
assert len(sender.sent[0][0]) == 1
micro_batch = sender.sent[0][0][0]
assert micro_batch.run_id == "run_test123"
assert micro_batch.run_step == 0
assert micro_batch.run_step == 1
Generated
+155 -162
View File
@@ -76,7 +76,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev381" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -91,7 +91,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev381" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -106,7 +106,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev381" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -282,7 +282,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev389" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -294,6 +294,21 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/3b/00/2344469e2084fb287c2e0b57b72910309874c3245463acd6cf5e3db69324/appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128", size = 9566, upload-time = "2020-05-11T07:59:49.499Z" },
]
[[package]]
name = "arxivmath-v1"
version = "0.1.0"
source = { editable = "deps/research-environments/environments/arxivmath_v1" }
dependencies = [
{ name = "datasets" },
{ name = "verifiers" },
]
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
name = "astor"
version = "0.8.1"
@@ -408,7 +423,7 @@ dependencies = [
requires-dist = [
{ name = "httpx" },
{ name = "openai" },
{ name = "verifiers", specifier = ">=0.1.15.dev397" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
]
[[package]]
@@ -914,7 +929,7 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "openai" },
{ name = "verifiers", specifier = ">=0.1.15.dev397" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
]
[[package]]
@@ -1270,7 +1285,7 @@ dependencies = [
[[package]]
name = "flash-linear-attention"
version = "0.5.2"
source = { git = "https://github.com/fla-org/flash-linear-attention#bd67d11782696e4ff54ee6cb411483621ed3d93d" }
source = { git = "https://github.com/fla-org/flash-linear-attention#a95475391465272cd3dc11e47d4a7772522dc9b7" }
dependencies = [
{ name = "einops" },
{ name = "transformers" },
@@ -1342,7 +1357,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev381" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -1386,43 +1401,19 @@ http = [
{ name = "aiohttp" },
]
[[package]]
name = "general-agent"
version = "0.1.4"
source = { editable = "deps/research-environments/environments/general_agent" }
dependencies = [
{ name = "mcp" },
{ name = "tyro" },
{ name = "verifiers" },
]
[package.metadata]
requires-dist = [
{ name = "mcp", specifier = ">=1.0" },
{ name = "pytest", marker = "extra == 'test'" },
{ name = "pytest-asyncio", marker = "extra == 'test'" },
{ name = "ruff", marker = "extra == 'dev'" },
{ name = "ty", marker = "extra == 'dev'" },
{ name = "tyro", specifier = ">=0.9" },
{ name = "verifiers", extras = ["packages"], specifier = ">=0.1.15.dev17" },
]
provides-extras = ["dev", "test"]
[[package]]
name = "general-agent-v1"
version = "0.1.0"
source = { editable = "deps/research-environments/environments/general_agent_v1" }
dependencies = [
{ name = "filelock" },
{ name = "pydantic" },
{ name = "verifiers" },
{ name = "verifiers", extra = ["harbor"] },
]
[package.metadata]
requires-dist = [
{ name = "filelock" },
{ name = "pydantic" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", extras = ["harbor"], specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -1434,21 +1425,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/dc/b7/8c72dedbb950d88a6f64588fcbc590d2a21e2b9f19b36aa6c5016c54ec75/gepa-0.1.1-py3-none-any.whl", hash = "sha256:71ead7c591eafcc727b83509cdc4182f20264800a6ddf8520d61419daeb47466", size = 244246, upload-time = "2026-03-16T10:17:51.922Z" },
]
[[package]]
name = "gguf"
version = "0.19.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "numpy" },
{ name = "pyyaml" },
{ name = "requests" },
{ name = "tqdm" },
]
sdist = { url = "https://files.pythonhosted.org/packages/48/ae/17f1308ae45cd7b08ebb521747d5b23f4efc4d172038a4e228dd5106c3ff/gguf-0.19.0.tar.gz", hash = "sha256:dbadcd6cc7ccd44256f2229fe7c2dff5e8aa5cf0612ab987fd2b1a57e428923f", size = 111220, upload-time = "2026-05-06T13:04:03.667Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/b3/bb/d71d6da82763528c2c2ed6b59a9d6142c6595545a4c448e2085d155e88c2/gguf-0.19.0-py3-none-any.whl", hash = "sha256:70bcd10edfe697fb2dad6e40af2234b9d8ece9a41a99761405121ebda1c3c1cd", size = 118475, upload-time = "2026-05-06T13:04:02.588Z" },
]
[[package]]
name = "gitdb"
version = "4.0.12"
@@ -1555,7 +1531,7 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "openai" },
{ name = "verifiers", specifier = ">=0.1.15.dev397" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
]
[[package]]
@@ -1570,7 +1546,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev381" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -1773,7 +1749,7 @@ wheels = [
[[package]]
name = "humming-kernels"
version = "0.1.4"
version = "0.1.6"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "cuda-bindings" },
@@ -1787,9 +1763,9 @@ dependencies = [
{ name = "tqdm" },
{ name = "triton" },
]
sdist = { url = "https://files.pythonhosted.org/packages/f5/f6/05e95b66cca48def9db0d6c40374fe285c7d9c913fe126030bcfb7cb3088/humming_kernels-0.1.4.tar.gz", hash = "sha256:fdaf4f23cc6b03bb1be3fd24aa11dc7798881e5448826e2404b4f12d8096f0d0", size = 117555, upload-time = "2026-06-04T03:24:03.504Z" }
sdist = { url = "https://files.pythonhosted.org/packages/29/5a/fbf574dcd83e9fea6aa3fa96b37bbdec40b8672407b1ed9679efa31fff1d/humming_kernels-0.1.6.tar.gz", hash = "sha256:882b9f382a010165a7cf8eecbad943bfe8d6b17566328fb57611c9a34bdccc9a", size = 214408, upload-time = "2026-06-20T04:04:43.221Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/ba/16/d9318061a560305034e14cb7bf6483ffc8735eff6b30f260907dbbd4e85d/humming_kernels-0.1.4-py3-none-any.whl", hash = "sha256:c85094cd7cf8cdd959c5e2f7f239a7d72a7640ec1f948787434bc06e24e9ed00", size = 161312, upload-time = "2026-06-04T03:24:01.897Z" },
{ url = "https://files.pythonhosted.org/packages/25/85/490681b9ba24531da91d0bae801d2b26850e5a80bbd02c2efc500756e36b/humming_kernels-0.1.6-py3-none-any.whl", hash = "sha256:e64c0883fca930074bf920f4ba47cbf3acd244d7352f6c74c8d2182439770d8f", size = 178759, upload-time = "2026-06-20T04:04:41.66Z" },
]
[package.optional-dependencies]
@@ -1823,7 +1799,7 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "orjson" },
{ name = "verifiers", specifier = ">=0.1.15.dev389" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -1838,7 +1814,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev397" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
]
[[package]]
@@ -1887,7 +1863,7 @@ requires-dist = [
{ name = "setuptools", specifier = "<78" },
{ name = "spacy" },
{ name = "syllapy" },
{ name = "verifiers", specifier = ">=0.1.15.dev389" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -1908,7 +1884,7 @@ requires-dist = [
{ name = "immutabledict" },
{ name = "langdetect" },
{ name = "nltk" },
{ name = "verifiers", specifier = ">=0.1.15.dev389" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -2365,7 +2341,7 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "huggingface-hub" },
{ name = "verifiers", specifier = ">=0.1.15.dev382" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -2419,7 +2395,7 @@ requires-dist = [
{ name = "markdown", specifier = ">=3.5.1" },
{ name = "math-verify", specifier = ">=0.8.0" },
{ name = "sympy", specifier = ">=1.12.0" },
{ name = "verifiers", specifier = ">=0.1.15.dev17" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -2459,7 +2435,7 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "longcot", git = "https://github.com/LongHorizonReasoning/longcot.git?rev=6a569ab" },
{ name = "verifiers", specifier = ">=0.1.15.dev381" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -2476,7 +2452,7 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "longcot", git = "https://github.com/LongHorizonReasoning/longcot.git?rev=6a569ab" },
{ name = "verifiers", specifier = ">=0.1.15.dev381" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -2491,7 +2467,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets", specifier = ">=3.0" },
{ name = "verifiers", specifier = ">=0.1.15.dev381" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -2561,7 +2537,7 @@ dependencies = [
requires-dist = [
{ name = "math-verify", specifier = ">=0.8.0" },
{ name = "prime-sandboxes", specifier = ">=0.2.19" },
{ name = "verifiers", specifier = ">=0.1.15.dev17" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -2576,7 +2552,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev381" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -2620,7 +2596,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev381" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -2763,7 +2739,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev381" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -2837,7 +2813,7 @@ dependencies = [
requires-dist = [
{ name = "filelock" },
{ name = "httpx" },
{ name = "verifiers", specifier = ">=0.1.15.dev381" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -3350,7 +3326,7 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "huggingface-hub" },
{ name = "verifiers", specifier = ">=0.1.15.dev381" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -3367,7 +3343,7 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "openai" },
{ name = "verifiers", specifier = ">=0.1.15.dev397" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
]
[[package]]
@@ -3386,7 +3362,7 @@ requires-dist = [
{ name = "datasets" },
{ name = "openai" },
{ name = "python-dateutil" },
{ name = "verifiers", specifier = ">=0.1.15.dev397" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
]
[[package]]
@@ -3468,7 +3444,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
]
[[package]]
@@ -3605,7 +3581,7 @@ dependencies = [
]
[package.metadata]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev394" }]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev411" }]
[[package]]
name = "orderly-set"
@@ -3686,7 +3662,7 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "openai" },
{ name = "verifiers", specifier = ">=0.1.15.dev397" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
]
[[package]]
@@ -3728,7 +3704,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "nltk", specifier = ">=3.8" },
{ name = "verifiers", specifier = ">=0.1.15.dev389" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -3956,9 +3932,10 @@ dependencies = [
{ name = "transformers" },
{ name = "uvloop" },
{ name = "verifiers", extra = ["harbor"] },
{ name = "vllm", version = "0.23.0+cu129", source = { url = "https://github.com/vllm-project/vllm/releases/download/v0.23.0/vllm-0.23.0+cu129-cp38-abi3-manylinux_2_28_aarch64.whl" }, marker = "platform_machine != 'x86_64'" },
{ name = "vllm", version = "0.23.0+cu129", source = { url = "https://github.com/vllm-project/vllm/releases/download/v0.23.0/vllm-0.23.0+cu129-cp38-abi3-manylinux_2_28_x86_64.whl" }, marker = "platform_machine == 'x86_64'" },
{ name = "vllm", version = "0.24.0+cu129", source = { url = "https://github.com/vllm-project/vllm/releases/download/v0.24.0/vllm-0.24.0+cu129-cp38-abi3-manylinux_2_28_aarch64.whl" }, marker = "platform_machine != 'x86_64'" },
{ name = "vllm", version = "0.24.0+cu129", source = { url = "https://github.com/vllm-project/vllm/releases/download/v0.24.0/vllm-0.24.0+cu129-cp38-abi3-manylinux_2_28_x86_64.whl" }, marker = "platform_machine == 'x86_64'" },
{ name = "wandb" },
{ name = "wandb-workspaces" },
]
[package.optional-dependencies]
@@ -3987,13 +3964,13 @@ envs = [
{ name = "alphabet-sort" },
{ name = "alphabet-sort-v1" },
{ name = "apex-shortlist-v1" },
{ name = "arxivmath-v1" },
{ name = "browsecomp-v1" },
{ name = "code-golf-v1" },
{ name = "color-codeword-v1" },
{ name = "deepdive-v1" },
{ name = "deepwiki-v1" },
{ name = "forth-lang-v1" },
{ name = "general-agent" },
{ name = "general-agent-v1" },
{ name = "glossary-v1" },
{ name = "gpqa-v1" },
@@ -4027,7 +4004,7 @@ envs = [
{ name = "redsearcher-v1" },
{ name = "reverse-text" },
{ name = "reverse-text-v1" },
{ name = "rlm-search" },
{ name = "s1-deepresearch-v1" },
{ name = "scaleswe-v1" },
{ name = "simpleqa-v1" },
{ name = "simpleqa-verified-v1" },
@@ -4087,6 +4064,7 @@ requires-dist = [
{ name = "alphabet-sort", marker = "extra == 'envs'", editable = "deps/verifiers/environments/alphabet_sort" },
{ name = "alphabet-sort-v1", marker = "extra == 'envs'", editable = "deps/verifiers/environments/alphabet_sort_v1" },
{ name = "apex-shortlist-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/apex_shortlist_v1" },
{ name = "arxivmath-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/arxivmath_v1" },
{ name = "beartype", specifier = ">=0.21.0" },
{ name = "browsecomp-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/browsecomp_v1" },
{ name = "code-golf-v1", marker = "extra == 'envs'", editable = "deps/verifiers/environments/code_golf_v1" },
@@ -4102,7 +4080,6 @@ requires-dist = [
{ name = "flash-attn-4", marker = "extra == 'flash-attn-cute'", git = "https://github.com/Dao-AILab/flash-attention.git?subdirectory=flash_attn%2Fcute&rev=96bd151" },
{ name = "flash-linear-attention", git = "https://github.com/fla-org/flash-linear-attention" },
{ name = "forth-lang-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/forth_lang_v1" },
{ name = "general-agent", marker = "extra == 'envs'", editable = "deps/research-environments/environments/general_agent" },
{ name = "general-agent-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/general_agent_v1" },
{ name = "glossary-v1", marker = "extra == 'envs'", editable = "deps/verifiers/environments/glossary_v1" },
{ name = "gpqa-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/gpqa_v1" },
@@ -4159,21 +4136,21 @@ requires-dist = [
{ name = "pybase64", specifier = ">=1.4.2" },
{ name = "pyzmq", specifier = ">=27.1.0" },
{ name = "quack-kernels", marker = "extra == 'quack'", specifier = ">=0.4.1" },
{ name = "r2e-gym-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/r2e_gym_v1" },
{ name = "r2e-gym-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/swe/r2e_gym_v1" },
{ name = "redsearcher-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/redsearcher_v1" },
{ name = "renderers", editable = "deps/renderers" },
{ name = "reverse-text", marker = "extra == 'envs'", editable = "deps/verifiers/environments/reverse_text" },
{ name = "reverse-text-v1", marker = "extra == 'envs'", editable = "deps/verifiers/environments/reverse_text_v1" },
{ name = "rich", specifier = ">=14.0.0" },
{ name = "ring-flash-attn", specifier = ">=0.1.8" },
{ name = "rlm-search", marker = "extra == 'envs'", editable = "deps/research-environments/environments/rlm_search" },
{ name = "scaleswe-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/scaleswe_v1" },
{ name = "s1-deepresearch-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/s1_deepresearch_v1" },
{ name = "scaleswe-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/swe/scaleswe_v1" },
{ name = "setproctitle", specifier = ">=1.3.0" },
{ name = "simpleqa-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/simpleqa_v1" },
{ name = "simpleqa-verified-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/simpleqa_verified_v1" },
{ name = "swebench-pro-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/swebench_pro_v1" },
{ name = "swebench-verified-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/swebench_verified_v1" },
{ name = "swelego-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/swelego_v1" },
{ name = "swebench-pro-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/swe/swebench_pro_v1" },
{ name = "swebench-verified-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/swe/swebench_verified_v1" },
{ name = "swelego-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/swe/swelego_v1" },
{ name = "tau2-bench-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/tau2_bench_v1" },
{ name = "tenacity", specifier = ">=8.2.0" },
{ name = "terminal-bench-2-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/terminal_bench_2_v1" },
@@ -4181,7 +4158,7 @@ requires-dist = [
{ name = "torch", specifier = ">=2.9.0", index = "https://download.pytorch.org/whl/cu128" },
{ name = "torchaudio", index = "https://download.pytorch.org/whl/cu128" },
{ name = "torchdata", specifier = ">=0.11.0" },
{ name = "torchtitan", git = "https://github.com/pytorch/torchtitan?rev=a1fdd7e" },
{ name = "torchtitan", git = "https://github.com/pytorch/torchtitan?rev=23e4dfc" },
{ name = "torchvision", index = "https://download.pytorch.org/whl/cu128" },
{ name = "transformers", specifier = "==5.6.2" },
{ name = "unscramble-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/unscramble_v1" },
@@ -4189,11 +4166,12 @@ requires-dist = [
{ name = "uvloop", specifier = ">=0.21.0" },
{ name = "verbatim-copy-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/verbatim_copy_v1" },
{ name = "verifiers", extras = ["harbor"], editable = "deps/verifiers" },
{ name = "vllm", marker = "platform_machine != 'aarch64' and platform_machine != 'x86_64'", specifier = ">=0.23.0" },
{ name = "vllm", marker = "platform_machine == 'aarch64'", url = "https://github.com/vllm-project/vllm/releases/download/v0.23.0/vllm-0.23.0+cu129-cp38-abi3-manylinux_2_28_aarch64.whl" },
{ name = "vllm", marker = "platform_machine == 'x86_64'", url = "https://github.com/vllm-project/vllm/releases/download/v0.23.0/vllm-0.23.0+cu129-cp38-abi3-manylinux_2_28_x86_64.whl" },
{ name = "vllm", marker = "platform_machine != 'aarch64' and platform_machine != 'x86_64'", specifier = ">=0.24.0" },
{ name = "vllm", marker = "platform_machine == 'aarch64'", url = "https://github.com/vllm-project/vllm/releases/download/v0.24.0/vllm-0.24.0+cu129-cp38-abi3-manylinux_2_28_aarch64.whl" },
{ name = "vllm", marker = "platform_machine == 'x86_64'", url = "https://github.com/vllm-project/vllm/releases/download/v0.24.0/vllm-0.24.0+cu129-cp38-abi3-manylinux_2_28_x86_64.whl" },
{ name = "vllm-router", marker = "platform_machine == 'x86_64' and extra == 'disagg'", url = "https://github.com/PrimeIntellect-ai/router/releases/download/v0.1.26/vllm_router-0.1.26-cp38-abi3-manylinux_2_28_x86_64.whl" },
{ name = "wandb", specifier = ">=0.26.1" },
{ name = "wandb-workspaces", specifier = ">=0.4.3" },
{ name = "wideseek-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/wideseek_v1" },
{ name = "wiki-search", marker = "extra == 'envs'", editable = "deps/verifiers/environments/wiki_search" },
{ name = "wiki-search-v1", marker = "extra == 'envs'", editable = "deps/verifiers/environments/wiki_search_v1" },
@@ -4290,15 +4268,15 @@ wheels = [
[[package]]
name = "prometheus-fastapi-instrumentator"
version = "7.1.0"
version = "8.0.2"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "prometheus-client" },
{ name = "starlette" },
]
sdist = { url = "https://files.pythonhosted.org/packages/69/6d/24d53033cf93826aa7857699a4450c1c67e5b9c710e925b1ed2b320c04df/prometheus_fastapi_instrumentator-7.1.0.tar.gz", hash = "sha256:be7cd61eeea4e5912aeccb4261c6631b3f227d8924542d79eaf5af3f439cbe5e", size = 20220, upload-time = "2025-03-19T19:35:05.351Z" }
sdist = { url = "https://files.pythonhosted.org/packages/1b/e9/2065686d1dfa62296fdc158b6e8fd25b0cb3dca09b0632cabeb5ae81fe4d/prometheus_fastapi_instrumentator-8.0.2.tar.gz", hash = "sha256:3c252e748151768a7aefd66824a04a870144f71de48a67aed211749a9ca2a548", size = 21342, upload-time = "2026-06-23T09:39:31.611Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/27/72/0824c18f3bc75810f55dacc2dd933f6ec829771180245ae3cc976195dec0/prometheus_fastapi_instrumentator-7.1.0-py3-none-any.whl", hash = "sha256:978130f3c0bb7b8ebcc90d35516a6fe13e02d2eb358c8f83887cdef7020c31e9", size = 19296, upload-time = "2025-03-19T19:35:04.323Z" },
{ url = "https://files.pythonhosted.org/packages/c6/c7/fa2b3f469a2e6001b829e0d6bc8680755349aa1329a87bf48731e9d5d30a/prometheus_fastapi_instrumentator-8.0.2-py3-none-any.whl", hash = "sha256:746002ec1e2c58b93f61444e1d104de959a9463a6a3f1c8909ac3757e16c3866", size = 20549, upload-time = "2026-06-23T09:39:32.616Z" },
]
[[package]]
@@ -4726,7 +4704,7 @@ wheels = [
[[package]]
name = "r2e-gym-v1"
version = "0.1.0"
source = { editable = "deps/research-environments/environments/r2e_gym_v1" }
source = { editable = "deps/research-environments/environments/swe/r2e_gym_v1" }
dependencies = [
{ name = "datasets" },
{ name = "verifiers" },
@@ -4735,7 +4713,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev381" },
{ name = "verifiers", specifier = ">=0.1.15.dev434" },
]
[[package]]
@@ -4786,7 +4764,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
]
[[package]]
@@ -4953,27 +4931,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/c1/02/18ba0727a1c755c528d6a52b363d62c0b7a8e64cf961b3030c046107db4d/ring_flash_attn-0.1.8-py3-none-any.whl", hash = "sha256:296c929516c3b21f7bcdaeca44a99bb541779a7b63979eb0f67837dcb18a2bb9", size = 25437, upload-time = "2025-09-10T11:53:07.565Z" },
]
[[package]]
name = "rlm-search"
version = "0.1.2"
source = { editable = "deps/research-environments/environments/rlm_search" }
dependencies = [
{ name = "datasets" },
{ name = "httpx" },
{ name = "openai" },
{ name = "prime-sandboxes" },
{ name = "verifiers" },
]
[package.metadata]
requires-dist = [
{ name = "datasets", specifier = ">=4.0.0" },
{ name = "httpx" },
{ name = "openai", specifier = ">=1.0" },
{ name = "prime-sandboxes", specifier = ">=0.2.19" },
{ name = "verifiers", specifier = ">=0.1.15.dev171" },
]
[[package]]
name = "rpds-py"
version = "0.30.0"
@@ -4998,6 +4955,21 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/ed/c5/8864e4e7925b836ea354b31d57641ec03830564e281a8b6f061f8c3e0ec1/ruff-0.15.14-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:bb01d645694e3ec0102105d07ef2d53703970407d59c04e59d3ba0b7a1d53553", size = 11560214, upload-time = "2026-05-21T14:34:50.975Z" },
]
[[package]]
name = "s1-deepresearch-v1"
version = "0.1.0"
source = { editable = "deps/research-environments/environments/s1_deepresearch_v1" }
dependencies = [
{ name = "huggingface-hub" },
{ name = "verifiers" },
]
[package.metadata]
requires-dist = [
{ name = "huggingface-hub" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
]
[[package]]
name = "safetensors"
version = "0.7.0"
@@ -5013,7 +4985,7 @@ wheels = [
[[package]]
name = "scaleswe-v1"
version = "0.1.0"
source = { editable = "deps/research-environments/environments/scaleswe_v1" }
source = { editable = "deps/research-environments/environments/swe/scaleswe_v1" }
dependencies = [
{ name = "datasets" },
{ name = "verifiers" },
@@ -5022,7 +4994,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev381" },
{ name = "verifiers", specifier = ">=0.1.15.dev434" },
]
[[package]]
@@ -5160,7 +5132,7 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "openai" },
{ name = "verifiers", specifier = ">=0.1.15.dev397" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
]
[[package]]
@@ -5177,7 +5149,7 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "openai" },
{ name = "verifiers", specifier = ">=0.1.15.dev397" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
]
[[package]]
@@ -5313,15 +5285,15 @@ wheels = [
[[package]]
name = "starlette"
version = "0.52.1"
version = "1.3.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "anyio" },
{ name = "typing-extensions" },
]
sdist = { url = "https://files.pythonhosted.org/packages/c4/68/79977123bb7be889ad680d79a40f339082c1978b5cfcf62c2d8d196873ac/starlette-0.52.1.tar.gz", hash = "sha256:834edd1b0a23167694292e94f597773bc3f89f362be6effee198165a35d62933", size = 2653702, upload-time = "2026-01-18T13:34:11.062Z" }
sdist = { url = "https://files.pythonhosted.org/packages/eb/e3/7c1dc7381d9f8ab7d854328ebfa884e62cb3f3d8549ddfd37c7814f42afa/starlette-1.3.1.tar.gz", hash = "sha256:05d0213193f2fbaae60e2ecb593b4add4262ad4e46536b54abe36f11a71724e0", size = 2703240, upload-time = "2026-06-12T09:23:11.602Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/81/0d/13d1d239a25cbfb19e740db83143e95c772a1fe10202dda4b76792b114dd/starlette-0.52.1-py3-none-any.whl", hash = "sha256:0029d43eb3d273bc4f83a08720b4912ea4b071087a3b48db01b7c839f7954d74", size = 74272, upload-time = "2026-01-18T13:34:09.188Z" },
{ url = "https://files.pythonhosted.org/packages/ec/bb/2799cc2ede3ed41131f8975621e7213dfc7ef4acbbaadfa440f32500c370/starlette-1.3.1-py3-none-any.whl", hash = "sha256:c7372aae11c3c3f26a42df7bd626cec2f47d03483d261d369516a615a53714c6", size = 73632, upload-time = "2026-06-12T09:23:10.017Z" },
]
[[package]]
@@ -5406,29 +5378,29 @@ wheels = [
[[package]]
name = "swebench-pro-v1"
version = "0.1.0"
source = { editable = "deps/research-environments/environments/swebench_pro_v1" }
source = { editable = "deps/research-environments/environments/swe/swebench_pro_v1" }
dependencies = [
{ name = "verifiers" },
]
[package.metadata]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev389" }]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev434" }]
[[package]]
name = "swebench-verified-v1"
version = "0.1.0"
source = { editable = "deps/research-environments/environments/swebench_verified_v1" }
source = { editable = "deps/research-environments/environments/swe/swebench_verified_v1" }
dependencies = [
{ name = "verifiers" },
]
[package.metadata]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev389" }]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev434" }]
[[package]]
name = "swelego-v1"
version = "0.1.0"
source = { editable = "deps/research-environments/environments/swelego_v1" }
source = { editable = "deps/research-environments/environments/swe/swelego_v1" }
dependencies = [
{ name = "datasets" },
{ name = "verifiers" },
@@ -5437,7 +5409,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev381" },
{ name = "verifiers", specifier = ">=0.1.15.dev434" },
]
[[package]]
@@ -5516,7 +5488,7 @@ dependencies = [
requires-dist = [
{ name = "audioop-lts", marker = "python_full_version >= '3.13'" },
{ name = "tau2", git = "https://github.com/sierra-research/tau2-bench.git?rev=337326e" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev424" },
]
[[package]]
@@ -5566,7 +5538,7 @@ dependencies = [
]
[package.metadata]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev389" }]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev411" }]
[[package]]
name = "textarena"
@@ -5845,7 +5817,7 @@ wheels = [
[[package]]
name = "torchtitan"
version = "0.1.0"
source = { git = "https://github.com/pytorch/torchtitan?rev=a1fdd7e#a1fdd7e43694bbfeff5d6ad8ac738c067bb90d41" }
source = { git = "https://github.com/pytorch/torchtitan?rev=23e4dfc#23e4dfca5ca52587dbaf18f67bee8d73e875df5b" }
dependencies = [
{ name = "datasets" },
{ name = "fsspec" },
@@ -6024,7 +5996,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev389" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -6045,7 +6017,7 @@ dependencies = [
]
[package.metadata]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev381" }]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev411" }]
[[package]]
name = "uvicorn"
@@ -6094,7 +6066,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "faker", specifier = ">=20.0.0" },
{ name = "verifiers", specifier = ">=0.1.15.dev389" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -6239,8 +6211,8 @@ wheels = [
[[package]]
name = "vllm"
version = "0.23.0+cu129"
source = { url = "https://github.com/vllm-project/vllm/releases/download/v0.23.0/vllm-0.23.0+cu129-cp38-abi3-manylinux_2_28_aarch64.whl" }
version = "0.24.0+cu129"
source = { url = "https://github.com/vllm-project/vllm/releases/download/v0.24.0/vllm-0.24.0+cu129-cp38-abi3-manylinux_2_28_aarch64.whl" }
resolution-markers = [
"platform_machine == 'aarch64' and sys_platform == 'linux'",
]
@@ -6261,9 +6233,9 @@ dependencies = [
{ name = "filelock" },
{ name = "flashinfer-cubin" },
{ name = "flashinfer-python" },
{ name = "gguf" },
{ name = "humming-kernels", extra = ["cu12"] },
{ name = "ijson" },
{ name = "jsonschema" },
{ name = "lark" },
{ name = "llguidance" },
{ name = "lm-format-enforcer" },
@@ -6304,6 +6276,7 @@ dependencies = [
{ name = "setproctitle" },
{ name = "setuptools" },
{ name = "six" },
{ name = "starlette" },
{ name = "tiktoken" },
{ name = "tilelang" },
{ name = "tokenizers" },
@@ -6318,7 +6291,7 @@ dependencies = [
{ name = "xgrammar" },
]
wheels = [
{ url = "https://github.com/vllm-project/vllm/releases/download/v0.23.0/vllm-0.23.0+cu129-cp38-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:17ac76bbfad014d5b584a9499bca22d3f871d24db93cbb1eb27a87deef0219aa" },
{ url = "https://github.com/vllm-project/vllm/releases/download/v0.24.0/vllm-0.24.0+cu129-cp38-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:e85edf971a25582993ef3bfd26b0d6ebf498d5ca4ae4944fa8824a734b81ac58" },
]
[package.metadata]
@@ -6336,17 +6309,17 @@ requires-dist = [
{ name = "depyf", specifier = "==0.20.0" },
{ name = "diskcache", specifier = "==5.6.3" },
{ name = "einops" },
{ name = "fastapi", extras = ["standard"], specifier = ">=0.115.0" },
{ name = "fastapi", extras = ["standard"], specifier = ">=0.133.0,<0.137.0" },
{ name = "fastsafetensors", specifier = ">=0.3.2" },
{ name = "fastsafetensors", marker = "extra == 'fastsafetensors'", specifier = ">=0.3.2" },
{ name = "filelock", specifier = ">=3.16.1" },
{ name = "flashinfer-cubin", specifier = "==0.6.12" },
{ name = "flashinfer-python", specifier = "==0.6.12" },
{ name = "gguf", specifier = ">=0.17.0" },
{ name = "helion", marker = "extra == 'helion'", specifier = "==1.0.0" },
{ name = "humming-kernels", extras = ["cu12"], specifier = "==0.1.4" },
{ name = "helion", marker = "extra == 'helion'", specifier = "==1.1.0" },
{ name = "humming-kernels", extras = ["cu12"], specifier = "==0.1.6" },
{ name = "ijson" },
{ name = "instanttensor", marker = "extra == 'instanttensor'", specifier = ">=0.1.5" },
{ name = "jsonschema", specifier = ">=4.23.0" },
{ name = "lark", specifier = "==1.2.2" },
{ name = "llguidance", marker = "platform_machine == 'aarch64' or platform_machine == 'arm64' or platform_machine == 'ppc64le' or platform_machine == 'x86_64'", specifier = ">=1.7.0,<1.8.0" },
{ name = "lm-format-enforcer", specifier = "==0.11.3" },
@@ -6378,7 +6351,7 @@ requires-dist = [
{ name = "pillow" },
{ name = "plotly", marker = "extra == 'bench'" },
{ name = "prometheus-client", specifier = ">=0.18.0" },
{ name = "prometheus-fastapi-instrumentator", specifier = ">=7.0.0" },
{ name = "prometheus-fastapi-instrumentator", specifier = ">=8.0.0" },
{ name = "protobuf", specifier = ">=5.29.6,!=6.30.*,!=6.31.*,!=6.32.*,!=6.33.0.*,!=6.33.1.*,!=6.33.2.*,!=6.33.3.*,!=6.33.4.*" },
{ name = "psutil" },
{ name = "py-cpuinfo" },
@@ -6401,6 +6374,8 @@ requires-dist = [
{ name = "six", marker = "python_full_version >= '3.12'", specifier = ">=1.16.0" },
{ name = "smg-grpc-servicer", extras = ["vllm"], marker = "extra == 'grpc'", specifier = ">=0.5.2" },
{ name = "soundfile", marker = "extra == 'audio'" },
{ name = "soxr", marker = "extra == 'audio'" },
{ name = "starlette", specifier = ">=1.0.1" },
{ name = "tensorizer", marker = "extra == 'tensorizer'", specifier = "==2.10.1" },
{ name = "tiktoken", specifier = ">=0.6.0" },
{ name = "tilelang", specifier = "==0.1.9" },
@@ -6410,18 +6385,19 @@ requires-dist = [
{ name = "torchaudio", specifier = "==2.11.0" },
{ name = "torchvision", specifier = "==0.26.0" },
{ name = "tqdm" },
{ name = "transformers", specifier = ">=4.56.0,!=5.0.*,!=5.1.*,!=5.2.*,!=5.3.*,!=5.4.*,!=5.5.0" },
{ name = "transformers", specifier = ">=5.5.3" },
{ name = "typing-extensions", specifier = ">=4.10" },
{ name = "vllm-gguf-plugin", marker = "extra == 'extra-quant'", specifier = ">=0.0.2" },
{ name = "watchfiles" },
{ name = "xgrammar", marker = "platform_machine == 'aarch64' or platform_machine == 'arm64' or platform_machine == 'ppc64le' or platform_machine == 's390x' or platform_machine == 'x86_64'", specifier = ">=0.2.0,<1.0.0" },
{ name = "xgrammar", marker = "platform_machine == 'aarch64' or platform_machine == 'arm64' or platform_machine == 'ppc64le' or platform_machine == 's390x' or platform_machine == 'x86_64'", specifier = ">=0.2.1,<1.0.0" },
{ name = "zentorch", marker = "extra == 'zen'", specifier = "==2.11.0.0" },
]
provides-extras = ["zen", "bench", "tensorizer", "fastsafetensors", "instanttensor", "runai", "audio", "video", "flashinfer", "helion", "grpc", "otel"]
provides-extras = ["zen", "bench", "tensorizer", "fastsafetensors", "instanttensor", "runai", "audio", "video", "flashinfer", "helion", "grpc", "otel", "extra-quant"]
[[package]]
name = "vllm"
version = "0.23.0+cu129"
source = { url = "https://github.com/vllm-project/vllm/releases/download/v0.23.0/vllm-0.23.0+cu129-cp38-abi3-manylinux_2_28_x86_64.whl" }
version = "0.24.0+cu129"
source = { url = "https://github.com/vllm-project/vllm/releases/download/v0.24.0/vllm-0.24.0+cu129-cp38-abi3-manylinux_2_28_x86_64.whl" }
resolution-markers = [
"platform_machine == 'x86_64' and sys_platform == 'linux'",
]
@@ -6442,9 +6418,9 @@ dependencies = [
{ name = "filelock" },
{ name = "flashinfer-cubin" },
{ name = "flashinfer-python" },
{ name = "gguf" },
{ name = "humming-kernels", extra = ["cu12"] },
{ name = "ijson" },
{ name = "jsonschema" },
{ name = "lark" },
{ name = "llguidance" },
{ name = "lm-format-enforcer" },
@@ -6485,6 +6461,7 @@ dependencies = [
{ name = "setproctitle" },
{ name = "setuptools" },
{ name = "six" },
{ name = "starlette" },
{ name = "tiktoken" },
{ name = "tilelang" },
{ name = "tokenizers" },
@@ -6499,7 +6476,7 @@ dependencies = [
{ name = "xgrammar" },
]
wheels = [
{ url = "https://github.com/vllm-project/vllm/releases/download/v0.23.0/vllm-0.23.0+cu129-cp38-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:8bc2203995d061e6b988916b71b9dee8a5970f5fdc5f37d4445a877a2fab2cc1" },
{ url = "https://github.com/vllm-project/vllm/releases/download/v0.24.0/vllm-0.24.0+cu129-cp38-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:597949743f2a00c0539d9e2ff0f67b32c608a378e973f99e7529fd6fa9445f70" },
]
[package.metadata]
@@ -6517,17 +6494,17 @@ requires-dist = [
{ name = "depyf", specifier = "==0.20.0" },
{ name = "diskcache", specifier = "==5.6.3" },
{ name = "einops" },
{ name = "fastapi", extras = ["standard"], specifier = ">=0.115.0" },
{ name = "fastapi", extras = ["standard"], specifier = ">=0.133.0,<0.137.0" },
{ name = "fastsafetensors", specifier = ">=0.3.2" },
{ name = "fastsafetensors", marker = "extra == 'fastsafetensors'", specifier = ">=0.3.2" },
{ name = "filelock", specifier = ">=3.16.1" },
{ name = "flashinfer-cubin", specifier = "==0.6.12" },
{ name = "flashinfer-python", specifier = "==0.6.12" },
{ name = "gguf", specifier = ">=0.17.0" },
{ name = "helion", marker = "extra == 'helion'", specifier = "==1.0.0" },
{ name = "humming-kernels", extras = ["cu12"], specifier = "==0.1.4" },
{ name = "helion", marker = "extra == 'helion'", specifier = "==1.1.0" },
{ name = "humming-kernels", extras = ["cu12"], specifier = "==0.1.6" },
{ name = "ijson" },
{ name = "instanttensor", marker = "extra == 'instanttensor'", specifier = ">=0.1.5" },
{ name = "jsonschema", specifier = ">=4.23.0" },
{ name = "lark", specifier = "==1.2.2" },
{ name = "llguidance", marker = "platform_machine == 'aarch64' or platform_machine == 'arm64' or platform_machine == 'ppc64le' or platform_machine == 'x86_64'", specifier = ">=1.7.0,<1.8.0" },
{ name = "lm-format-enforcer", specifier = "==0.11.3" },
@@ -6559,7 +6536,7 @@ requires-dist = [
{ name = "pillow" },
{ name = "plotly", marker = "extra == 'bench'" },
{ name = "prometheus-client", specifier = ">=0.18.0" },
{ name = "prometheus-fastapi-instrumentator", specifier = ">=7.0.0" },
{ name = "prometheus-fastapi-instrumentator", specifier = ">=8.0.0" },
{ name = "protobuf", specifier = ">=5.29.6,!=6.30.*,!=6.31.*,!=6.32.*,!=6.33.0.*,!=6.33.1.*,!=6.33.2.*,!=6.33.3.*,!=6.33.4.*" },
{ name = "psutil" },
{ name = "py-cpuinfo" },
@@ -6582,6 +6559,8 @@ requires-dist = [
{ name = "six", marker = "python_full_version >= '3.12'", specifier = ">=1.16.0" },
{ name = "smg-grpc-servicer", extras = ["vllm"], marker = "extra == 'grpc'", specifier = ">=0.5.2" },
{ name = "soundfile", marker = "extra == 'audio'" },
{ name = "soxr", marker = "extra == 'audio'" },
{ name = "starlette", specifier = ">=1.0.1" },
{ name = "tensorizer", marker = "extra == 'tensorizer'", specifier = "==2.10.1" },
{ name = "tiktoken", specifier = ">=0.6.0" },
{ name = "tilelang", specifier = "==0.1.9" },
@@ -6591,13 +6570,14 @@ requires-dist = [
{ name = "torchaudio", specifier = "==2.11.0" },
{ name = "torchvision", specifier = "==0.26.0" },
{ name = "tqdm" },
{ name = "transformers", specifier = ">=4.56.0,!=5.0.*,!=5.1.*,!=5.2.*,!=5.3.*,!=5.4.*,!=5.5.0" },
{ name = "transformers", specifier = ">=5.5.3" },
{ name = "typing-extensions", specifier = ">=4.10" },
{ name = "vllm-gguf-plugin", marker = "extra == 'extra-quant'", specifier = ">=0.0.2" },
{ name = "watchfiles" },
{ name = "xgrammar", marker = "platform_machine == 'aarch64' or platform_machine == 'arm64' or platform_machine == 'ppc64le' or platform_machine == 's390x' or platform_machine == 'x86_64'", specifier = ">=0.2.0,<1.0.0" },
{ name = "xgrammar", marker = "platform_machine == 'aarch64' or platform_machine == 'arm64' or platform_machine == 'ppc64le' or platform_machine == 's390x' or platform_machine == 'x86_64'", specifier = ">=0.2.1,<1.0.0" },
{ name = "zentorch", marker = "extra == 'zen'", specifier = "==2.11.0.0" },
]
provides-extras = ["zen", "bench", "tensorizer", "fastsafetensors", "instanttensor", "runai", "audio", "video", "flashinfer", "helion", "grpc", "otel"]
provides-extras = ["zen", "bench", "tensorizer", "fastsafetensors", "instanttensor", "runai", "audio", "video", "flashinfer", "helion", "grpc", "otel", "extra-quant"]
[[package]]
name = "vllm-router"
@@ -6662,6 +6642,19 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/94/51/a69ac59300e3c813939d0764348959ed2a21e14c668cb1cebcb04010da6a/wandb-0.27.0-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:17aae6e4a88cd05c00ea8f546220918e3ebb6f8c1c36b70ef04a5ac75f0d7160", size = 27599005, upload-time = "2026-05-14T03:43:50.926Z" },
]
[[package]]
name = "wandb-workspaces"
version = "0.4.3"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "pydantic" },
{ name = "wandb" },
]
sdist = { url = "https://files.pythonhosted.org/packages/44/90/749e3af75f1bc2685711176f8f0fe6dae38d5b979e4dc160c30cd4373597/wandb_workspaces-0.4.3.tar.gz", hash = "sha256:2c551bc35cadda14ff0c7c3ac1d7bbbb1c95b8f0dbc662ec2c58f3d3d832f854", size = 234226, upload-time = "2026-06-10T22:27:17.22Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/c0/8f/0c1bc0b48733935031ef8956a1efb1436e3f4e1a3a402eece169a952672b/wandb_workspaces-0.4.3-py3-none-any.whl", hash = "sha256:4536dbc9d57d3aa59318e770b5c526c087f52b6b9488634b1d393163b9f6da2f", size = 109269, upload-time = "2026-06-10T22:27:15.509Z" },
]
[[package]]
name = "wasabi"
version = "1.1.3"
@@ -6773,7 +6766,7 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "openai" },
{ name = "verifiers", specifier = ">=0.1.15.dev397" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
]
[[package]]
@@ -6830,7 +6823,7 @@ dependencies = [
]
[package.metadata]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev381" }]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev411" }]
[[package]]
name = "wordle"