Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7bcd1b1f5 | ||
|
|
4d8df5120e | ||
|
|
6b1604380c | ||
|
|
013a7f8c25 | ||
|
|
3ff7902a73 | ||
|
|
c9acaa3c90 | ||
|
|
c7dc7929a0 | ||
|
|
0d2a7f5a12 | ||
|
|
1cb5d91ab2 | ||
|
|
d05744678e | ||
|
|
67c20ba8c8 | ||
|
|
683377520e |
@@ -116,7 +116,6 @@ jobs:
|
||||
build:
|
||||
name: Build and push (${{ matrix.suffix }})
|
||||
needs: prepare
|
||||
environment: ghcr-publish
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
|
||||
|
||||
+2
-6
@@ -91,10 +91,6 @@ COPY scripts/docker-editable-pretend-versions.sh /app/scripts/docker-editable-pr
|
||||
# Use submodule git metadata from the build context when present. Docker copies
|
||||
# only the submodule .git pointer files into /app/deps, so we temporarily link
|
||||
# /app/.git/modules to the read-only context before resolving versions.
|
||||
# Opt-in extras for disaggregated P/D inference (deep-ep, deep-gemm, quack).
|
||||
# Default off — they're heavy source builds only the disagg-MoE path needs.
|
||||
# Enable via `--build-arg INCLUDE_DISAGG_EXTRAS=1`.
|
||||
ARG INCLUDE_DISAGG_EXTRAS=0
|
||||
ARG VERIFIERS_PRETEND_VERSION
|
||||
ARG RENDERERS_PRETEND_VERSION
|
||||
RUN --mount=type=cache,target=/app/.cache/uv \
|
||||
@@ -109,9 +105,9 @@ RUN --mount=type=cache,target=/app/.cache/uv \
|
||||
&& \
|
||||
sed -i "s/fallback-version = \"0.0.0\"/fallback-version = \"${RENDERERS_PRETEND_VERSION}\"/" /app/deps/renderers/pyproject.toml \
|
||||
&& \
|
||||
EXTRA_DISAGG_FLAG=""; if [ "$INCLUDE_DISAGG_EXTRAS" = "1" ]; then EXTRA_DISAGG_FLAG="--extra disagg"; fi \
|
||||
uv sync --all-packages --extra flash-attn --extra flash-attn-3 --extra flash-attn-cute --extra disagg --extra gpt-oss --extra modelexpress --extra quack --group mamba-ssm --locked --no-dev \
|
||||
&& \
|
||||
uv sync --all-packages --extra flash-attn --extra flash-attn-3 --extra flash-attn-cute --extra gpt-oss --extra modelexpress $EXTRA_DISAGG_FLAG --group mamba-ssm --locked --no-dev
|
||||
/app/.venv/bin/python -c 'from importlib.metadata import version; [version(name) for name in ("deep-ep", "deep-gemm", "mamba-ssm", "nixl", "quack-kernels", "vllm", "vllm-router")]'
|
||||
|
||||
# Optional: build NIXL from source against the UCX 1.19 baked above. The PyPI
|
||||
# nixl wheel ships its own UCX which segfaults on prefill→decode KV transfer
|
||||
|
||||
Vendored
+1
-1
Submodule deps/renderers updated: fa04acd916...201f88516c
Vendored
+1
-1
Submodule deps/research-environments updated: 06232831fd...dd80d75bc8
Vendored
+1
-1
Submodule deps/verifiers updated: 31415cd32a...19fdd9cae1
+15
-1
@@ -36,7 +36,21 @@ impl = "custom" # or "hf" to force the HF path
|
||||
| GLM-4 / GLM-4.5 / INTELLECT-3 | `THUDM/GLM-4-9B-0414`, `zai-org/GLM-4.5`, `PrimeIntellect/INTELLECT-3`, … | ✅ | ✅ |
|
||||
| GPT-OSS (HF MoE) | `openai/gpt-oss-20b`, `openai/gpt-oss-120b` | ❌ | ✅ |
|
||||
|
||||
The custom path enables you to set EP, CP, selective activation checkpointing, FP8 training (`model.fp8 = true`, requires SM90+), and faster MoE kernels (`moe_use_grouped_mm = true`, default). Forcing `impl = "hf"` is mostly useful when debugging — it's slower and disables most MoE-specific knobs.
|
||||
The custom path enables you to set EP, CP, selective activation checkpointing, low-precision training (`[trainer.model.quantization]`), and faster MoE kernels (`moe_use_grouped_mm = true`, default). Forcing `impl = "hf"` is mostly useful when debugging — it's slower and disables most MoE-specific knobs.
|
||||
|
||||
### Low-precision training
|
||||
|
||||
Set `[trainer.model.quantization]` to train dense linears and MoE expert GEMMs in low precision. Two backends are available via the `type` discriminator:
|
||||
|
||||
- `type = "fp8"` — DeepGEMM FP8 blockwise (requires SM90+ / Hopper). Options: `enable_grouped_gemm` (FP8 MoE expert GEMM). Both default on.
|
||||
- `type = "mxfp8"` — torchao MXFP8 microscaling (requires SM100+ / Blackwell). Options: `enable_grouped_gemm`, `enable_a2a` (MXFP8 expert-parallel all-to-all), and `recipe` (`mxfp8_rceil` default or `mxfp8_rceil_wgrad_with_hp`).
|
||||
|
||||
```toml
|
||||
[trainer.model.quantization]
|
||||
type = "mxfp8"
|
||||
recipe = "mxfp8_rceil"
|
||||
enable_a2a = true
|
||||
```
|
||||
|
||||
GLM-5.2 adds IndexShare: the DSA sparse-attention indexer runs only on a subset of layers and the remaining layers reuse the cached top-k indices. The trainer reads this schedule from the model's `indexer_types` config field and enables the index cache automatically, so no extra config is needed. To override the schedule manually, set `[trainer.model.index_cache]` (`topk_freq` or `topk_pattern`).
|
||||
|
||||
|
||||
@@ -107,6 +107,8 @@ ep_comm_backend = "torch" # or "deepep"
|
||||
|
||||
CP shards a single sequence across multiple GPUs along the token dimension — for long-context sequences. We reccomend using `ulysses` style CP for most of the models to get the most throughput. Some models (e.g. GLM-5) only support `ring` style CP. Wrong setting will be rejected on validation.
|
||||
|
||||
`ulysses` head-shards Q/K/V, so the CP degree must divide `num_attention_heads`. GQA models with fewer KV heads than the CP degree (e.g. NemotronH: 32 query heads, 2 KV heads) are supported via KV-head replication; the CP degree must then be a multiple of `num_key_value_heads`. Hybrid Mamba layers head-shard independently (`cp_mamba`), which requires the CP degree to divide `mamba_num_heads` and `n_groups`.
|
||||
|
||||
```toml
|
||||
[trainer.model]
|
||||
impl = "custom"
|
||||
|
||||
@@ -61,7 +61,9 @@ fused_lm_head_token_chunk_size = 1024
|
||||
cp = 4 # context parallel for the 131K seq len
|
||||
ep = 8
|
||||
optim_cpu_offload = true
|
||||
fp8 = true
|
||||
|
||||
[trainer.model.quantization]
|
||||
type = "fp8"
|
||||
|
||||
[trainer.model.ac]
|
||||
freq = 1
|
||||
|
||||
@@ -116,6 +116,42 @@ class DebugModelConfig(BaseConfig):
|
||||
"""Replace MoE token-choice routing with a round-robin assignment so every expert sees an equal share. Intended for fake-data smoke tests where untrained routing would otherwise OOM under severe imbalance. Gating scores are still gathered from the override indices so the forward pass stays consistent."""
|
||||
|
||||
|
||||
MXFP8Recipe: TypeAlias = Literal["mxfp8_rceil", "mxfp8_rceil_wgrad_with_hp"]
|
||||
|
||||
_DEFAULT_FP8_IGNORE_PATTERNS: list[str] = [
|
||||
"lm_head",
|
||||
"router",
|
||||
# Use escaped dots — re.search treats `.` as any-char, so the previous
|
||||
# "mlp.gate." pattern was also matching dense MLP `mlp.gate_proj` (the
|
||||
# trailing `.` was matching `_`). That left the dense MLP gate projection
|
||||
# in BF16 on the trainer while inference quantized it to FP8, causing
|
||||
# hidden-state drift before the MoE router.
|
||||
r"mlp\.gate\.",
|
||||
"shared_expert_gate", # Qwen3.5 MoE: nn.Linear(hidden, 1, bias=False)
|
||||
"eh_proj",
|
||||
"weights_proj",
|
||||
"in_proj_a",
|
||||
"in_proj_b",
|
||||
]
|
||||
|
||||
|
||||
class FP8Config(BaseConfig):
|
||||
type: Literal["fp8"] = "fp8"
|
||||
enable_grouped_gemm: bool = True
|
||||
ignore_patterns: list[str] = _DEFAULT_FP8_IGNORE_PATTERNS
|
||||
|
||||
|
||||
class MXFP8Config(BaseConfig):
|
||||
type: Literal["mxfp8"] = "mxfp8"
|
||||
recipe: MXFP8Recipe = "mxfp8_rceil"
|
||||
enable_grouped_gemm: bool = True
|
||||
enable_a2a: bool = True
|
||||
ignore_patterns: list[str] = _DEFAULT_FP8_IGNORE_PATTERNS
|
||||
|
||||
|
||||
QuantizationConfig: TypeAlias = Annotated[FP8Config | MXFP8Config, Field(discriminator="type")]
|
||||
|
||||
|
||||
class ModelConfig(BaseModelConfig):
|
||||
conversion_dir: Path | None = None
|
||||
"""Directory for the auto-converted weights (written to a `prime`/`hf` subdirectory). If not set, we write into the model snapshot directory."""
|
||||
@@ -180,8 +216,7 @@ class ModelConfig(BaseModelConfig):
|
||||
moe_use_grouped_mm: bool = True
|
||||
"""Use grouped mm for MoE layers. Requires compute capability ≥ 9.0."""
|
||||
|
||||
fp8: bool = False
|
||||
"""FP8 training via DeepGEMM. Replaces ``nn.Linear`` with FP8 blockwise linear and uses FP8 grouped GEMM for MoE experts. Requires SM90 (Hopper) GPUs and ``model.impl='custom'``."""
|
||||
quantization: QuantizationConfig | None = None
|
||||
|
||||
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."""
|
||||
@@ -255,9 +290,9 @@ class ModelConfig(BaseModelConfig):
|
||||
return self
|
||||
|
||||
@model_validator(mode="after")
|
||||
def fp8_only_with_custom_impl(self):
|
||||
if self.fp8 and self.impl not in ("custom", "auto"):
|
||||
raise ValueError("FP8 training is only supported with model.impl='custom' or 'auto'.")
|
||||
def quantization_only_with_custom_impl(self):
|
||||
if self.quantization is not None and self.impl not in ("custom", "auto"):
|
||||
raise ValueError(f"{self.quantization.type} training is only supported with model.impl='custom' or 'auto'.")
|
||||
return self
|
||||
|
||||
@model_validator(mode="after")
|
||||
@@ -270,6 +305,12 @@ class ModelConfig(BaseModelConfig):
|
||||
|
||||
return self
|
||||
|
||||
@model_validator(mode="after")
|
||||
def mxfp8_only_with_torch_ep_backend(self):
|
||||
if isinstance(self.quantization, MXFP8Config) and self.ep_comm_backend != "torch":
|
||||
raise ValueError("MXFP8 quantization requires model.ep_comm_backend='torch'.")
|
||||
return self
|
||||
|
||||
|
||||
class TokenizerConfig(BaseConfig):
|
||||
name: str | None = None
|
||||
|
||||
+8
-2
@@ -44,6 +44,7 @@ dependencies = [
|
||||
"orjson>=3.10",
|
||||
"pandas>=2.0",
|
||||
"msgspec>=0.18",
|
||||
"torchao>=0.17.0",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
@@ -67,7 +68,7 @@ flash-attn-cute = [
|
||||
"flash-attn-4",
|
||||
]
|
||||
disagg = [
|
||||
"deep-ep ; platform_machine == 'x86_64'",
|
||||
"deep-ep ; platform_machine == 'x86_64' or platform_machine == 'aarch64'",
|
||||
"deep-gemm",
|
||||
"nixl",
|
||||
"nixl-cu12 ; platform_machine == 'x86_64'",
|
||||
@@ -179,6 +180,7 @@ dion = false
|
||||
deep-ep = false
|
||||
deep-gemm = false
|
||||
nixl-cu12 = false
|
||||
torchao = false
|
||||
|
||||
[tool.uv.sources]
|
||||
prime-rl-configs = { path = "packages/prime-rl-configs", editable = true }
|
||||
@@ -193,6 +195,7 @@ torch = { index = "pytorch-cu128" }
|
||||
torchvision = { index = "pytorch-cu128" }
|
||||
torchaudio = { index = "pytorch-cu128" }
|
||||
torchtitan = { git = "https://github.com/pytorch/torchtitan", rev = "23e4dfc" }
|
||||
torchao = { url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.6.0/torchao-0.17.0+git02105d46c-cp312-cp312-linux_x86_64.whl", marker = "platform_machine == 'x86_64'" }
|
||||
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 = [
|
||||
@@ -203,7 +206,10 @@ vllm = [
|
||||
{ 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-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", marker = "platform_machine == 'x86_64'" },
|
||||
{ url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_ep-1.1.0+1fd57b0-cp312-cp312-linux_aarch64.whl", marker = "platform_machine == 'aarch64'" },
|
||||
]
|
||||
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", marker = "platform_machine == 'x86_64'" },
|
||||
{ url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_gemm-2.5.0+891d57b-cp312-cp312-linux_aarch64.whl", marker = "platform_machine == 'aarch64'" },
|
||||
|
||||
+32
-6
@@ -2,11 +2,13 @@
|
||||
|
||||
SESSION_NAME="prime-rl"
|
||||
OUTPUT_DIR="outputs"
|
||||
AGENT="claude"
|
||||
|
||||
# Optional CLI parsing
|
||||
# Supports:
|
||||
# -s|--session-name NAME
|
||||
# -o|--output-dir DIR
|
||||
# -a|--agent AGENT (claude|codex, default: claude)
|
||||
# Positional: [SESSION_NAME [OUTPUT_DIR]]
|
||||
POSITIONAL=()
|
||||
while [[ $# -gt 0 ]]; do
|
||||
@@ -27,8 +29,17 @@ while [[ $# -gt 0 ]]; do
|
||||
OUTPUT_DIR="$2"
|
||||
shift 2
|
||||
;;
|
||||
-a|--agent)
|
||||
if [[ -z "$2" ]]; then
|
||||
echo "Error: --agent requires a value (claude|codex)" >&2
|
||||
exit 1
|
||||
fi
|
||||
AGENT="$2"
|
||||
shift 2
|
||||
;;
|
||||
-h|--help)
|
||||
echo "Usage: $0 [-s SESSION_NAME] [-o OUTPUT_DIR] [SESSION_NAME [OUTPUT_DIR]]" >&2
|
||||
echo "Usage: $0 [-s SESSION_NAME] [-o OUTPUT_DIR] [-a AGENT] [SESSION_NAME [OUTPUT_DIR]]" >&2
|
||||
echo " -a, --agent claude|codex (default: claude)" >&2
|
||||
exit 0
|
||||
;;
|
||||
--)
|
||||
@@ -86,10 +97,10 @@ tmux send-keys -t "$SESSION_NAME:Logs.2" \
|
||||
tmux send-keys -t "$SESSION_NAME:Logs.3" \
|
||||
"tail -F ${LOG_DIR}/inference.log 2>/dev/null" C-m
|
||||
|
||||
# Window 2: Claude Code with log context
|
||||
tmux new-window -t "$SESSION_NAME" -n "Claude"
|
||||
tmux send-keys -t "$SESSION_NAME:Claude" \
|
||||
"claude --permission-mode auto --append-system-prompt 'You are monitoring a prime-rl training run. The output directory is ${OUTPUT_DIR}. Log paths:
|
||||
# Window 2: Agent (claude code or codex) with log context
|
||||
tmux new-window -t "$SESSION_NAME" -n "Agent"
|
||||
|
||||
AGENT_PROMPT="You are monitoring a prime-rl training run. The output directory is ${OUTPUT_DIR}. Log paths:
|
||||
Trainer: ${LOG_DIR}/trainer.log
|
||||
All nodes: ${LOG_DIR}/trainer/node_*.log
|
||||
All ranks: ${LOG_DIR}/trainer/torchrun/*/*/*/*.log
|
||||
@@ -98,7 +109,22 @@ tmux send-keys -t "$SESSION_NAME:Claude" \
|
||||
Envs: ${LOG_DIR}/envs/*/*.log
|
||||
Train envs: ${LOG_DIR}/envs/train/*.log
|
||||
You are running inside tmux session \"${SESSION_NAME}\". The Launcher window (window 0) is where the user runs launch commands. You can read its contents with: tmux capture-pane -t ${SESSION_NAME}:Launcher -p
|
||||
Help the user monitor and debug this run.'" C-m
|
||||
Help the user monitor and debug this run."
|
||||
|
||||
case "$AGENT" in
|
||||
claude)
|
||||
tmux send-keys -t "$SESSION_NAME:Agent" \
|
||||
"claude --permission-mode auto --append-system-prompt \"${AGENT_PROMPT}\"" C-m
|
||||
;;
|
||||
codex)
|
||||
tmux send-keys -t "$SESSION_NAME:Agent" \
|
||||
"codex --yolo \"${AGENT_PROMPT}\"" C-m
|
||||
;;
|
||||
*)
|
||||
echo "Error: unknown agent '$AGENT' (expected claude|codex)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Pane title styling
|
||||
tmux set-option -t "$SESSION_NAME" -g pane-border-status top
|
||||
|
||||
@@ -15,15 +15,21 @@ def serialize_routed_experts(routed_experts: Any, start: int = 0) -> dict[str, A
|
||||
array = np.asarray(routed_experts)
|
||||
assert array.ndim == 3
|
||||
assert np.issubdtype(array.dtype, np.integer)
|
||||
dtype = np.uint8
|
||||
if array.size:
|
||||
assert array.min() >= 0
|
||||
assert array.max() <= np.iinfo(np.uint8).max
|
||||
if array.max() > np.iinfo(np.uint8).max:
|
||||
# Models with >256 experts (e.g. NemotronH Super/Ultra: 512) need wider
|
||||
# indices. The payload self-describes via "dtype" so consumers pick it up.
|
||||
assert array.max() <= np.iinfo(np.uint16).max
|
||||
dtype = np.uint16
|
||||
|
||||
compact = np.ascontiguousarray(array.astype(np.uint8, copy=False))
|
||||
compact = np.ascontiguousarray(array.astype(dtype, copy=False))
|
||||
return {
|
||||
"data": pybase64.b64encode(memoryview(compact)).decode("ascii"),
|
||||
"shape": list(compact.shape),
|
||||
"start": start,
|
||||
"dtype": np.dtype(dtype).name,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,12 +7,6 @@ import numpy as np
|
||||
from prime_rl.trainer.utils import balanced_partition
|
||||
from prime_rl.transport.types import EncodedTensor, MicroBatch, RoutedExperts, TrainingSample
|
||||
|
||||
ROUTED_EXPERTS_DTYPE_ITEMSIZE = {
|
||||
"uint8": 1,
|
||||
"int16": 2,
|
||||
"int32": 4,
|
||||
}
|
||||
|
||||
# Backfill value per component weight stream when a packed sample doesn't
|
||||
# carry it: absent rl means weight 1.0 on the loss mask, absent ce/ref_kl
|
||||
# means no component (weight 0.0).
|
||||
@@ -28,7 +22,7 @@ def _copy_routed_experts(routed_experts: RoutedExperts) -> RoutedExperts:
|
||||
|
||||
|
||||
def _routed_experts_row_size(routed_experts: RoutedExperts) -> int:
|
||||
return routed_experts.shape[1] * routed_experts.shape[2] * ROUTED_EXPERTS_DTYPE_ITEMSIZE[routed_experts.dtype]
|
||||
return routed_experts.shape[1] * routed_experts.shape[2] * np.dtype(routed_experts.dtype).itemsize
|
||||
|
||||
|
||||
def _slice_routed_experts(routed_experts: RoutedExperts, seq_len: int) -> RoutedExperts:
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
from prime_rl.trainer.distributed.expert_parallel import DeepEPExpertParallel, get_ep_group
|
||||
from prime_rl.trainer.distributed.expert_parallel import DeepEPExpertParallel, MXFP8AllToAllExpertParallel, get_ep_group
|
||||
|
||||
__all__ = ["DeepEPExpertParallel", "get_ep_group"]
|
||||
__all__ = ["DeepEPExpertParallel", "MXFP8AllToAllExpertParallel", "get_ep_group"]
|
||||
|
||||
@@ -1,7 +1,67 @@
|
||||
import torch
|
||||
import torch.distributed as dist
|
||||
import torch.nn as nn
|
||||
from torch.distributed import ProcessGroup
|
||||
from torch.distributed.distributed_c10d import _resolve_process_group
|
||||
from torch.distributed.tensor import DeviceMesh, Shard, distribute_module, distribute_tensor
|
||||
from torch.distributed.tensor.parallel import ParallelStyle
|
||||
from torchao.prototype.moe_training.ep import a2a_combine_hp_fwd_mxfp8_bwd, a2a_dispatch_mxfp8_fwd_hp_bwd
|
||||
from torchao.prototype.mx_formats.mx_tensor import MXTensor
|
||||
from torchtitan.distributed.expert_parallel import ExpertParallel
|
||||
|
||||
|
||||
class _MXFP8Dispatch(torch.autograd.Function):
|
||||
@staticmethod
|
||||
def forward(ctx, routed_input, output_splits, input_splits, group_name):
|
||||
mx_routed_input = a2a_dispatch_mxfp8_fwd_hp_bwd(routed_input, output_splits, input_splits, group_name)
|
||||
ctx.input_splits = input_splits
|
||||
ctx.output_splits = output_splits
|
||||
ctx.group = _resolve_process_group(group_name)
|
||||
return mx_routed_input.dequantize(routed_input.dtype)
|
||||
|
||||
@staticmethod
|
||||
def backward(ctx, grad_output):
|
||||
grad_input = grad_output.new_empty((sum(ctx.input_splits),) + tuple(grad_output.shape[1:]))
|
||||
dist.all_to_all_single(
|
||||
grad_input, grad_output.contiguous(), ctx.input_splits, ctx.output_splits, group=ctx.group
|
||||
)
|
||||
return grad_input, None, None, None
|
||||
|
||||
|
||||
class _DequantMXGradInBwd(torch.autograd.Function):
|
||||
@staticmethod
|
||||
def forward(ctx, x, hp_dtype):
|
||||
ctx.hp_dtype = hp_dtype
|
||||
return x
|
||||
|
||||
@staticmethod
|
||||
def backward(ctx, grad_output):
|
||||
if isinstance(grad_output, MXTensor):
|
||||
grad_output = grad_output.dequantize(ctx.hp_dtype)
|
||||
return grad_output, None
|
||||
|
||||
|
||||
class MXFP8AllToAllExpertParallel(ExpertParallel):
|
||||
def _token_dispatch(self, mod, inputs, device_mesh):
|
||||
routed_input, num_tokens_per_expert = inputs
|
||||
with torch.no_grad():
|
||||
num_tokens_per_expert_group = num_tokens_per_expert.new_empty(num_tokens_per_expert.shape[0])
|
||||
dist.all_to_all_single(num_tokens_per_expert_group, num_tokens_per_expert, group=device_mesh.get_group())
|
||||
self.input_splits = num_tokens_per_expert.view(device_mesh.shape[0], -1).sum(dim=1).tolist()
|
||||
self.output_splits = num_tokens_per_expert_group.view(device_mesh.shape[0], -1).sum(dim=1).tolist()
|
||||
routed_input = _MXFP8Dispatch.apply(
|
||||
routed_input, self.output_splits, self.input_splits, device_mesh.get_group().group_name
|
||||
)
|
||||
return routed_input, num_tokens_per_expert_group
|
||||
|
||||
def _token_combine(self, mod, routed_output, device_mesh):
|
||||
routed_output = _DequantMXGradInBwd.apply(routed_output, routed_output.dtype)
|
||||
return a2a_combine_hp_fwd_mxfp8_bwd(
|
||||
routed_output,
|
||||
self.input_splits,
|
||||
self.output_splits,
|
||||
device_mesh.get_group().group_name,
|
||||
)
|
||||
|
||||
|
||||
class DeepEPExpertParallel(ParallelStyle):
|
||||
|
||||
@@ -26,8 +26,15 @@ from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, Genera
|
||||
from transformers.tokenization_utils import PreTrainedTokenizer
|
||||
from transformers.utils.import_utils import is_flash_attn_3_available
|
||||
|
||||
from prime_rl.configs.trainer import ActivationCheckpointConfig, CompileConfig, ModelConfig, TokenizerConfig
|
||||
from prime_rl.trainer.distributed import DeepEPExpertParallel
|
||||
from prime_rl.configs.trainer import (
|
||||
ActivationCheckpointConfig,
|
||||
CompileConfig,
|
||||
FP8Config,
|
||||
ModelConfig,
|
||||
MXFP8Config,
|
||||
TokenizerConfig,
|
||||
)
|
||||
from prime_rl.trainer.distributed import DeepEPExpertParallel, MXFP8AllToAllExpertParallel
|
||||
from prime_rl.trainer.lora import apply_lora_to_model, freeze_all_except_lora_and_specified, strip_lora_from_state_dict
|
||||
from prime_rl.trainer.models import (
|
||||
AutoModelForCausalLMPrimeRL,
|
||||
@@ -46,6 +53,8 @@ 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, TokenChoiceTopKRouter
|
||||
from prime_rl.trainer.models.layers.mxfp8_grouped_gemm import apply_mxfp8_moe_grouped_gemm
|
||||
from prime_rl.trainer.models.layers.mxfp8_linear import replace_linear_with_mxfp8_linear
|
||||
from prime_rl.trainer.parallel_dims import ParallelDims
|
||||
from prime_rl.trainer.weights import (
|
||||
load_state_dict,
|
||||
@@ -527,7 +536,11 @@ def get_model(
|
||||
if subconfig is not None and hasattr(subconfig, "use_cache"):
|
||||
subconfig.use_cache = False
|
||||
model_config.use_grouped_mm = config.moe_use_grouped_mm
|
||||
model_config.fp8 = config.fp8
|
||||
# MoEArgs.fp8 (read via getattr(config, "fp8") in the modeling files) gates the
|
||||
# DeepGEMM FP8 grouped GEMM. MXFP8 grouped GEMM is applied by wrapping the expert
|
||||
# weights with torchao (see apply_quantization), so it leaves this flag False and
|
||||
# the experts keep calling torch._grouped_mm — which the wrapper tensor intercepts.
|
||||
model_config.fp8 = isinstance(config.quantization, FP8Config) and config.quantization.enable_grouped_gemm
|
||||
|
||||
if config.index_cache is not None:
|
||||
model_config.use_index_cache = True
|
||||
@@ -1037,13 +1050,43 @@ def apply_compile(model: nn.Module, compile_config: CompileConfig):
|
||||
get_logger().info(f"Compiled {len(language_model.layers)} layers (fullgraph={compile_config.fullgraph})")
|
||||
|
||||
|
||||
def apply_quantization(model: nn.Module, config: ModelConfig) -> None:
|
||||
"""Swap dense linears and MoE expert GEMMs to the configured low-precision path.
|
||||
|
||||
Runs after the LM head is injected but before LoRA / EP / FSDP so the swapped
|
||||
modules and wrapped parameters are picked up by the later parallelisms. The
|
||||
FP8 grouped GEMM (DeepGEMM) is gated separately via ``model_config.fp8`` since
|
||||
it lives inside the modeling code; here we only handle the dense-linear swap
|
||||
and the torchao MXFP8 expert-weight wrapping.
|
||||
"""
|
||||
quant = config.quantization
|
||||
if quant is None:
|
||||
return
|
||||
|
||||
if isinstance(quant, FP8Config):
|
||||
replace_linear_with_fp8_blockwise_linear(model, ignore_modules=quant.ignore_patterns)
|
||||
elif isinstance(quant, MXFP8Config):
|
||||
capability = torch.cuda.get_device_capability()
|
||||
if capability < (10, 0):
|
||||
raise ValueError(
|
||||
f"MXFP8 quantization requires SM100 (Blackwell) or newer, but device is SM{capability[0]}{capability[1]}."
|
||||
)
|
||||
replace_linear_with_mxfp8_linear(model, recipe=quant.recipe, ignore_modules=quant.ignore_patterns)
|
||||
if quant.enable_grouped_gemm:
|
||||
apply_mxfp8_moe_grouped_gemm(model, recipe=quant.recipe)
|
||||
|
||||
|
||||
def apply_ep(model: nn.Module, config: ModelConfig, parallel_dims: ParallelDims):
|
||||
language_model = get_language_model(model)
|
||||
for transformer_block in language_model.layers:
|
||||
block_mlp = getattr(transformer_block, "mlp", None)
|
||||
if block_mlp is not None and isinstance(block_mlp, (MoE, LatentMoE)):
|
||||
if config.ep_comm_backend == "torch":
|
||||
parallelize_plan = ExpertParallel()
|
||||
quant = config.quantization
|
||||
if isinstance(quant, MXFP8Config) and quant.enable_a2a:
|
||||
parallelize_plan = MXFP8AllToAllExpertParallel()
|
||||
else:
|
||||
parallelize_plan = ExpertParallel()
|
||||
else:
|
||||
parallelize_plan = DeepEPExpertParallel()
|
||||
parallelize_module(
|
||||
@@ -1144,8 +1187,7 @@ def setup_model(
|
||||
|
||||
inject_prime_lm_head(model, chunk_size=lm_head_chunk_size, fused_cross_entropy=fused_cross_entropy)
|
||||
|
||||
if config.fp8:
|
||||
replace_linear_with_fp8_blockwise_linear(model)
|
||||
apply_quantization(model, config)
|
||||
|
||||
# Apply LoRA before FSDP setup
|
||||
if config.lora is not None:
|
||||
|
||||
@@ -37,3 +37,28 @@ def quantize_to_fp8_blockwise(weight: Tensor, block_size: int = 128) -> tuple[Te
|
||||
|
||||
quantized = blocks_fp8.permute(0, 2, 1, 3).reshape(padded_rows, padded_cols)[:rows, :cols].contiguous()
|
||||
return quantized, scales.float().contiguous()
|
||||
|
||||
|
||||
def quantize_to_vllm_kernel_format(weight: Tensor, block_size: int = 128) -> tuple[Tensor, Tensor]:
|
||||
"""Quantize a weight into the FP8 layout used by vLLM kernels.
|
||||
|
||||
Hopper kernels consume the regular blockwise scale grid. On SM100, vLLM's
|
||||
DeepGEMM kernels instead use UE8M0 scales in an architecture-specific packed
|
||||
layout. Reuse vLLM's own post-processing so tensors sent over the kernel
|
||||
weight-transfer path have the same representation as the loaded parameters.
|
||||
"""
|
||||
quantized, scales = quantize_to_fp8_blockwise(weight, block_size)
|
||||
|
||||
if not weight.is_cuda or torch.cuda.get_device_capability(weight.device) != (10, 0):
|
||||
return quantized, scales
|
||||
|
||||
from vllm.model_executor.layers.quantization.utils.fp8_utils import (
|
||||
deepgemm_post_process_fp8_weight_block,
|
||||
)
|
||||
|
||||
return deepgemm_post_process_fp8_weight_block(
|
||||
wq=quantized,
|
||||
ws=scales,
|
||||
quant_block_shape=(block_size, block_size),
|
||||
use_e8m0=True,
|
||||
)
|
||||
|
||||
@@ -2,7 +2,7 @@ import torch
|
||||
from torch import Tensor
|
||||
|
||||
from prime_rl.trainer.conversion_utils import get_max_layer_num
|
||||
from prime_rl.trainer.models.fp8 import quantize_to_fp8_blockwise
|
||||
from prime_rl.trainer.models.fp8 import quantize_to_vllm_kernel_format
|
||||
|
||||
|
||||
def _is_moe_layer(state_dict: dict[str, Tensor], layer_idx: int) -> bool:
|
||||
@@ -157,7 +157,7 @@ def convert_tt_layer_to_vllm_kernel(
|
||||
|
||||
def add_maybe_fp8(name: str, tensor: Tensor) -> None:
|
||||
if quantize_fp8 and tensor.ndim == 2:
|
||||
fp8_weight, scale = quantize_to_fp8_blockwise(tensor)
|
||||
fp8_weight, scale = quantize_to_vllm_kernel_format(tensor)
|
||||
out[name] = fp8_weight
|
||||
scale_name = name.removesuffix(".weight") + ".weight_scale_inv"
|
||||
out[scale_name] = scale
|
||||
@@ -231,8 +231,8 @@ def convert_tt_layer_to_vllm_kernel(
|
||||
w2_fp8: list[Tensor] = []
|
||||
w2_scales: list[Tensor] = []
|
||||
for expert_idx in range(w1.shape[0]):
|
||||
expert_w13_fp8, expert_w13_scales = quantize_to_fp8_blockwise(w13[expert_idx])
|
||||
expert_w2_fp8, expert_w2_scales = quantize_to_fp8_blockwise(w2[expert_idx])
|
||||
expert_w13_fp8, expert_w13_scales = quantize_to_vllm_kernel_format(w13[expert_idx])
|
||||
expert_w2_fp8, expert_w2_scales = quantize_to_vllm_kernel_format(w2[expert_idx])
|
||||
w13_fp8.append(expert_w13_fp8)
|
||||
w13_scales.append(expert_w13_scales)
|
||||
w2_fp8.append(expert_w2_fp8)
|
||||
|
||||
@@ -110,24 +110,7 @@ class Float8BlockwiseLinear(nn.Linear):
|
||||
return new_mod
|
||||
|
||||
|
||||
DEFAULT_FP8_IGNORE_PATTERNS: list[str] = [
|
||||
"lm_head",
|
||||
"router",
|
||||
# Use escaped dots — re.search treats `.` as any-char, so the previous
|
||||
# "mlp.gate." pattern was also matching dense MLP `mlp.gate_proj` (the
|
||||
# trailing `.` was matching `_`). That left the dense MLP gate projection
|
||||
# in BF16 on the trainer while inference quantized it to FP8, causing
|
||||
# hidden-state drift before the MoE router.
|
||||
r"mlp\.gate\.",
|
||||
"shared_expert_gate", # Qwen3.5 MoE: nn.Linear(hidden, 1, bias=False)
|
||||
"eh_proj",
|
||||
"weights_proj",
|
||||
"in_proj_a",
|
||||
"in_proj_b",
|
||||
]
|
||||
|
||||
|
||||
def replace_linear_with_fp8_blockwise_linear(model: nn.Module, ignore_modules: list[str] | None = None) -> None:
|
||||
def replace_linear_with_fp8_blockwise_linear(model: nn.Module, ignore_modules: list[str]) -> None:
|
||||
"""Replace nn.Linear in `model` with Float8BlockwiseLinear, skipping any
|
||||
module whose qualified name matches an ignore pattern (substring or regex).
|
||||
|
||||
@@ -147,8 +130,6 @@ def replace_linear_with_fp8_blockwise_linear(model: nn.Module, ignore_modules: l
|
||||
Conv1d, layer norms, and embedding tables are not nn.Linear and are
|
||||
skipped automatically by the type check; we don't need to list them.
|
||||
"""
|
||||
if ignore_modules is None:
|
||||
ignore_modules = list(DEFAULT_FP8_IGNORE_PATTERNS)
|
||||
logger = get_logger()
|
||||
logger.info(f"Replacing linear layers with FP8 blockwise linear layers (ignore={ignore_modules})")
|
||||
replaced_modules = []
|
||||
|
||||
@@ -798,6 +798,7 @@ class MoE(nn.Module):
|
||||
self.expert_bias = torch.zeros(self.experts.num_experts, dtype=torch.float32)
|
||||
|
||||
|
||||
@torch.compile(dynamic=True)
|
||||
def relu2(x: torch.Tensor) -> torch.Tensor:
|
||||
return F.relu(x).square()
|
||||
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import torch
|
||||
from torch import nn
|
||||
from torchao.prototype.moe_training import conversion_utils as cu
|
||||
from torchao.prototype.moe_training import mxfp8_grouped_mm as tao_mxfp8_gmm
|
||||
from torchao.prototype.moe_training.config import MXFP8TrainingOpConfig, MXFP8TrainingRecipe
|
||||
from torchao.prototype.moe_training.kernels.mxfp8 import triton_mx_block_rearrange_2d_M_groups
|
||||
from torchao.prototype.moe_training.tensor import MXFP8TrainingWeightWrapperTensor
|
||||
from torchao.quantization.quant_api import quantize_
|
||||
from torchtitan.distributed.expert_parallel import set_token_group_alignment_size_m
|
||||
from torchtitan.experiments.kernels.moe import indices as tt_indices
|
||||
|
||||
from prime_rl.configs.trainer import MXFP8Recipe
|
||||
from prime_rl.trainer.models.layers.moe import GroupedExperts, NonGatedGroupedExperts
|
||||
from prime_rl.utils.logger import get_logger
|
||||
|
||||
_MXFP8_TOKEN_GROUP_ALIGN: int = 32
|
||||
# torchao CUDA scale rearrange kernel supports at most 32 token groups,
|
||||
# the Triton variant has no such cap and produces the same swizzled layout, so fall back to it for wider MoEs
|
||||
_CUDA_REARRANGE_MAX_GROUPS: int = 32
|
||||
|
||||
|
||||
def _fallback_to_triton_rearrange_for_wide_moes() -> None:
|
||||
if getattr(tao_mxfp8_gmm.mx_block_rearrange_2d_M_groups_cuda, "_prime_rl_wide_moe", False):
|
||||
return
|
||||
original = tao_mxfp8_gmm.mx_block_rearrange_2d_M_groups_cuda
|
||||
|
||||
def mx_block_rearrange_2d_M_groups(
|
||||
scales_tensor: torch.Tensor, input_group_end_offsets: torch.Tensor, chunks_per_tb: int = 4
|
||||
) -> torch.Tensor:
|
||||
if input_group_end_offsets.shape[0] > _CUDA_REARRANGE_MAX_GROUPS:
|
||||
return triton_mx_block_rearrange_2d_M_groups(scales_tensor, input_group_end_offsets)
|
||||
return original(scales_tensor, input_group_end_offsets, chunks_per_tb)
|
||||
|
||||
mx_block_rearrange_2d_M_groups._prime_rl_wide_moe = True
|
||||
tao_mxfp8_gmm.mx_block_rearrange_2d_M_groups_cuda = mx_block_rearrange_2d_M_groups
|
||||
|
||||
|
||||
def _relax_torchao_mxfp8_version_gate() -> None:
|
||||
if getattr(cu._get_tensor_cls_for_config, "_prime_rl_relaxed", False):
|
||||
return
|
||||
original = cu._get_tensor_cls_for_config
|
||||
|
||||
def _get_tensor_cls_for_config(config):
|
||||
if isinstance(config, MXFP8TrainingOpConfig):
|
||||
return MXFP8TrainingWeightWrapperTensor
|
||||
return original(config)
|
||||
|
||||
_get_tensor_cls_for_config._prime_rl_relaxed = True
|
||||
cu._get_tensor_cls_for_config = _get_tensor_cls_for_config
|
||||
|
||||
|
||||
def _align_permute_indices_buffer() -> None:
|
||||
"""
|
||||
Align the permuted index buffer to a multiple of alignment as the kernel requires rows % 32 = 0 and cols % 32 = 0.
|
||||
"""
|
||||
if getattr(tt_indices.generate_permute_indices, "_prime_rl_aligned", False):
|
||||
return
|
||||
original = tt_indices.generate_permute_indices
|
||||
|
||||
def generate_permute_indices(
|
||||
tokens_per_expert_group, experts_per_rank, num_ranks, max_len, alignment, use_cpu=False
|
||||
):
|
||||
al_mask = alignment - 1
|
||||
assert alignment > 0 and (alignment & al_mask) == 0
|
||||
max_len = (max_len + al_mask) & ~al_mask
|
||||
return original(tokens_per_expert_group, experts_per_rank, num_ranks, max_len, alignment, use_cpu=use_cpu)
|
||||
|
||||
generate_permute_indices._prime_rl_aligned = True
|
||||
tt_indices.generate_permute_indices = generate_permute_indices
|
||||
|
||||
|
||||
def apply_mxfp8_moe_grouped_gemm(model: nn.Module, recipe: MXFP8Recipe) -> None:
|
||||
_relax_torchao_mxfp8_version_gate()
|
||||
_align_permute_indices_buffer()
|
||||
_fallback_to_triton_rearrange_for_wide_moes()
|
||||
set_token_group_alignment_size_m(_MXFP8_TOKEN_GROUP_ALIGN)
|
||||
op_config = MXFP8TrainingOpConfig.from_recipe(MXFP8TrainingRecipe(recipe))
|
||||
|
||||
def filter_fn(module: nn.Module, fqn: str) -> bool:
|
||||
return isinstance(module, (GroupedExperts, NonGatedGroupedExperts))
|
||||
|
||||
quantize_(model, config=op_config, filter_fn=filter_fn)
|
||||
get_logger().info(
|
||||
f"Wrapped MoE expert weights with MXFP8 grouped GEMM (recipe={recipe}, "
|
||||
f"token_group_align={_MXFP8_TOKEN_GROUP_ALIGN})"
|
||||
)
|
||||
@@ -0,0 +1,99 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
|
||||
import torch
|
||||
from torch import nn
|
||||
from torchao.prototype.mx_formats import ScaleCalculationMode
|
||||
from torchao.prototype.mx_formats.mx_linear import _to_mxfp8_then_scaled_mm
|
||||
from torchao.quantization.quantize_.common import KernelPreference
|
||||
|
||||
from prime_rl.configs.trainer import MXFP8Recipe
|
||||
from prime_rl.utils.logger import get_logger
|
||||
|
||||
|
||||
class MXFP8Linear(nn.Linear):
|
||||
def __init__(
|
||||
self,
|
||||
in_features: int,
|
||||
out_features: int,
|
||||
bias: bool = True,
|
||||
*,
|
||||
kernel_preference: KernelPreference = KernelPreference.AUTO,
|
||||
wgrad_with_hp: bool = False,
|
||||
scale_calculation_mode: ScaleCalculationMode = ScaleCalculationMode.RCEIL,
|
||||
device=None,
|
||||
dtype=None,
|
||||
) -> None:
|
||||
super().__init__(in_features, out_features, bias, device=device, dtype=dtype)
|
||||
self.kernel_preference = kernel_preference
|
||||
self.wgrad_with_hp = wgrad_with_hp
|
||||
self.scale_calculation_mode = scale_calculation_mode
|
||||
|
||||
def forward(self, input: torch.Tensor) -> torch.Tensor:
|
||||
output = _to_mxfp8_then_scaled_mm(
|
||||
input,
|
||||
self.weight,
|
||||
self.kernel_preference,
|
||||
self.scale_calculation_mode,
|
||||
wgrad_with_hp=self.wgrad_with_hp,
|
||||
)
|
||||
if self.bias is not None:
|
||||
output = output + self.bias
|
||||
return output
|
||||
|
||||
@classmethod
|
||||
def from_linear(
|
||||
cls,
|
||||
mod: nn.Linear,
|
||||
*,
|
||||
kernel_preference: KernelPreference = KernelPreference.AUTO,
|
||||
wgrad_with_hp: bool = False,
|
||||
scale_calculation_mode: ScaleCalculationMode = ScaleCalculationMode.RCEIL,
|
||||
) -> "MXFP8Linear":
|
||||
with torch.device("meta"):
|
||||
new_mod = cls(
|
||||
mod.in_features,
|
||||
mod.out_features,
|
||||
bias=mod.bias is not None,
|
||||
kernel_preference=kernel_preference,
|
||||
wgrad_with_hp=wgrad_with_hp,
|
||||
scale_calculation_mode=scale_calculation_mode,
|
||||
)
|
||||
new_mod.weight = mod.weight
|
||||
new_mod.bias = mod.bias
|
||||
return new_mod
|
||||
|
||||
|
||||
def replace_linear_with_mxfp8_linear(model: nn.Module, recipe: MXFP8Recipe, ignore_modules: list[str]) -> None:
|
||||
wgrad_with_hp = recipe == "mxfp8_rceil_wgrad_with_hp"
|
||||
logger = get_logger()
|
||||
logger.info(f"Replacing linear layers with MXFP8 linear layers (recipe={recipe}, ignore={ignore_modules})")
|
||||
replaced_modules: list[str] = []
|
||||
skipped_modules: list[str] = []
|
||||
skipped_unaligned: list[str] = []
|
||||
for name, module in dict(model.named_modules()).items():
|
||||
if not isinstance(module, nn.Linear):
|
||||
continue
|
||||
if any(re.search(pattern, name) for pattern in ignore_modules):
|
||||
skipped_modules.append(name)
|
||||
continue
|
||||
if (module.in_features & 31) != 0 or (module.out_features & 31) != 0:
|
||||
skipped_unaligned.append(f"{name}({module.in_features}->{module.out_features})")
|
||||
continue
|
||||
parent_name, attr_name = name.rsplit(".", 1) if "." in name else ("", name)
|
||||
parent = model.get_submodule(parent_name) if parent_name else model
|
||||
setattr(
|
||||
parent,
|
||||
attr_name,
|
||||
MXFP8Linear.from_linear(module, kernel_preference=KernelPreference.AUTO, wgrad_with_hp=wgrad_with_hp),
|
||||
)
|
||||
replaced_modules.append(name)
|
||||
|
||||
logger.info(
|
||||
f"Replaced {len(replaced_modules)} linear layers with MXFP8 linear "
|
||||
f"(skipped {len(skipped_modules)} by name, {len(skipped_unaligned)} by 32-div); "
|
||||
f"first replaced={replaced_modules[:3]}, "
|
||||
f"first skipped(name)={skipped_modules[:3]}, "
|
||||
f"first skipped(unaligned)={skipped_unaligned[:3]}"
|
||||
)
|
||||
@@ -19,8 +19,17 @@ Key benefit: the attention kernel itself does not need to be CP-aware. The
|
||||
all-to-all is purely on Q/K/V tensors, so this works out of the box with
|
||||
softmax flash-attn, linear attention, mamba, etc., without rewriting kernels.
|
||||
|
||||
GQA models with fewer KV heads than cp_size (e.g. NemotronH: 32 query heads, 2
|
||||
KV heads) are handled by replicating each KV head cp_size / num_key_value_heads
|
||||
times before the seq->head all-to-all. Query heads are grouped contiguously in
|
||||
GQA, so the replicated layout lands every rank on exactly the KV head its local
|
||||
query-head slice attends to; the backward of the replication sums gradients
|
||||
over replicas, which is the exact GQA KV gradient.
|
||||
|
||||
Constraints:
|
||||
- cp_size must divide both num_attention_heads and num_key_value_heads.
|
||||
- cp_size must divide num_attention_heads.
|
||||
- cp_size must divide num_key_value_heads, OR num_key_value_heads must divide
|
||||
cp_size (the KV-replication path).
|
||||
- Sequence length must be divisible by cp_size.
|
||||
"""
|
||||
|
||||
@@ -41,6 +50,24 @@ def update_ulysses_params(cu_seqlens: torch.Tensor, max_seqlen: int) -> None:
|
||||
ULYSSES_PARAMS["max_seqlen"] = int(max_seqlen)
|
||||
|
||||
|
||||
def _replicate_kv_heads(t: torch.Tensor, cp_size: int) -> torch.Tensor:
|
||||
"""Replicate KV heads so a GQA tensor with fewer heads than cp_size can be
|
||||
head-sharded: [S_local, H_kv, D] -> [S_local, cp_size, D].
|
||||
|
||||
Each KV head is repeated cp_size / H_kv times. GQA groups query heads
|
||||
contiguously (query head j attends KV head j // (H_q / H_kv)), so after the
|
||||
seq->head all-to-all rank r holds query heads [r * H_q/cp, (r+1) * H_q/cp)
|
||||
— all attending KV head floor(r * H_kv / cp) — and replica index r maps to
|
||||
the same head: floor(r / (cp / H_kv)). The backward sums gradients over
|
||||
replicas, which is exactly the GQA KV gradient.
|
||||
"""
|
||||
s_local, h, d = t.shape
|
||||
assert cp_size % h == 0, (
|
||||
f"num_key_value_heads ({h}) must divide cp_size ({cp_size}) for the ulysses KV-replication path"
|
||||
)
|
||||
return t.repeat_interleave(cp_size // h, dim=1)
|
||||
|
||||
|
||||
def _all_to_all_seq_to_head(t: torch.Tensor, cp_size: int, cp_group: dist.ProcessGroup) -> torch.Tensor:
|
||||
"""Redistribute [S_local, H, D] -> [S_global, H_local, D].
|
||||
|
||||
@@ -48,7 +75,10 @@ def _all_to_all_seq_to_head(t: torch.Tensor, cp_size: int, cp_group: dist.Proces
|
||||
ends up with the full sequence but only H/cp_size heads. Differentiable.
|
||||
"""
|
||||
s_local, h, d = t.shape
|
||||
assert h % cp_size == 0, f"num_heads ({h}) must be divisible by cp_size ({cp_size})"
|
||||
assert h % cp_size == 0, (
|
||||
f"num_heads ({h}) must be divisible by cp_size ({cp_size}); "
|
||||
"for GQA KV tensors with fewer heads than cp_size, replicate first via _replicate_kv_heads"
|
||||
)
|
||||
h_local = h // cp_size
|
||||
|
||||
# [S_local, cp_size, H_local, D] -> [cp_size, S_local, H_local, D]
|
||||
@@ -96,8 +126,15 @@ def ulysses_flash_attn_varlen_func(
|
||||
|
||||
`cu_seqlens_*` and `max_seqlen_*` describe the *full* (un-sharded) sequence,
|
||||
because after the seq->head all-to-all each rank holds the full sequence.
|
||||
|
||||
GQA with num_key_value_heads < cp_size: K/V heads are replicated up to
|
||||
cp_size before the all-to-all (see `_replicate_kv_heads`), so each rank runs
|
||||
grouped attention on its query-head slice with the single matching KV head.
|
||||
"""
|
||||
q = _all_to_all_seq_to_head(q, cp_size, cp_group)
|
||||
if k.shape[1] < cp_size:
|
||||
k = _replicate_kv_heads(k, cp_size)
|
||||
v = _replicate_kv_heads(v, cp_size)
|
||||
k = _all_to_all_seq_to_head(k, cp_size, cp_group)
|
||||
v = _all_to_all_seq_to_head(v, cp_size, cp_group)
|
||||
|
||||
|
||||
@@ -55,8 +55,15 @@ def _build_rollout(
|
||||
)
|
||||
parent = len(nodes) - 1
|
||||
|
||||
# Trace token counts are usage-based, so carry provider usage on the final sampled turn:
|
||||
# every model-generated token as completion, the leading prompt + tool observations as the
|
||||
# fed-in context (num_input_tokens = num_total_tokens - num_output_tokens).
|
||||
output_tokens = sum(sampled_lengths)
|
||||
input_tokens = 1 + sum(obs_lengths)
|
||||
|
||||
for i, n_sampled in enumerate(sampled_lengths):
|
||||
ids = _take(n_sampled)
|
||||
is_last = i == len(sampled_lengths) - 1
|
||||
nodes.append(
|
||||
vf.MessageNode(
|
||||
message=vf.AssistantMessage(content="a"),
|
||||
@@ -65,6 +72,7 @@ def _build_rollout(
|
||||
logprobs=[-0.1] * n_sampled,
|
||||
sampled=True,
|
||||
parent=parent,
|
||||
usage=vf.Usage(prompt_tokens=input_tokens, completion_tokens=output_tokens) if is_last else None,
|
||||
)
|
||||
)
|
||||
parent = len(nodes) - 1
|
||||
|
||||
@@ -26,6 +26,7 @@ flash-attn-3 = false
|
||||
prime-tunnel = false
|
||||
deep-gemm = false
|
||||
prime-evals = false
|
||||
torchao = false
|
||||
tokenspeed-mla = false
|
||||
deep-ep = false
|
||||
prime-sandboxes = false
|
||||
@@ -41,7 +42,9 @@ members = [
|
||||
"alphabet-sort-v1",
|
||||
"apex-shortlist-v1",
|
||||
"arxivmath-v1",
|
||||
"automationbench-v1",
|
||||
"bfcl-v3-v1",
|
||||
"browsecomp-plus-v1",
|
||||
"browsecomp-v1",
|
||||
"browser-cua-example",
|
||||
"browser-dom-example",
|
||||
@@ -107,6 +110,7 @@ members = [
|
||||
"scicode-v1",
|
||||
"scratchpad-v1",
|
||||
"self-reward",
|
||||
"senior-swe-bench-v1",
|
||||
"sentence-repeater",
|
||||
"simpleqa-v1",
|
||||
"simpleqa-verified-v1",
|
||||
@@ -457,6 +461,40 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/64/b4/17d4b0b2a2dc85a6df63d1157e028ed19f90d4cd97c36717afef2bc2f395/attrs-26.1.0-py3-none-any.whl", hash = "sha256:c647aa4a12dfbad9333ca4e71fe62ddc36f4e63b2d260a37a8b83d2f043ac309", size = 67548, upload-time = "2026-03-19T14:22:23.645Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "automation-bench"
|
||||
version = "1.0.5"
|
||||
source = { git = "https://github.com/mikasenghaas/AutomationBench.git?rev=6f0e683#6f0e6834930cf6906ed932e9c5b716206def40d7" }
|
||||
dependencies = [
|
||||
{ name = "anthropic" },
|
||||
{ name = "httpx" },
|
||||
{ name = "pydantic" },
|
||||
{ name = "python-dotenv" },
|
||||
{ name = "rich" },
|
||||
{ name = "verifiers" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "automationbench-v1"
|
||||
version = "0.1.0"
|
||||
source = { editable = "deps/research-environments/environments/tool_use/automationbench_v1" }
|
||||
dependencies = [
|
||||
{ name = "automation-bench" },
|
||||
{ name = "datasets" },
|
||||
{ name = "mcp" },
|
||||
{ name = "openai" },
|
||||
{ name = "verifiers" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "automation-bench", git = "https://github.com/mikasenghaas/AutomationBench.git?rev=6f0e683" },
|
||||
{ name = "datasets" },
|
||||
{ name = "mcp", specifier = "<2" },
|
||||
{ name = "openai" },
|
||||
{ name = "verifiers", specifier = ">=0.2.1.dev42" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "backoff"
|
||||
version = "2.2.1"
|
||||
@@ -634,6 +672,18 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/1e/e2/0e93b865f648b5519360846669a35f28ee8f4e1d93d054f6850d8afbabde/blis-1.3.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:8177879fd3590b5eecdd377f9deafb5dc8af6d684f065bd01553302fb3fcf9a7", size = 14250939, upload-time = "2025-11-17T12:27:53.847Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bm25s"
|
||||
version = "0.3.9"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "numpy" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/7c/ab/39d08d4589dad6f5735a6b03ee083088dc37fba57fa45d4a0749393b9295/bm25s-0.3.9.tar.gz", hash = "sha256:895c679d952b7de8355edb5f3e1a620a1e2f294d1d42b919bf0821cce2e2f597", size = 80528, upload-time = "2026-05-13T23:08:20.952Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/48/83/06582913e2af0cf498cc478350070490b019c6f6b523cb8b6cfafd32f009/bm25s-0.3.9-py3-none-any.whl", hash = "sha256:db997475e82c9e81262b83fefe6a71304f2fdd0dafd037c8929828865fa6d465", size = 74475, upload-time = "2026-05-13T23:08:19.557Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "boto3"
|
||||
version = "1.43.40"
|
||||
@@ -662,6 +712,31 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/dc/8c/5f7e73fd66b28f0705bc55d7060d41ef72328b656b86ca53e75765b3ba2c/botocore-1.43.40-py3-none-any.whl", hash = "sha256:0bc9d352267c9e48415c5d7bb61ff05c3f193eac2fc7e69cfd229a05fbab67d6", size = 15323870, upload-time = "2026-07-03T00:28:12.56Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "browsecomp-plus-v1"
|
||||
version = "0.1.0"
|
||||
source = { editable = "deps/research-environments/environments/search/browsecomp_plus_v1" }
|
||||
dependencies = [
|
||||
{ name = "bm25s" },
|
||||
{ name = "datasets" },
|
||||
{ name = "mcp" },
|
||||
{ name = "openai" },
|
||||
{ name = "pystemmer" },
|
||||
{ name = "tokenizers" },
|
||||
{ name = "verifiers" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "bm25s", specifier = ">=0.2.0" },
|
||||
{ name = "datasets" },
|
||||
{ name = "mcp", specifier = ">=1,<2" },
|
||||
{ name = "openai" },
|
||||
{ name = "pystemmer" },
|
||||
{ name = "tokenizers" },
|
||||
{ name = "verifiers", specifier = ">=0.2.0" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "browsecomp-v1"
|
||||
version = "0.1.0"
|
||||
@@ -1292,10 +1367,24 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/05/7f/798705f5296a58ca505d600456748d1be48078eac8a7050d8a98bc9edb89/decorator-5.3.1-py3-none-any.whl", hash = "sha256:f47fe6fdbd2edd623ecfe36875d37aba411624e2670dd395dddae1358689bb3c", size = 10365, upload-time = "2026-05-18T06:03:26.517Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deep-ep"
|
||||
version = "1.1.0+1fd57b0"
|
||||
source = { url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_ep-1.1.0+1fd57b0-cp312-cp312-linux_aarch64.whl" }
|
||||
resolution-markers = [
|
||||
"platform_machine == 'aarch64' and sys_platform == 'linux'",
|
||||
]
|
||||
wheels = [
|
||||
{ url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_ep-1.1.0+1fd57b0-cp312-cp312-linux_aarch64.whl", hash = "sha256:fdfa7e1f79ed152948fb86330d4fcbf560d7d50fd78d3a96caf83d4bd1b61521" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deep-ep"
|
||||
version = "1.2.1+29d31c0"
|
||||
source = { 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" }
|
||||
resolution-markers = [
|
||||
"platform_machine == 'x86_64' and sys_platform == 'linux'",
|
||||
]
|
||||
wheels = [
|
||||
{ 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", hash = "sha256:a52b709d62c4dfc46a018b988724a7c10894125091aef596bf6d68e94c2b564e" },
|
||||
]
|
||||
@@ -4861,6 +4950,8 @@ dependencies = [
|
||||
{ name = "tenacity" },
|
||||
{ name = "tilelang" },
|
||||
{ name = "torch" },
|
||||
{ name = "torchao", version = "0.17.0", source = { registry = "https://pypi.org/simple" }, marker = "platform_machine != 'x86_64'" },
|
||||
{ name = "torchao", version = "0.17.0+git02105d46c", source = { url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.6.0/torchao-0.17.0+git02105d46c-cp312-cp312-linux_x86_64.whl" }, marker = "platform_machine == 'x86_64'" },
|
||||
{ name = "torchaudio" },
|
||||
{ name = "torchdata" },
|
||||
{ name = "torchtitan" },
|
||||
@@ -4876,7 +4967,8 @@ dependencies = [
|
||||
|
||||
[package.optional-dependencies]
|
||||
all = [
|
||||
{ name = "deep-ep", marker = "platform_machine == 'x86_64'" },
|
||||
{ name = "deep-ep", version = "1.1.0+1fd57b0", source = { url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_ep-1.1.0+1fd57b0-cp312-cp312-linux_aarch64.whl" }, marker = "platform_machine != 'x86_64'" },
|
||||
{ name = "deep-ep", version = "1.2.1+29d31c0", source = { 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" }, marker = "platform_machine == 'x86_64'" },
|
||||
{ name = "deep-gemm", version = "2.5.0+891d57b", source = { url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_gemm-2.5.0+891d57b-cp312-cp312-linux_aarch64.whl" }, marker = "platform_machine != 'x86_64'" },
|
||||
{ name = "deep-gemm", version = "2.5.0+891d57b", source = { 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" }, marker = "platform_machine == 'x86_64'" },
|
||||
{ name = "flash-attn", marker = "platform_machine == 'x86_64'" },
|
||||
@@ -4889,7 +4981,8 @@ all = [
|
||||
{ name = "vllm-router", version = "0.1.26", source = { 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" }, marker = "platform_machine == 'x86_64'" },
|
||||
]
|
||||
disagg = [
|
||||
{ name = "deep-ep", marker = "platform_machine == 'x86_64'" },
|
||||
{ name = "deep-ep", version = "1.1.0+1fd57b0", source = { url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_ep-1.1.0+1fd57b0-cp312-cp312-linux_aarch64.whl" }, marker = "platform_machine != 'x86_64'" },
|
||||
{ name = "deep-ep", version = "1.2.1+29d31c0", source = { 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" }, marker = "platform_machine == 'x86_64'" },
|
||||
{ name = "deep-gemm", version = "2.5.0+891d57b", source = { url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_gemm-2.5.0+891d57b-cp312-cp312-linux_aarch64.whl" }, marker = "platform_machine != 'x86_64'" },
|
||||
{ name = "deep-gemm", version = "2.5.0+891d57b", source = { 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" }, marker = "platform_machine == 'x86_64'" },
|
||||
{ name = "nixl" },
|
||||
@@ -4934,6 +5027,7 @@ requires-dist = [
|
||||
{ name = "aiolimiter", specifier = ">=1.2.1" },
|
||||
{ name = "beartype", specifier = ">=0.21.0" },
|
||||
{ name = "datasets", specifier = ">=4.0.0" },
|
||||
{ name = "deep-ep", marker = "platform_machine == 'aarch64' and extra == 'disagg'", url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_ep-1.1.0+1fd57b0-cp312-cp312-linux_aarch64.whl" },
|
||||
{ name = "deep-ep", marker = "platform_machine == 'x86_64' and extra == 'disagg'", 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" },
|
||||
{ name = "deep-gemm", marker = "platform_machine == 'aarch64' and extra == 'disagg'", url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_gemm-2.5.0+891d57b-cp312-cp312-linux_aarch64.whl" },
|
||||
{ name = "deep-gemm", marker = "platform_machine != 'aarch64' and platform_machine != 'x86_64' and extra == 'disagg'" },
|
||||
@@ -4977,6 +5071,8 @@ requires-dist = [
|
||||
{ name = "tenacity", specifier = ">=8.2.0" },
|
||||
{ name = "tilelang", specifier = ">=0.1.8" },
|
||||
{ name = "torch", specifier = ">=2.9.0", index = "https://download.pytorch.org/whl/cu128" },
|
||||
{ name = "torchao", marker = "platform_machine != 'x86_64'", specifier = ">=0.17.0" },
|
||||
{ name = "torchao", marker = "platform_machine == 'x86_64'", url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.6.0/torchao-0.17.0+git02105d46c-cp312-cp312-linux_x86_64.whl" },
|
||||
{ name = "torchaudio", index = "https://download.pytorch.org/whl/cu128" },
|
||||
{ name = "torchdata", specifier = ">=0.11.0" },
|
||||
{ name = "torchtitan", git = "https://github.com/pytorch/torchtitan?rev=23e4dfc" },
|
||||
@@ -5482,6 +5578,18 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/0c/34/c110ecc14814be490f258549192579ec02a9f3792587e933b254bcd24aa7/pyqwest-0.6.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:8de70fc18b524e09883b161f79fe21a647302a0c9950ecefeb34a1c1f27269a9", size = 5764873, upload-time = "2026-05-19T03:20:17.61Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pystemmer"
|
||||
version = "3.1.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/78/95/bb893462b08db211b248f6b1aaa0dc07d068dc86f180178bc9072fef86bb/pystemmer-3.1.0.tar.gz", hash = "sha256:083cc3ed90f4c3b0668f8e31c2925cbb4db3bf0fd6d710e0ad0914f33685f7df", size = 302551, upload-time = "2026-05-22T11:23:44.581Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/06/55/78699a2621a472be98bae7fb36bdda610b7d1c8bcd8ff448301230260cf9/pystemmer-3.1.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:550bd609aa8dc324033eb1c8d34bfd68649183bbdab871ff534332dcafdc5e5a", size = 752410, upload-time = "2026-05-22T11:14:12.075Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/67/63/e3937ac1df5243e94bde11fc1e57584480de419587f46a4badf5088e7ca6/pystemmer-3.1.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:7c6db50dd5e92a2a0acf2b2cec55fddcff3928bf490e26d0c45bc0483272a46c", size = 761062, upload-time = "2026-05-22T11:14:13.78Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e7/63/1f7ef438e19029025fc73fe95480d0dbb2ff323f1aec9c087ad9eb952afb/pystemmer-3.1.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:b86b0b14634788060cab98ad0cae023620aa7b29f9155e8b474632fc80793405", size = 756304, upload-time = "2026-05-22T11:14:15.419Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ad/5e/816d59b780aa552c87a7e25148005f41be18193482b122d67c6235741b31/pystemmer-3.1.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:6a1289aa31f5f613a31916e7d4e6eaf6b0e6e70a3d494bf08b1d999a0aaf458e", size = 754520, upload-time = "2026-05-22T11:14:16.754Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pytest"
|
||||
version = "9.0.3"
|
||||
@@ -6121,6 +6229,17 @@ requires-dist = [
|
||||
{ name = "verifiers", specifier = ">=0.1.4" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "senior-swe-bench-v1"
|
||||
version = "0.1.0"
|
||||
source = { editable = "deps/research-environments/environments/swe/senior_swe_bench_v1" }
|
||||
dependencies = [
|
||||
{ name = "verifiers", extra = ["harbor"] },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [{ name = "verifiers", extras = ["harbor"], specifier = ">=0.2.1.dev40" }]
|
||||
|
||||
[[package]]
|
||||
name = "sentence-repeater"
|
||||
version = "0.1.1"
|
||||
@@ -7069,6 +7188,58 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/e2/79/a914539b4785f3e44f891aa012a886edb8bc10fe081c440981c57543ce21/torch_c_dlpack_ext-0.1.5-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e6f9da4bb9af70e27facc777458be62e10dbbbddda7672d16138db0553c5a524", size = 897846, upload-time = "2026-01-12T11:24:48.168Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "torchao"
|
||||
version = "0.17.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
resolution-markers = [
|
||||
"platform_machine == 'aarch64' and sys_platform == 'linux'",
|
||||
]
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/c9/37/ef37ca885265e5f79a168616767dd416a3cea1cc3b28bb6b503ce4a5b652/torchao-0.17.0-py3-none-any.whl", hash = "sha256:02eba449036715b9ae784fbaa1a6f97994bb7b0421ce92d1d5d1c08e5bd6d349", size = 1200680, upload-time = "2026-03-30T22:25:54.457Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "torchao"
|
||||
version = "0.17.0+git02105d46c"
|
||||
source = { url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.6.0/torchao-0.17.0+git02105d46c-cp312-cp312-linux_x86_64.whl" }
|
||||
resolution-markers = [
|
||||
"platform_machine == 'x86_64' and sys_platform == 'linux'",
|
||||
]
|
||||
wheels = [
|
||||
{ url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.6.0/torchao-0.17.0+git02105d46c-cp312-cp312-linux_x86_64.whl", hash = "sha256:899ee5ac05292a5ffac1e44817c524b63fff850c6d5f679d3087f6770ba628c6" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "bitsandbytes", marker = "extra == 'dev'" },
|
||||
{ name = "blobfile", marker = "extra == 'dev'" },
|
||||
{ name = "cmake", marker = "extra == 'dev'", specifier = ">=3.19.0,<4.0.0" },
|
||||
{ name = "diskcache", marker = "extra == 'dev'" },
|
||||
{ name = "expecttest", marker = "extra == 'dev'" },
|
||||
{ name = "fire", marker = "extra == 'dev'" },
|
||||
{ name = "hypothesis", marker = "extra == 'dev'" },
|
||||
{ name = "importlib-metadata", marker = "extra == 'dev'" },
|
||||
{ name = "lm-eval", marker = "extra == 'dev'" },
|
||||
{ name = "matplotlib", marker = "extra == 'dev'" },
|
||||
{ name = "ninja", marker = "extra == 'dev'" },
|
||||
{ name = "packaging", marker = "extra == 'dev'" },
|
||||
{ name = "pandas", marker = "extra == 'dev'" },
|
||||
{ name = "parameterized", marker = "extra == 'dev'" },
|
||||
{ name = "pre-commit", marker = "extra == 'dev'" },
|
||||
{ name = "pycocotools", marker = "extra == 'dev'" },
|
||||
{ name = "pytest", marker = "extra == 'dev'", specifier = "==8.4.2" },
|
||||
{ name = "pyyaml", marker = "extra == 'dev'" },
|
||||
{ name = "ruff", marker = "extra == 'dev'", specifier = "==0.11.6" },
|
||||
{ name = "sentencepiece", marker = "extra == 'dev'" },
|
||||
{ name = "tabulate", marker = "extra == 'dev'" },
|
||||
{ name = "tiktoken", marker = "extra == 'dev'" },
|
||||
{ name = "tqdm", marker = "extra == 'dev'" },
|
||||
{ name = "transformers", marker = "extra == 'dev'" },
|
||||
{ name = "unittest-xml-reporting", marker = "extra == 'dev'" },
|
||||
]
|
||||
provides-extras = ["dev"]
|
||||
|
||||
[[package]]
|
||||
name = "torchaudio"
|
||||
version = "2.11.0+cu128"
|
||||
@@ -7517,7 +7688,7 @@ requires-dist = [
|
||||
{ name = "python-dotenv", marker = "extra == 'browser'", specifier = ">=1.0.0" },
|
||||
{ name = "pyzmq", specifier = ">=27.1.0" },
|
||||
{ name = "reasoning-gym", marker = "extra == 'rg'" },
|
||||
{ name = "renderers", specifier = ">=0.1.8.dev40" },
|
||||
{ name = "renderers", specifier = ">=0.1.8" },
|
||||
{ name = "requests" },
|
||||
{ name = "requests", marker = "extra == 'rl'" },
|
||||
{ name = "rich" },
|
||||
|
||||
Reference in New Issue
Block a user