Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
38b65e5
fix(model-source): report remote model metadata
Yangruipis Aug 29, 2026
ada460c
fix(sglang): use dummy load for async recipe
RexFlux Aug 31, 2026
0cd7c4d
fix(sglang): repair malformed hunk header in v0.5.15.post1 patch
GUOGUOPOT Aug 31, 2026
fdb5cd0
upgrade megatron and add deepseek patch
li126com Aug 31, 2026
c113c72
fix(ray): fence graceful elastic scale-in
RexFlux Sep 1, 2026
773bd58
fix(multimodal): bound Qwen-VL image ratios
Yangruipis Sep 1, 2026
e97088a
fix(megatron-patch): restore MTP detach routing dropped in mcore upgrade
Michael-Salon Sep 2, 2026
4457b16
feat(sft): add async prepack pipeline
Yangruipis Sep 2, 2026
29e43c4
feat: adapt new megatron
li126com Sep 2, 2026
97ba6f8
feat(sft): add sharded TQ producers
xiaoliang0601 Aug 13, 2026
798483a
fix(sft): prevent prefetch boundary hangs
iyea Aug 20, 2026
7cc2cde
fix(sft): harden sharded prepack runtime
xiaoliang0601 Sep 1, 2026
6f0ad65
test(sft): restore native async tests
xiaoliang0601 Sep 1, 2026
5781324
support eval when multi producer sft
xiaoliang0601 Sep 2, 2026
6b19d6e
modify some docs
xiaoliang0601 Sep 2, 2026
2f8e183
fix(multimodal): load truncated images
Yangruipis Sep 2, 2026
1d2f98c
feat(sft): make the loss-mask fallback delimiter-agnostic
Michael-Salon Sep 3, 2026
0a91dd1
feat(diffusion): add native generative RL
NINGBENZHE Sep 3, 2026
7e84e1a
fix(sft): skip failed multimodal samples
Yangruipis Sep 3, 2026
99bf684
feat(training): add gemma-4-31B GRPO launch scripts (colocate + fully…
Michael-Salon Sep 4, 2026
7b846e5
test(sampler): cover lagging-DP dummy backfill in IdentityWindowSampler
Sep 5, 2026
29f596a
feat(agentic): support Responses/Messages and SSE
dirtyDan0 Sep 7, 2026
3c8ac70
test(fsdp): separate spawn and hang timeouts
iyea Sep 7, 2026
0405262
feat(agentic): support turn-level custom advantages
Sep 7, 2026
c0beb15
feat(sft): align VL LoRA/MTP SFT with ms-swift baseline
NINGBENZHE Sep 9, 2026
9d23ce2
feat(save-hf): export the vision tower a text-only model cannot emit
Michael-Salon Sep 10, 2026
7e2a26d
feat(nemo-gym): add Claude Code and multienv
dirtyDan0 Sep 12, 2026
0ccb217
fix(sglang): prevent multimodal retokenization
dirtyDan0 Sep 11, 2026
ab6418e
fix(docs): isolate SFT OpenAPI imports
Yangruipis Sep 14, 2026
eb75f1a
fix(nemo-gym): prevent rollout stalls
Yangruipis Sep 14, 2026
93aa23a
perf(alfworld): enable 2P2D TP2 rollout
yuanlehome Sep 14, 2026
1573285
feat(genrm): support multi-instance GenRM deployment
NINGBENZHE Sep 14, 2026
81592b8
fix(sglang): prevent multimodal processor hangs
Yangruipis Sep 13, 2026
aba6247
fix(ci): isolate optional training dependencies
SigureMo Sep 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 3 additions & 1 deletion .gitleaks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ tags = ["internal", "token"]
[[rules]]
id = "private-ip-10-range"
description = "Detects hardcoded private IP addresses in 10.0.0.0/8 range (RFC 1918)"
regex = '''\b10\.\d{1,3}\.\d{1,3}\.\d{1,3}\b'''
regex = '''\b10\.\d{1,3}\.\d{1,3}\.\d{1,3}\b(?:/\d{1,2}\b)?'''
tags = ["internal", "ip", "private"]
[rules.allowlist]
regexTarget = "match"
regexes = [
# 10.0.0.1 is a conventional placeholder IP in examples and tests.
'''^10\.0\.0\.1$''',
# The full RFC 1918 network is public, not a deployment-specific endpoint.
'''^10\.0\.0\.0/8$''',
]
paths = ['''scripts/ci/benchmark\.sh$''']

Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ repos:
hooks:
- id: docformatter
name: docformatter
entry: docformatter --in-place --wrap-descriptions 79
entry: python .pre-commit-hooks/docformatter_compat.py --in-place --wrap-descriptions 79
language: python
types: [python]
additional_dependencies: ["docformatter==1.3.1"]
Expand Down
38 changes: 38 additions & 0 deletions .pre-commit-hooks/docformatter_compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env python3
# Copyright (c) 2026 Relax Authors. All Rights Reserved.

"""Run docformatter with correct multiline string token positions."""

from __future__ import annotations

import tokenize
from collections.abc import Callable, Iterator


_original_generate_tokens = tokenize.generate_tokens


def _generate_tokens(readline: Callable[[], str]) -> Iterator[tokenize.TokenInfo]:
for token in _original_generate_tokens(readline):
if token.type == tokenize.STRING and token.start[0] != token.end[0]:
# Python 3.12.0 can undercount this column after non-ASCII text.
# untokenize otherwise copies the apparent gap after the string,
# duplicating source characters, including its closing quotes.
end_column = len(token.string.rsplit("\n", 1)[-1])
token = token._replace(end=(token.end[0], end_column))
yield token


def main() -> int:
import docformatter

original = tokenize.generate_tokens
tokenize.generate_tokens = _generate_tokens
try:
return docformatter.main()
finally:
tokenize.generate_tokens = original


if __name__ == "__main__":
raise SystemExit(main())
2 changes: 2 additions & 0 deletions .pre-commit-hooks/gitleaks_tracked.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ def main(argv: Sequence[str] | None = None) -> int:
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True,
encoding="utf-8",
errors="replace",
)

_relay(result.stdout, sys.stdout, snapshot_root)
Expand Down
22 changes: 19 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,36 @@ Relax 是一个基于 Ray Serve 的大模型强化学习训练框架,支持 Me

```
relax/ 核心框架
├── agentic/ Agentic 层 — Session、pipeline、agent process 与训练导出
├── core/ 编排层 — 训练循环、服务基类、全局注册表
├── components/ 组件层 — RL 服务组件(Ray Serve Deployment)
├── engine/ 引擎层 — Rollout 数据生成、奖励计算、请求路由
├── backends/ 后端层 — Megatron 训练后端、SGLang 推理引擎
├── distributed/ 分布式层 — Ray 集群管理、分布式 Checkpoint
├── entrypoints/ 入口层 — 训练入口脚本
├── models/ 模型层 — 模型专属实现与注册
└── utils/ 基础设施 — 工具函数、指标监控、多模态处理
tests/ 测试(镜像 relax/ 层级)
tests/ 模块测试与集成回归测试
├── backends/megatron/ Megatron 后端测试(权重转换等)
├── backends/sglang/ SGLang 后端测试
├── components/ RL 服务组件测试
├── core/ Controller、Service 与注册表测试
├── data/ 数据处理与 SFT 数据测试
├── distributed/checkpoint_service/ 分布式 Checkpoint 测试
├── distributed/ray/ 分布式 / Ray 测试(弹性伸缩等)
├── engine/rewards/ 奖励函数测试
├── engine/rollout/ Rollout 引擎测试(预取、数据源等)
└── utils/ 工具函数测试(HTTP、指标、流式数据集等)
transfer_queue/ 分布式数据传输队列
├── engine/sft/ SFT 引擎测试
├── entrypoints/ 入口行为测试
├── examples/ 示例级回归测试
├── integration/ 跨模块集成测试
├── models/ 模型专属测试
├── tools/ 工具与辅助脚本测试
├── utils/ 工具函数测试(HTTP、指标、流式数据集等)
└── test_agentic_rollout.py Agentic runtime 与 Session 测试
docs/ 中英文用户文档
skills/ 仓库开发与运维工作流
docker/ 训练镜像与依赖 patch
examples/ 用户级示例(deepeyes、OPD 等)
scripts/ 训练启动脚本 & 模型配置
configs/env.yaml 运行时环境配置
Expand Down
22 changes: 19 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG HTTP_PROXY
ARG HTTPS_PROXY
ARG NO_PROXY
ARG BASE_IMAGE=mirror.ccs.tencentyun.com/lmsysorg/sglang:v0.5.15.post1-cu129
ARG BASE_IMAGE=mirror.ccs.tencentyun.com/lmsysorg/sglang:v0.5.17-cu129
ARG TRAIN_IMAGE=train
FROM ${BASE_IMAGE} as base

Expand Down Expand Up @@ -38,9 +38,24 @@ RUN pip install nvidia-cudnn-cu12==9.16.0.29
FROM base as train

RUN MAX_JOBS=64 pip -v install flash-attn==2.7.4.post1 --no-build-isolation --no-cache-dir && \
pip install --no-cache-dir flash-linear-attention==0.4.1 && \
pip install --no-cache-dir flash-linear-attention==0.4.2 && \
pip install --no-cache-dir tilelang -f https://tile-ai.github.io/whl/nightly/cu128/

# DeepSeek-V4 DSA deps, both listed under mcore's `no_pypi_wheels` so built from pinned source:
# - fast-hadamard-transform: required by the Lightning Indexer (dsa.rotate_activation asserts on it)
# - FlashMLA: fused DSA sparse attention; without it the CSA backward is quadratic in seq len
# (mcore only allows the fusion on SM90 when dsa_indexer_loss_coeff == 0)
ARG FLASH_MLA_COMMIT=b7643bd54521f563b839b98289b5cd048c062ba2
RUN MAX_JOBS=64 pip install --no-cache-dir --no-build-isolation --no-deps \
git+https://github.com/Dao-AILab/fast-hadamard-transform.git@f134af63deb2df17e1171a9ec1ea4a7d8604d5ca && \
git clone --recurse-submodules https://github.com/deepseek-ai/FlashMLA.git /opt/FlashMLA && \
cd /opt/FlashMLA && git checkout ${FLASH_MLA_COMMIT} && \
git submodule update --init --recursive && \
MAX_JOBS=64 pip install --no-cache-dir --no-build-isolation --no-deps . && \
cd / && python -c "import flash_mla; assert hasattr(flash_mla, 'flash_mla_sparse_fwd'), \
'flash_mla built but flash_mla_sparse_fwd missing'" && \
rm -rf /opt/FlashMLA

# FA3 (Hopper flash-attention), built from source. This commit's _flash_attn_forward carries
# window_size_left/right to match TE 2.14.1 (docs/draft/sglang-0.5.12-upgrade-plan.md §8.4).
# The `cp` exposes flash_attn_3.flash_attn_interface, which is what TE imports. BUT this commit's
Expand Down Expand Up @@ -70,6 +85,7 @@ RUN MAX_JOBS=64 \
RUN pip -v install --no-cache-dir --no-build-isolation "transformer_engine[pytorch]==2.14.1" && \
TMS_CUDA_MAJOR=$(python -c 'import torch; print(torch.version.cuda.split(".")[0])') pip install git+https://github.com/redai-studio/torch_memory_saver.git@afc13785c50119048e2dd8ac497cc9e29ec75bd4 --no-cache-dir --force-reinstall && \
pip install nvidia-modelopt[torch]>=0.37.0 --no-build-isolation --no-cache-dir && \
pip install megatron-energon fsspec==2024.3.1 --no-cache-dir&& \
pip install "numpy<2" nvidia-cudnn-cu12==9.16.0.29 --no-cache-dir && \
NVCC_APPEND_FLAGS="--threads 32" \
pip -v install --disable-pip-version-check --no-cache-dir \
Expand All @@ -93,7 +109,7 @@ WORKDIR /root
ARG PATCH_VERSION=latest
ARG ENABLE_SGLANG_PATCH=1

ARG MEGATRON_BRIDGE_COMMIT=2faedbf6fe3c422835a44b2b360cadcb2a116a54
ARG MEGATRON_BRIDGE_COMMIT=af17edf52c514c58c79cd291b04a9b42bc5c57f3
ENV MEGATRON_BRIDGE_COMMIT=${MEGATRON_BRIDGE_COMMIT} \
PYTHONPATH=/root/Megatron-LM/

Expand Down
2 changes: 1 addition & 1 deletion docker/patch/latest/megatron.patch
2 changes: 1 addition & 1 deletion docker/patch/latest/sglang.patch
Loading