Compare commits

...
Author SHA1 Message Date
3587b285f5 chore: require prime-runs 0.1.4 (#3928)
## Summary

Raises the `prime-runs[train]` floor from `>=0.1.3` to `>=0.1.4` and
updates `uv.lock` to match.

## Why

`prime-runs` 0.1.4 lets a run opt out of Prime Traces and upload its
samples to the legacy sample tables instead
(PrimeIntellect-ai/prime#998):

- `PRIME_TRACES_OPT_OUT=true`
- `prime config set-traces-opt-out true`, which sets `traces_opt_out` in
`~/.prime/config.json`
- `prime_runs.init(traces_opt_out=True)`

`prime-runs` 0.1.3 doesn't know about any of these. With 0.1.3
installed, which is what `uv sync` gives today, a user who sets the
environment variable or the config key gets no error and no warning, and
their runs keep uploading to Prime Traces. Requiring 0.1.4 makes the
setting take effect.

Nothing changes for runs that don't opt out. The Prime monitor calls
`prime_runs.init()` without the new argument, so the default (upload to
Prime Traces) is unchanged.

A training run that opts out needs pyarrow for the legacy sample
encoder. prime-rl already depends on `prime-runs[train]`, which includes
it.

## Changes

- `pyproject.toml`: `prime-runs[train]>=0.1.3` →
`prime-runs[train]>=0.1.4`.
- `uv.lock`: `prime-runs` 0.1.3 → 0.1.4. No other package moves;
`prime-traces` stays at 0.0.7.

The `deps/verifiers` submodule is not changed. Its own floor is raised
separately in PrimeIntellect-ai/verifiers#2805, and this PR doesn't
depend on it.

`uv lock --check` passes. I did not run the test suite.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Dependency floor bump only; no application code changes and default
trace upload behavior stays the same.
> 
> **Overview**
> Raises the **`prime-runs[train]`** minimum from **`>=0.1.3`** to
**`>=0.1.4`** in `pyproject.toml` and pins **`prime-runs` 0.1.4** in
`uv.lock`.
> 
> This ensures installs pick up **Prime Traces opt-out** behavior
(`PRIME_TRACES_OPT_OUT`, `prime config set-traces-opt-out`, or
`prime_runs.init(traces_opt_out=True)`), which 0.1.3 silently ignored so
opted-out runs could still upload to Prime Traces. Default runs that do
not opt out are unchanged; `prime-rl` still depends on the **`[train]`**
extra for legacy sample encoding when opting out.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
06caa96109250b6b800d8e757de7133b4f152031. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 19:38:03 -07:00
f3827c4ed2 perf(trainer): avoid eager fallback of MoE blocks with an fp32 router and activation checkpointing (#3925)
With `moe_router_dtype="float32"` (the RL default) and activation
checkpointing on, every MoE block ran eager under `torch.compile`. Two
things combine to cause it:

- The fp32 router is its own FSDP2 unit, and FSDP2 hooks are
dynamo-disabled, so the router always breaks the graph.
- Under `compile(AC(block))` the checkpoint compiles as a higher-order
op, which forbids breaks, so Dynamo ran the whole block eagerly.

This PR compiles inside the checkpoint instead: for any checkpointed
block that holds a nested FSDP unit (today, the fp32 router), an eager
checkpoint now wraps the compiled block (`AC(compile(block))`), so the
nested unit's break only splits the block into compiled graphs. To see
those units, compile now runs after FSDP. Compiling in place keeps the
same module object, so the order changes nothing at runtime.

The reorder is safe. The old `AC -> Compile -> FSDP` comment was ported
from TorchTitan in #923, when `apply_compile` still wrapped each block
with `torch.compile(block)`. #957 switched to in-place `.compile()` two
days later without revisiting it. With in-place compile, both orders
trace the same frames: graph breaks, loss and step time match on both
workloads, and `fullgraph=True` (with a bf16 router) still compiles with
zero graph breaks.

| Workload (8x H200, EP 8, full AC) | before (s/step) | after (s/step) |
MFU |
|---|---|---|---|
| GLM-4.5-Air, 16 layers, real data | 6.21, 6.17 | 5.22, 5.21 | 35% to
42% |
| Qwen3-30B-A3B, fake data | 5.96, 5.96 | 4.51, 4.51 | 32% to 42% |

Two runs per arm, each the median `time/step` over steps 5 to 20, no
offloading. Peak memory is unchanged, and loss and grad norm track the
baseline within run-to-run noise.

![Qwen3-30B-A3B MoE layer forward, before and
after](https://raw.githubusercontent.com/PrimeIntellect-ai/prime-rl/09e64ed1afc27e97fda6080556171522e29c9a0e/pr-figures/fp32-router-compile/qwen_layer_forward.png)

**Figure:** one MoE layer's forward on Qwen3-30B-A3B, before and after
this PR. The orange eager elementwise kernels collapse into a few pink
compiled Triton kernels, so the layer's forward drops from 16.4 to 11.3
ms.

<details><summary>Same view on GLM-4.5-Air</summary>

![GLM-4.5-Air MoE layer forward, before and
after](https://raw.githubusercontent.com/PrimeIntellect-ai/prime-rl/09e64ed1afc27e97fda6080556171522e29c9a0e/pr-figures/fp32-router-compile/glm_layer_forward.png)

</details>

## Alternative considered

Keeping recompute inside the compiler: drop the block-level checkpoint
and instead checkpoint two compiled regions that exclude the router, the
attention module and the post-router MoE work. It beat the baseline but
was slower than this PR (Qwen3-30B 5.50 vs 4.51 s/step, GLM-4.5-Air 5.85
vs 5.22 s/step) and used more memory, because the norms and the router's
fp32 activations stay outside any checkpoint.

## North star: fullgraph fp32 router support

Fullgraph compile with an fp32 router stays unsupported, and
`model.compile.fullgraph=true` still raises for it. The blocker is the
router's FSDP unit itself: FSDP2 applies one mixed-precision policy per
unit, so the fp32 router cannot share the block's bf16 unit, and its
dynamo-disabled hooks are the graph break above. PyTorch
[#196626](https://github.com/pytorch/pytorch/pull/196626) adds
per-parameter mixed precision, which lets the router stay in the block's
unit. That removes the break, enables fullgraph, and makes this PR's
compile-inside-AC path unnecessary, so it should be reverted then.
#196626 is on PyTorch `main` but not yet in a release.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-07 16:55:28 -04:00
faresobeidandGitHub 93a0fe0d6b refactor(trainer): add iter_moe_blocks for the MoE layer lookup (#3843)
## Summary
Add `iter_moe_blocks(model)` in `trainer/model.py`. It yields the `MoE`
MLP of each decoder layer. It replaces the five copies of the
decoder-layer MoE lookup in `freeze_moe_router`,
`apply_fp32_moe_router`, `get_full_offload_dtype_policy`,
`apply_force_balanced_routing` and `get_load_balance_stats`.

## What changed
- New `iter_moe_blocks` next to the helpers that use it. The helpers
stay in `model.py`, so no imports change.
- The four `layer.mlp if hasattr(...) else layer.feed_forward ...`
lookups and the `getattr(mlp)` + `hasattr(tokens_per_expert)` scan in
`get_load_balance_stats` now call `iter_moe_blocks`.
- Removed the stale "HF impl" comment in `get_expert_load_stats`. The HF
fallback was removed in #3773.

## Behavior change
None. The `feed_forward` fallback is gone. Every prime-rl decoder layer
uses `mlp`. `get_load_balance_stats` already looked only at `mlp`. Only
`MoE` registers `tokens_per_expert`, so it selects the same layers as
before.

## Checks
- CPU equivalence vs `main` (throwaway script, not in the repo). Tiny
Qwen3-MoE (`mlp_only_layers=[1]`) and GLM4-MoE
(`first_k_dense_replace=1`) models with fixed router-count buffers.
Compared `is_tt_moe_model`, `get_load_balance_stats`,
`get_global_moe_stats`, `compute_expert_load_stats`,
`get_expert_load_stats` and `get_full_offload_dtype_policy`, plus
parameter dtype and `requires_grad`, and router
`fp32_gate`/`force_balanced` after the three router helpers. All 16
outputs were bit-identical.
- `pytest tests/unit/train tests/unit/orchestrator
tests/unit/test_configs* -m "not gpu"`: 450 passed, 1 failed. The
failure is
`test_cpu_adam.py::test_native_cpu_adamw_matches_fused_torch_and_preserves_gradients`
(ninja build), which fails the same way on `main`.
- `ruff check` and `ruff format --check`.
- GPU: reverse-text MoE RL smoke vs `main` on one node, running.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Mechanical refactor of MoE traversal with no intended behavior change;
only risk is if a model relied on the removed feed_forward path (none in
this codebase).
> 
> **Overview**
> Introduces **`iter_moe_blocks`**, a single iterator over decoder
layers whose `mlp` is a **`MoE`**, and rewires MoE
router/offload/metrics helpers to use it instead of repeated per-layer
`mlp` / `feed_forward` lookups.
> 
> **`freeze_moe_router`**, **`apply_fp32_moe_router`**,
**`get_full_offload_dtype_policy`**, **`apply_force_balanced_routing`**,
and **`get_load_balance_stats`** now loop over that iterator; the unused
**`feed_forward`** fallback is removed. **`get_expert_load_stats`** only
drops an outdated comment on the empty tensor guard.
> 
> Intended as a no-op for supported models: same router freezing, fp32
gates, FSDP dtype policy, debug balanced routing, and load-balance /
expert-load metrics.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
2cf0399ca4e467c9ae028082c2a03f02604abbf8. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-10-07 20:22:19 +01:00
faresobeidandGitHub db2c00e9ed feat(trainer): freeze MoE router by default in RL (#3797)
Make `trainer.model.freeze_moe_router` default to on for RL.

## What changes
- `model.freeze_moe_router` is now `bool | "auto"`, default `"auto"`. It
resolves to `True` on the RL `TrainerConfig` and to `False` on
`SFTConfig`, following the per-trainer pattern of `moe_router_dtype`. An
explicit `true`/`false` still wins.
- `freeze_moe_router()` no longer raises on non-MoE models; it does
nothing, so dense RL runs keep working with the new default.
- `docs/training.md` knobs table lists the field.

## Why
In RL, router updates amplify the train/inference routing mismatch: the
trainer's expert choices drift away from the ones inference sampled. So
RL keeps the pretrained router by default. SFT is unchanged.

What gets frozen: the router gate parameters (`mlp.router.gate.weight`,
plus `gate.bias` on gpt-oss). The aux-loss-free `selection_bias` buffer
is not a parameter, and nothing on main updates it. Shared-expert gates
(Qwen3.5) and Nemotron-H latent projections are not touched. Frozen
routers get no optimizer state.

## Breaking changes
- RL runs on MoE models no longer train the router. All MoE RL examples
are affected (glm-5.3, glm-4.5-air, intellect-3.1, qwen3-30b-a3b,
minimax-m2.5, nemotron-3-super). Set `trainer.model.freeze_moe_router =
false` for the old behavior.
- An explicit `freeze_moe_router = true` on a non-MoE model is now a
no-op instead of an error.
- Resuming: a checkpoint saved before this change (trainable router)
loads into a frozen-router run; the extra router optimizer state is
ignored. The reverse, resuming a frozen-router checkpoint with
`freeze_moe_router = false`, fails on missing DCP keys (noted in the
field docstring).
- With LoRA, a router listed in `lora.modules_to_save` is frozen again
by the new default unless `freeze_moe_router = false` is set.

## GPU check
One node (8×H200), FSDP over 8 ranks, `samsja/mini-glm-moe` (23 MoE
layers), SFT with fake data, `freeze_moe_router = true`,
`moe_router_dtype = "float32"` (so each router is its own fp32 FSDP unit
whose params are all frozen), 5 steps with a checkpoint every step:
- Log: "Froze 23 MoE router parameters", "Running 23 MoE router gates in
fp32"; all 5 steps ran with finite loss and grad norm.
- DCP checkpoints step 1 vs step 5: all 23 fp32 router gate weights are
bitwise unchanged; expert weights changed; no optimizer state exists for
any router parameter.
2026-10-07 19:15:26 +01:00
4250d895bc fix(trainer): run FA2 and FA3 through custom ops so fullgraph compile works (#3911)
#3753 let MoE blocks compile with `model.compile.fullgraph = true`, but
it was validated on B300 with FA4. On H200, where FA3 is the default,
fullgraph still failed at the first forward, because FA2's and FA3's
`flash_attn_varlen_func` are autograd.Functions and Dynamo rejects the
same `cu_seqlens` tensor passed as both `cu_seqlens_q` and
`cu_seqlens_k`. FA2 and FA3 now run through `prime_rl_attn` custom ops
like FA4 (#3754), so the checkpointed MoE blocks compile with fullgraph
and no graph breaks on H200 too.

- AFMoE, Ulysses CP and the Qwen3.5 vision encoder now call the op
wrappers; FA4's op takes optional `max_seqlen_q/k` for Ulysses.
- The ops match the library functions bitwise, except FA3's GQA
`dk`/`dv`, which the library itself doesn't reproduce run to run.
- `apply_compile` traces `max_seqlen` symbolically: as a constant, each
rank recompiled on its first new value and stalled every rank for ~6 s.
A
[benchmark](https://github.com/PrimeIntellect-ai/prime-rl/blob/9db5336241304a0263664c8408e03159cbb8767e/tools/benchmark_flash_attn_max_seqlen.py)
shows the symbolic int costs nothing measurable.

| GLM-4.5-Air, 24 layers, 2 x 8 H200, ep 8, bf16 router | s/step (lower
is better) | tok/s/GPU (higher is better) |
|---|---|---|
| main, FA3, fullgraph off (fullgraph fails) | 4.64 | 3533 |
| this PR, FA3, fullgraph on | 3.83 | 4282 |

That is 17.5% less time per step, or 21.2% more tokens per second per
GPU. Medians over steps 5 to 20; loss tracks main within 0.03 over 20
steps. The GPU is about 99% busy in both arms, so the gain is fusion:
per step, about 1030 ms of unfused aten kernels (MoE routing glue, RoPE)
become 262 ms of Inductor-fused Triton kernels.

![Layer 12 forward
timeline](https://raw.githubusercontent.com/PrimeIntellect-ai/prime-rl/8e12d604f167480f14a2a3a34452c38a95ad07f7/pr-figures/fa-custom-op/layer12-forward.png)

**Figure:** one layer's forward, before (`main`, fullgraph off) and
after (this PR, fullgraph on). The strings of small yellow and
red-orange aten kernels on `main` become a few fused Triton kernels
(pink), and the layer finishes in 35.9 ms instead of 45.4 ms.

![Layer 12 recompute and backward
timeline](https://raw.githubusercontent.com/PrimeIntellect-ai/prime-rl/8e12d604f167480f14a2a3a34452c38a95ad07f7/pr-figures/fa-custom-op/layer12-backward.png)

**Figure:** the same layer's recompute and backward, 106.7 ms after
versus 131.6 ms before. The bottom panel totals the whole step: about 1
s of unfused aten kernels became 262 ms of fused Triton kernels, while
FlashAttention and GEMM time barely changed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-07 13:26:59 -04:00
11 changed files with 398 additions and 90 deletions
+1
View File
@@ -62,6 +62,7 @@ A condensed view of the knobs you'll most often tune. For trainer-side paralleli
| `orchestrator.train.group_size` | Rollouts generated per task. |
| `orchestrator.max_off_policy_steps` | Maximum staleness of a trained rollout (default 8): the version a batch trains on minus the oldest version that generated the rollout, queue time included. Episodes past the bound are dropped; a group shares one dispatch version, so its episodes age out together. The main off-policy dial on long agentic rollouts — bump for throughput, lower for tighter on-policyness. Watch `off_policy/*` and `mismatch_kl/all/mean` when tuning. |
| `[orchestrator.train.algo]` | Training algorithm — its `type` names it (`grpo` default, `max_rl`, `rae`, `hierarchical_grpo`, `opd`, `opsd`, `sft`, `echo`). See [Algorithms](#algorithms). |
| `trainer.model.freeze_moe_router` | Freeze MoE router gates (default `true` for RL, `false` for SFT). Router updates in RL shift the trainer's expert choices away from the ones inference sampled, amplifying the train-inference mismatch, so RL keeps the pretrained router. Set `false` to train it. |
| `[[orchestrator.train.source]]` | Training sources. List multiple tables for multi-env training; weight them via `ratio`. See [Configuration § Training sources](configuration.md#training-sources-orchestratortrainsource). |
| `[[orchestrator.eval.source]]` + `orchestrator.eval.interval` | Eval environments and cadence (default every 100 steps). |
@@ -283,6 +283,13 @@ class SFTConfig(BaseConfig):
self.optim.weight_decay = 0.01
return self
@model_validator(mode="after")
def resolve_freeze_moe_router_auto(self):
"""Resolve ``model.freeze_moe_router='auto'``: SFT trains the router."""
if self.model.freeze_moe_router == "auto":
self.model.freeze_moe_router = False
return self
@model_validator(mode="after")
def auto_setup_run_identity(self):
"""Auto-generate the run name (``<dataset>--<model>--<short-id>``) when unset and
@@ -332,8 +332,8 @@ class ModelConfig(BaseModelConfig):
index_cache: IndexCacheConfig | None = None
"""DSA IndexCache sub-configuration. If set, sparse-attention top-k indices are reused across decoder layers per the configured schedule (mirrors vLLM's IndexCache HF overrides). If None, every layer recomputes its own indices."""
freeze_moe_router: bool = False
"""Freeze MoE router parameters during training."""
freeze_moe_router: bool | Literal["auto"] = "auto"
"""Freeze MoE router gate parameters. ``auto`` (default): ``True`` for RL, ``False`` for SFT; a no-op on non-MoE models. Frozen routers get no optimizer state, so resuming a checkpoint saved with a frozen router with ``freeze_moe_router=false`` fails on missing DCP keys."""
lora: LoRAConfig | None = None
"""LoRA configuration. If None, LoRA is disabled."""
@@ -688,6 +688,13 @@ class TrainerConfig(BaseConfig):
self.optim.weight_decay = 0.0
return self
@model_validator(mode="after")
def resolve_freeze_moe_router_auto(self):
"""Resolve ``model.freeze_moe_router='auto'``: RL keeps the pretrained router."""
if self.model.freeze_moe_router == "auto":
self.model.freeze_moe_router = True
return self
@model_validator(mode="after")
def deepep_disables_grad_clipping(self):
if self.model.ep != 1 and self.model.moe.dispatch.type == "deepep" and self.optim.max_norm is not None:
+1 -1
View File
@@ -16,7 +16,7 @@ dependencies = [
"wandb>=0.26.1",
"wandb-workspaces>=0.4.3",
"prime>=0.8.0",
"prime-runs[train]>=0.1.3",
"prime-runs[train]>=0.1.4",
"pyzmq>=27.1.0",
"aiolimiter>=1.2.1",
"tenacity>=8.2.0",
+65 -48
View File
@@ -1,7 +1,7 @@
import logging
import os
import time
from collections.abc import Callable
from collections.abc import Callable, Iterator
from pathlib import Path
from typing import cast
@@ -16,6 +16,7 @@ import torch.nn as nn
from huggingface_hub import snapshot_download
from jaxtyping import Int
from torch import Tensor
from torch.distributed.algorithms._checkpoint.checkpoint_wrapper import CheckpointWrapper
from torch.distributed.checkpoint.hf_storage import HuggingFaceStorageReader
from torch.distributed.checkpoint.state_dict_loader import load as dcp_load
from torch.distributed.fsdp import CPUOffloadPolicy, FSDPModule, MixedPrecisionPolicy, OffloadPolicy, fully_shard
@@ -125,23 +126,26 @@ def freeze_vision_encoder(model: nn.Module, override_attr: str | None = None) ->
logger.info(f"Froze {num_frozen} parameters in vision encoder")
def iter_moe_blocks(model: nn.Module) -> Iterator[MoE]:
"""Yield the MoE MLP of each decoder layer, skipping dense layers."""
for layer in get_language_model(model).layers:
mlp = getattr(layer, "mlp", None)
if isinstance(mlp, MoE):
yield mlp
def freeze_moe_router(model: nn.Module) -> None:
"""Freeze MoE router parameters to maintain stable routing during training."""
logger = get_logger()
language_model = get_language_model(model)
num_frozen = 0
for moe in iter_moe_blocks(model):
for param in moe.router.parameters():
param.requires_grad = False
num_frozen += 1
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):
for param in mlp.router.parameters():
param.requires_grad = False
num_frozen += 1
if num_frozen == 0:
raise ValueError("No MoE router parameters found to freeze. Is this a MoE model?")
logger.info(f"Froze {num_frozen} MoE router parameters")
# No-op for non-MoE models: freeze_moe_router=True is the RL default.
if num_frozen > 0:
logger.info(f"Froze {num_frozen} MoE router parameters")
def apply_fp32_moe_router(model: nn.Module) -> None:
@@ -150,16 +154,12 @@ def apply_fp32_moe_router(model: nn.Module) -> None:
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):
mlp.router.to(torch.float32)
if isinstance(mlp.router, TokenChoiceTopKRouter):
mlp.router.fp32_gate = True
num_routers += 1
for moe in iter_moe_blocks(model):
moe.router.to(torch.float32)
if isinstance(moe.router, TokenChoiceTopKRouter):
moe.router.fp32_gate = True
num_routers += 1
# No-op for non-MoE models: moe_router_dtype='float32' is the default,
# so absence of MoE routers is the common case, not an error.
@@ -177,13 +177,10 @@ def get_full_offload_dtype_policy(
if config.moe_router_dtype != "float32":
return policy
language_model = get_language_model(model)
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):
for param in mlp.router.parameters():
if param.is_floating_point():
policy[id(param)] = (torch.float32, torch.float32)
for moe in iter_moe_blocks(model):
for param in moe.router.parameters():
if param.is_floating_point():
policy[id(param)] = (torch.float32, torch.float32)
return policy
@@ -215,14 +212,10 @@ def freeze_sparse_indexer(model: nn.Module) -> None:
def apply_force_balanced_routing(model: nn.Module) -> None:
"""Force MoE token-choice routers into round-robin assignment for fake-data smoke tests."""
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):
mlp.router.force_balanced = True
num_routers += 1
for moe in iter_moe_blocks(model):
moe.router.force_balanced = True
num_routers += 1
if num_routers == 0:
raise ValueError("No MoE routers found to force-balance. Is this a MoE model?")
@@ -248,13 +241,7 @@ def get_load_balance_stats(
"""
per_layer_max_vio = []
per_layer_routing_confidence = []
language_model = get_language_model(model)
block_mlps = []
for transformer_block in language_model.layers:
# This is necessary for models that have mixed dense layers
block_mlp = getattr(transformer_block, "mlp", None)
if block_mlp is not None and hasattr(block_mlp, "tokens_per_expert"):
block_mlps.append(block_mlp)
block_mlps = list(iter_moe_blocks(model))
if not block_mlps:
return {"max_vio": None, "routing_confidence": None, "tokens_per_expert": torch.empty(0, 0)}
@@ -333,7 +320,7 @@ def compute_expert_load_stats(tokens_per_expert: Tensor) -> dict[str, Tensor]:
def get_expert_load_stats(tokens_per_expert: Tensor, group: dist.ProcessGroup) -> dict[str, float]:
"""Sum a step's per-layer expert counts across the group (every rank routes distinct tokens) and compute load stats."""
if tokens_per_expert.numel() == 0: # MoE model without prime-rl MoE layers (HF impl)
if tokens_per_expert.numel() == 0:
return {}
dist.all_reduce(tokens_per_expert, op=dist.ReduceOp.SUM, group=group)
return {name: value.item() for name, value in compute_expert_load_stats(tokens_per_expert).items()}
@@ -829,12 +816,41 @@ def apply_ac(model: nn.Module, ac_config: ActivationCheckpointConfig):
)
# Int args whose value changes between calls. torch.compile treats an int arg as a constant and recompiles
# whenever it changes, and every other rank waits in collectives until that rank finishes recompiling. Listed
# here, an arg is symbolic from the first compile instead.
DYNAMIC_INT_ARGS = (
# Longest document in the packed row. FlashAttention uses it to size the attention launch grid.
"max_seqlen",
)
def mark_dynamic_int_args() -> None:
"""Add DYNAMIC_INT_ARGS to torch.compiler.config.dynamic_sources, keeping entries already set."""
sources = [source for source in torch.compiler.config.dynamic_sources.split(",") if source]
for arg in DYNAMIC_INT_ARGS:
# Matches the arg passed directly (L['max_seqlen']) or through a wrapper's kwargs (L['kwargs']['max_seqlen']).
pattern = rf".*\['{arg}'\]"
if pattern not in sources:
sources.append(pattern)
torch.compiler.config.dynamic_sources = ",".join(sources)
def apply_compile(model: nn.Module, compile_config: CompileConfig):
torch._dynamo.config.capture_scalar_outputs = True
mark_dynamic_int_args()
language_model = get_language_model(model)
for layer_id in range(len(language_model.layers)):
layer = language_model.layers[layer_id]
if isinstance(layer, CheckpointWrapper) and any(
isinstance(module, FSDPModule) for module in layer._checkpoint_wrapped_module.modules()
):
# A nested FSDP unit's hooks always break the graph, and a break inside a compiled checkpoint
# sends the block to eager, so keep AC eager around the compiled block. pytorch/pytorch#196626
# removes the fp32 router's nested unit by letting it join the block's FSDP unit.
layer = layer._checkpoint_wrapped_module
# Doing it in-place avoids mangled fqn which can break checkpoint loading
language_model.layers[layer_id].compile(fullgraph=compile_config.fullgraph, mode=compile_config.mode)
layer.compile(fullgraph=compile_config.fullgraph, mode=compile_config.mode)
get_logger().info(
f"Compiled {len(language_model.layers)} layers (fullgraph={compile_config.fullgraph}, mode={compile_config.mode})"
)
@@ -995,14 +1011,15 @@ def setup_model(
override_attr=config.vlm.vision_encoder_attr if config.vlm is not None else None,
)
# the right order is AC -> Compile -> FSDP
# the right order is AC -> FSDP -> Compile: compile needs to see which blocks hold nested FSDP units
if config.ac is not None:
apply_ac(model, config.ac)
if config.compile is not None:
apply_compile(model, config.compile)
setup_fsdp(model, config, parallel_dims)
if config.compile is not None:
apply_compile(model, config.compile)
if loading_from_checkpoint_later:
logger.warning(
"Skipping loading weights. Initializing an empty model on device, loading from checkpoint later."
@@ -15,9 +15,9 @@ from transformers.utils import TransformersKwargs
from prime_rl.trainer.models.base import PreTrainedModelPrimeRL
from prime_rl.trainer.models.layers.attn import (
flash_attn_3_varlen_func,
flash_attn_4_varlen_func,
flash_attn_varlen_func,
flash_attn_2_varlen_op,
flash_attn_3_varlen_op,
flash_attn_4_varlen_op,
)
from prime_rl.trainer.models.layers.lm_head import PrimeLmOutput
from prime_rl.trainer.models.layers.mlp import FeedForward
@@ -87,30 +87,25 @@ class AfmoeFlashAttention(AfmoeAttentionBase):
"""AFMoE attention using Flash Attention varlen functions."""
_funcs = {
2: flash_attn_varlen_func,
3: flash_attn_3_varlen_func,
4: flash_attn_4_varlen_func,
2: flash_attn_2_varlen_op,
3: flash_attn_3_varlen_op,
4: flash_attn_4_varlen_op,
}
def __init__(self, config: AfmoeAttentionConfig, flash_attn_version: int = 4):
super().__init__(config)
self._flash_attn_version = flash_attn_version
self.func = self._funcs[flash_attn_version]
self._flash_attn_call = self.func
if self._flash_attn_version == 4:
self._flash_attn_call = torch._dynamo.disable(self.func)
def _compute_attention(self, q: torch.Tensor, k: torch.Tensor, v: torch.Tensor, cu_seqlens, max_seqlen):
"""Run the flash attention kernel. q/k/v are [total_tokens, heads, dim]."""
args = [q, k, v, cu_seqlens, cu_seqlens]
if self._flash_attn_version != 4:
args.extend([max_seqlen, max_seqlen])
kwargs: dict = {"causal": True}
if self.sliding_window is not None:
kwargs["window_size"] = (self.sliding_window - 1, 0)
out = self._flash_attn_call(*args, **kwargs)
if isinstance(out, tuple):
out = out[0]
if self._flash_attn_version == 4:
out, _ = self.func(q, k, v, cu_seqlens_q=cu_seqlens, cu_seqlens_k=cu_seqlens, **kwargs)
else:
out = self.func(q, k, v, cu_seqlens, cu_seqlens, max_seqlen, max_seqlen, **kwargs)
return out
def forward(
+282 -11
View File
@@ -13,14 +13,19 @@ from .rotary_emb import apply_rotary_pos_emb
# flash-attention-2
try:
from flash_attn import flash_attn_varlen_func
from flash_attn.flash_attn_interface import _flash_attn_varlen_backward, _flash_attn_varlen_forward
except ImportError:
flash_attn_varlen_func = None # type: ignore
_flash_attn_varlen_backward = _flash_attn_varlen_forward = None # type: ignore
# flash-attention-3
try:
from flash_attn_interface import _flash_attn_backward as _flash_attn_3_bwd
from flash_attn_interface import _flash_attn_forward as _flash_attn_3_fwd
from flash_attn_interface import flash_attn_varlen_func as flash_attn_3_varlen_func
except ImportError:
flash_attn_3_varlen_func = None # type: ignore
_flash_attn_3_bwd = _flash_attn_3_fwd = None # type: ignore
try:
from flash_attn.cute import flash_attn_varlen_func as flash_attn_4_varlen_func
@@ -30,9 +35,11 @@ except ImportError:
_flash_attn_bwd = _flash_attn_fwd = None # type: ignore
# FA4's flash_attn_varlen_func is a Python autograd.Function that Dynamo cannot trace. Inside a
# checkpointed block that graph break drops the whole block to eager, so FA4 is exposed as an
# opaque custom op instead, which also lets selective activation checkpointing save its output.
# Each FlashAttention version's flash_attn_varlen_func is a Python autograd.Function that Dynamo
# cannot trace (FA2 and FA3 also reject the same cu_seqlens tensor passed as both cu_seqlens_q and
# cu_seqlens_k). Inside a checkpointed block that graph break drops the whole block to eager, so
# each version is exposed as an opaque custom op instead, which also lets selective activation
# checkpointing save its output.
@torch.library.custom_op("prime_rl_attn::flash_attn_4_varlen", mutates_args=())
def _flash_attn_4_varlen(
q: torch.Tensor,
@@ -40,6 +47,8 @@ def _flash_attn_4_varlen(
v: torch.Tensor,
cu_seqlens_q: torch.Tensor,
cu_seqlens_k: torch.Tensor,
max_seqlen_q: int | None,
max_seqlen_k: int | None,
causal: bool,
window_size_left: int | None,
window_size_right: int | None,
@@ -50,6 +59,8 @@ def _flash_attn_4_varlen(
v,
cu_seqlens_q=cu_seqlens_q,
cu_seqlens_k=cu_seqlens_k,
max_seqlen_q=max_seqlen_q,
max_seqlen_k=max_seqlen_k,
causal=causal,
window_size_left=window_size_left,
window_size_right=window_size_right,
@@ -59,7 +70,7 @@ def _flash_attn_4_varlen(
@_flash_attn_4_varlen.register_fake
def _(q, k, v, cu_seqlens_q, cu_seqlens_k, causal, window_size_left, window_size_right):
def _(q, k, v, *args):
out = q.new_empty((*q.shape[:-1], v.shape[-1]))
lse = q.new_empty((q.shape[1], q.shape[0]), dtype=torch.float32)
return out, lse
@@ -75,6 +86,8 @@ def _flash_attn_4_varlen_backward(
lse: torch.Tensor,
cu_seqlens_q: torch.Tensor,
cu_seqlens_k: torch.Tensor,
max_seqlen_q: int | None,
max_seqlen_k: int | None,
causal: bool,
window_size_left: int | None,
window_size_right: int | None,
@@ -91,19 +104,24 @@ def _flash_attn_4_varlen_backward(
window_size_right=window_size_right,
cu_seqlens_q=cu_seqlens_q,
cu_seqlens_k=cu_seqlens_k,
max_seqlen_q=max_seqlen_q,
max_seqlen_k=max_seqlen_k,
)
return dq, dk, dv
@_flash_attn_4_varlen_backward.register_fake
def _(dout, q, k, v, out, lse, cu_seqlens_q, cu_seqlens_k, causal, window_size_left, window_size_right):
def _(dout, q, k, v, *args):
return torch.empty_like(q), torch.empty_like(k), torch.empty_like(v)
def _flash_attn_4_varlen_setup_context(ctx, inputs, output) -> None:
q, k, v, cu_seqlens_q, cu_seqlens_k, causal, window_size_left, window_size_right = inputs
q, k, v, cu_seqlens_q, cu_seqlens_k, max_seqlen_q, max_seqlen_k, causal, window_size_left, window_size_right = (
inputs
)
out, lse = output
ctx.save_for_backward(q, k, v, out, lse, cu_seqlens_q, cu_seqlens_k)
ctx.max_seqlen = (max_seqlen_q, max_seqlen_k)
ctx.causal = causal
ctx.window_size = (window_size_left, window_size_right)
@@ -111,9 +129,9 @@ def _flash_attn_4_varlen_setup_context(ctx, inputs, output) -> None:
def _flash_attn_4_varlen_autograd(ctx, dout: torch.Tensor, _dlse: torch.Tensor | None):
q, k, v, out, lse, cu_seqlens_q, cu_seqlens_k = ctx.saved_tensors
dq, dk, dv = _flash_attn_4_varlen_backward(
dout.contiguous(), q, k, v, out, lse, cu_seqlens_q, cu_seqlens_k, ctx.causal, *ctx.window_size
dout.contiguous(), q, k, v, out, lse, cu_seqlens_q, cu_seqlens_k, *ctx.max_seqlen, ctx.causal, *ctx.window_size
)
return dq, dk, dv, None, None, None, None, None
return dq, dk, dv, None, None, None, None, None, None, None
_flash_attn_4_varlen.register_autograd(_flash_attn_4_varlen_autograd, setup_context=_flash_attn_4_varlen_setup_context)
@@ -126,11 +144,264 @@ def flash_attn_4_varlen_op(
*,
cu_seqlens_q: torch.Tensor,
cu_seqlens_k: torch.Tensor,
max_seqlen_q: int | None = None,
max_seqlen_k: int | None = None,
causal: bool = False,
window_size: tuple[int | None, int | None] = (None, None),
) -> tuple[torch.Tensor, torch.Tensor]:
"""Drop-in for FA4's ``flash_attn_varlen_func`` as called by ``FlashAttention``, routed through the custom op."""
return _flash_attn_4_varlen(q, k, v, cu_seqlens_q, cu_seqlens_k, causal, window_size[0], window_size[1])
return _flash_attn_4_varlen(
q, k, v, cu_seqlens_q, cu_seqlens_k, max_seqlen_q, max_seqlen_k, causal, window_size[0], window_size[1]
)
@torch.library.custom_op("prime_rl_attn::flash_attn_3_varlen", mutates_args=())
def _flash_attn_3_varlen(
q: torch.Tensor,
k: torch.Tensor,
v: torch.Tensor,
cu_seqlens_q: torch.Tensor,
cu_seqlens_k: torch.Tensor,
max_seqlen_q: int,
max_seqlen_k: int,
softmax_scale: float,
causal: bool,
window_size_left: int,
window_size_right: int,
) -> tuple[torch.Tensor, torch.Tensor]:
out, lse, _, _ = _flash_attn_3_fwd(
q,
k,
v,
cu_seqlens_q=cu_seqlens_q,
cu_seqlens_k=cu_seqlens_k,
max_seqlen_q=max_seqlen_q,
max_seqlen_k=max_seqlen_k,
softmax_scale=softmax_scale,
causal=causal,
window_size_left=window_size_left,
window_size_right=window_size_right,
)
return out, lse
@_flash_attn_3_varlen.register_fake
def _(q, k, v, *args):
out = q.new_empty((*q.shape[:-1], v.shape[-1]))
lse = q.new_empty((q.shape[1], q.shape[0]), dtype=torch.float32)
return out, lse
@torch.library.custom_op("prime_rl_attn::flash_attn_3_varlen_backward", mutates_args=())
def _flash_attn_3_varlen_backward(
dout: torch.Tensor,
q: torch.Tensor,
k: torch.Tensor,
v: torch.Tensor,
out: torch.Tensor,
lse: torch.Tensor,
cu_seqlens_q: torch.Tensor,
cu_seqlens_k: torch.Tensor,
max_seqlen_q: int,
max_seqlen_k: int,
softmax_scale: float,
causal: bool,
window_size_left: int,
window_size_right: int,
) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
dq, dk, dv = torch.empty_like(q), torch.empty_like(k), torch.empty_like(v)
_flash_attn_3_bwd(
dout,
q,
k,
v,
out,
lse,
cu_seqlens_q=cu_seqlens_q,
cu_seqlens_k=cu_seqlens_k,
max_seqlen_q=max_seqlen_q,
max_seqlen_k=max_seqlen_k,
dq=dq,
dk=dk,
dv=dv,
softmax_scale=softmax_scale,
is_causal=causal,
window_size_left=window_size_left,
window_size_right=window_size_right,
)
return dq, dk, dv
@_flash_attn_3_varlen_backward.register_fake
def _(dout, q, k, v, *args):
return torch.empty_like(q), torch.empty_like(k), torch.empty_like(v)
# FA2's public flash_attn_varlen_func pads the head dim to a multiple of 8 around its kernels; these ops call
# the kernels directly, so they pad the same way.
def pad_head_dim_to_multiple_of_8_for_fa2(t: torch.Tensor) -> torch.Tensor:
head_dim = t.shape[-1]
if head_dim % 8 == 0:
return t
return torch.nn.functional.pad(t, [0, 8 - head_dim % 8])
@torch.library.custom_op("prime_rl_attn::flash_attn_2_varlen", mutates_args=())
def _flash_attn_2_varlen(
q: torch.Tensor,
k: torch.Tensor,
v: torch.Tensor,
cu_seqlens_q: torch.Tensor,
cu_seqlens_k: torch.Tensor,
max_seqlen_q: int,
max_seqlen_k: int,
softmax_scale: float,
causal: bool,
window_size_left: int,
window_size_right: int,
) -> tuple[torch.Tensor, torch.Tensor]:
head_dim = q.shape[-1]
q, k, v = (pad_head_dim_to_multiple_of_8_for_fa2(t) for t in (q, k, v))
out_padded, lse, _, _ = _flash_attn_varlen_forward(
q,
k,
v,
cu_seqlens_q,
cu_seqlens_k,
max_seqlen_q,
max_seqlen_k,
0.0,
softmax_scale,
causal=causal,
window_size_left=window_size_left,
window_size_right=window_size_right,
)
return out_padded[..., :head_dim], lse
# FA2's kernel allocates its outputs with empty_like on the padded inputs, so the fakes keep their strides and padding.
@_flash_attn_2_varlen.register_fake
def _(q, k, v, *args):
head_dim = q.shape[-1]
out = torch.empty_like(pad_head_dim_to_multiple_of_8_for_fa2(q))[..., :head_dim]
lse = q.new_empty((q.shape[1], q.shape[0]), dtype=torch.float32)
return out, lse
@torch.library.custom_op("prime_rl_attn::flash_attn_2_varlen_backward", mutates_args=())
def _flash_attn_2_varlen_backward(
dout: torch.Tensor,
q: torch.Tensor,
k: torch.Tensor,
v: torch.Tensor,
out: torch.Tensor,
lse: torch.Tensor,
cu_seqlens_q: torch.Tensor,
cu_seqlens_k: torch.Tensor,
max_seqlen_q: int,
max_seqlen_k: int,
softmax_scale: float,
causal: bool,
window_size_left: int,
window_size_right: int,
) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
head_dim = q.shape[-1]
dout, q, k, v, out = (pad_head_dim_to_multiple_of_8_for_fa2(t) for t in (dout, q, k, v, out))
dq, dk, dv = torch.empty_like(q), torch.empty_like(k), torch.empty_like(v)
_flash_attn_varlen_backward(
dout,
q,
k,
v,
out,
lse,
dq,
dk,
dv,
cu_seqlens_q,
cu_seqlens_k,
max_seqlen_q,
max_seqlen_k,
0.0,
softmax_scale,
causal,
window_size_left,
window_size_right,
0.0,
None,
False,
)
return dq[..., :head_dim], dk[..., :head_dim], dv[..., :head_dim]
@_flash_attn_2_varlen_backward.register_fake
def _(dout, q, k, v, *args):
head_dim = q.shape[-1]
return tuple(torch.empty_like(pad_head_dim_to_multiple_of_8_for_fa2(t))[..., :head_dim] for t in (q, k, v))
def _flash_attn_varlen_setup_context(ctx, inputs, output) -> None:
q, k, v, cu_seqlens_q, cu_seqlens_k, *scalar_args = inputs
out, lse = output
ctx.save_for_backward(q, k, v, out, lse, cu_seqlens_q, cu_seqlens_k)
ctx.scalar_args = scalar_args
def _flash_attn_varlen_autograd(backward_op, ctx, dout: torch.Tensor, _dlse: torch.Tensor | None):
dq, dk, dv = backward_op(dout.contiguous(), *ctx.saved_tensors, *ctx.scalar_args)
return dq, dk, dv, None, None, None, None, None, None, None, None
_flash_attn_2_varlen.register_autograd(
functools.partial(_flash_attn_varlen_autograd, _flash_attn_2_varlen_backward),
setup_context=_flash_attn_varlen_setup_context,
)
_flash_attn_3_varlen.register_autograd(
functools.partial(_flash_attn_varlen_autograd, _flash_attn_3_varlen_backward),
setup_context=_flash_attn_varlen_setup_context,
)
def flash_attn_2_varlen_op(
q: torch.Tensor,
k: torch.Tensor,
v: torch.Tensor,
cu_seqlens_q: torch.Tensor,
cu_seqlens_k: torch.Tensor,
max_seqlen_q: int,
max_seqlen_k: int,
softmax_scale: float | None = None,
causal: bool = False,
window_size: tuple[int, int] = (-1, -1),
) -> torch.Tensor:
"""Drop-in for FA2's ``flash_attn_varlen_func``, routed through the custom op."""
if softmax_scale is None:
softmax_scale = q.shape[-1] ** -0.5
out, _ = _flash_attn_2_varlen(
q, k, v, cu_seqlens_q, cu_seqlens_k, max_seqlen_q, max_seqlen_k, softmax_scale, causal, *window_size
)
return out
def flash_attn_3_varlen_op(
q: torch.Tensor,
k: torch.Tensor,
v: torch.Tensor,
cu_seqlens_q: torch.Tensor,
cu_seqlens_k: torch.Tensor,
max_seqlen_q: int,
max_seqlen_k: int,
softmax_scale: float | None = None,
causal: bool = False,
window_size: tuple[int, int] = (-1, -1),
) -> torch.Tensor:
"""Drop-in for FA3's ``flash_attn_varlen_func``, routed through the custom op."""
if softmax_scale is None:
softmax_scale = q.shape[-1] ** -0.5
out, _ = _flash_attn_3_varlen(
q, k, v, cu_seqlens_q, cu_seqlens_k, max_seqlen_q, max_seqlen_k, softmax_scale, causal, *window_size
)
return out
@dataclass
@@ -158,8 +429,8 @@ class FlashAttention(nn.Module):
supported_fusions = {"qkv": fuse_qkv_projections}
_funcs = {
2: flash_attn_varlen_func,
3: flash_attn_3_varlen_func,
2: flash_attn_2_varlen_op,
3: flash_attn_3_varlen_op,
4: flash_attn_4_varlen_op,
}
@@ -176,15 +176,15 @@ def substitute_ulysses_attn(
# Resolve flash kernel + version from attn_impl.
if attn_impl == "flash_attention_4":
from flash_attn.cute import flash_attn_varlen_func as flash_fn
from prime_rl.trainer.models.layers.attn import flash_attn_4_varlen_op as flash_fn
flash_attn_version = 4
elif attn_impl == "flash_attention_3":
from flash_attn_interface import flash_attn_varlen_func as flash_fn
from prime_rl.trainer.models.layers.attn import flash_attn_3_varlen_op as flash_fn
flash_attn_version = 3
else:
from flash_attn import flash_attn_varlen_func as flash_fn
from prime_rl.trainer.models.layers.attn import flash_attn_2_varlen_op as flash_fn
flash_attn_version = 2
@@ -6,9 +6,9 @@ from torch import nn
from transformers.modeling_outputs import BaseModelOutputWithPooling
from prime_rl.trainer.models.layers.attn import (
flash_attn_3_varlen_func,
flash_attn_4_varlen_func,
flash_attn_varlen_func,
flash_attn_2_varlen_op,
flash_attn_3_varlen_op,
flash_attn_4_varlen_op,
)
from prime_rl.trainer.models.layers.rotary_emb import rotate_half
from prime_rl.trainer.models.qwen3_5.configuration_qwen3_5 import Qwen3_5VisionConfig
@@ -69,9 +69,9 @@ class Qwen3_5VisionMLP(nn.Module):
class Qwen3_5VisionAttention(nn.Module):
FLASH_ATTENTION_FUNCTIONS = {
"flash_attention_2": flash_attn_varlen_func,
"flash_attention_3": flash_attn_3_varlen_func,
"flash_attention_4": flash_attn_4_varlen_func,
"flash_attention_2": flash_attn_2_varlen_op,
"flash_attention_3": flash_attn_3_varlen_op,
"flash_attention_4": flash_attn_4_varlen_op,
}
def __init__(self, config: Qwen3_5VisionConfig) -> None:
+10
View File
@@ -343,6 +343,16 @@ def test_moe_router_dtype_auto_resolves_per_trainer():
assert config_cls.model_validate({"model": {"moe_router_dtype": dtype}}).model.moe_router_dtype == dtype
def test_freeze_moe_router_auto_resolves_per_trainer():
"""``freeze_moe_router='auto'`` (the default) freezes the router for RL, not SFT; explicit values are kept."""
assert TrainerConfig.model_validate({}).model.freeze_moe_router is True
assert SFTConfig.model_validate({}).model.freeze_moe_router is False
for config_cls in (TrainerConfig, SFTConfig):
for freeze in (True, False):
assert config_cls.model_validate({"model": {"freeze_moe_router": freeze}}).model.freeze_moe_router is freeze
@pytest.mark.parametrize("config_cls", [TrainerConfig, SFTConfig])
def test_full_optimizer_offload_disables_gradient_clipping(config_cls):
with pytest.warns(UserWarning, match="Gradient clipping prevents optimizer-in-backward"):
Generated
+4 -4
View File
@@ -5173,7 +5173,7 @@ requires-dist = [
{ name = "prime-rl", extras = ["quack"], marker = "extra == 'all'" },
{ name = "prime-rl", extras = ["sonic-moe"], marker = "extra == 'all'" },
{ name = "prime-rl-configs", editable = "packages/prime-rl-configs" },
{ name = "prime-runs", extras = ["train"], specifier = ">=0.1.3" },
{ name = "prime-runs", extras = ["train"], specifier = ">=0.1.4" },
{ name = "prometheus-client", specifier = ">=0.20.0" },
{ name = "psutil", specifier = ">=7.0.0" },
{ name = "pybase64", specifier = ">=1.4.2" },
@@ -5246,15 +5246,15 @@ requires-dist = [
[[package]]
name = "prime-runs"
version = "0.1.3"
version = "0.1.4"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "httpx" },
{ name = "prime-traces" },
]
sdist = { url = "https://files.pythonhosted.org/packages/3f/ba/3d38aeafc0ef885eef7b99bbe26fe350b4248af8d3fa89d4ca8a249f0f04/prime_runs-0.1.3.tar.gz", hash = "sha256:181ab1c720ed9113abbf3719ba6863c9ee23c55309101c0b7f4021ff9dafbe20", size = 65541, upload-time = "2026-09-17T15:31:42.319Z" }
sdist = { url = "https://files.pythonhosted.org/packages/6c/de/6fb503ce854315d096982b79340b02eb5a978b139a7c719d39df77e7f211/prime_runs-0.1.4.tar.gz", hash = "sha256:f06c2bc7db28f0ed99ca6b06aa5186245ca94009872eb861ab0be7cff25484bd", size = 67282, upload-time = "2026-10-08T00:23:59.354Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/6e/93/5fff685470a6cb12fc93192432951a081de70e271aef1cebc506fba4ccc5/prime_runs-0.1.3-py3-none-any.whl", hash = "sha256:86c3d5183ed5848854a194233b4a9451deabea56a9063771244c5c54c00d69df", size = 45087, upload-time = "2026-09-17T15:31:40.913Z" },
{ url = "https://files.pythonhosted.org/packages/ba/51/8f300ac057c95afa9df591172b2e8374743afdeeae300771fd78c91a5f75/prime_runs-0.1.4-py3-none-any.whl", hash = "sha256:f33b477c2d53eca08524a3d469810943eee31af8f60ceffc38ef2b9c90596d1b", size = 46253, upload-time = "2026-10-08T00:23:57.736Z" },
]
[package.optional-dependencies]