用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/areal-project/AReaL --skill add-workflow命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Read-only pull request review workflow with risk analysis, targeted checklists, and Codex subagent consultation.
Upgrade focused runtime dependencies in AReaL. First validates and updates per-package API checklists for structural completeness, then updates pyproject files, resolves conflicts, locks, updates the Dockerfile, and audits API compatibility against the checklists.
AReaL commit message conventions. MUST load on every git commit -- provides Conventional Commits format with scope inference from file paths.
基于 SOC 职业分类
正在显示 SKILL.md
| name | add-workflow |
| description | Guide for adding a new RolloutWorkflow to AReaL. Use when user wants to create a new workflow. |
Add a new RolloutWorkflow implementation to AReaL.
This skill is triggered when:
Before starting, ensure you understand:
Create areal/workflow/<name>.py:
import uuid
from typing import Any, Callable
import torch
from areal.api.cli_args import GenerationHyperparameters
from areal.api.engine_api import InferenceEngine
from areal.api.io_struct import ModelRequest, ModelResponse
from areal.api.reward_api import AsyncRewardWrapper
from areal.api.workflow_api import RolloutWorkflow
from areal.utils import logging
logger = logging.getLogger("MyWorkflow")
class MyWorkflow(RolloutWorkflow):
"""Description of your workflow."""
def __init__(
self,
gconfig: GenerationHyperparameters,
tokenizer,
reward_fn: Callable,
):
self.gconfig = gconfig.new_with_stop_and_pad_token_ids(tokenizer)
self.tokenizer = tokenizer
self.async_reward_fn = AsyncRewardWrapper(reward_fn)
async def arun_episode(
self,
engine: InferenceEngine,
data: dict[str, Any],
) -> dict[str, Any] | None | dict[str, InteractionWithTokenLogpReward]:
"""Run a single episode. MUST be async and non-blocking."""
# 1. Prepare input_ids from data
input_ids = self.tokenizer.apply_chat_template(
data["messages"],
tokenize=True,
add_generation_prompt=True,
)
# 2. Build ModelRequest
req = ModelRequest(
rid=uuid.uuid4().hex,
input_ids=list(input_ids),
gconfig=self.gconfig.new(n_samples=1),
tokenizer=self.tokenizer,
)
# 3. Generate completion (async)
resp: ModelResponse = await engine.agenerate(req)
# 4. Compute reward (async)
prompt_str = self.tokenizer.decode(input_ids)
completion_str = self.tokenizer.decode(resp.output_tokens)
reward = await self.async_reward_fn(
prompt_str,
completion_str,
resp.input_tokens,
resp.output_tokens,
**data,
)
# 5. Return results in expected format
return {
"input_ids": torch.tensor(resp.input_tokens),
"output_ids": torch.tensor(resp.output_tokens),
"reward": torch.tensor(reward),
}
Add to areal/workflow/__init__.py:
from areal.workflow.<name> import MyWorkflow
__all__ = [
# ... existing exports
"MyWorkflow",
]
Update your training script to use the new workflow:
trainer.train(
workflow="areal.workflow.<name>.MyWorkflow",
# ... other args
)
Create tests/test_<name>_workflow.py:
import pytest
from areal.workflow.<name> import MyWorkflow
@pytest.mark.asyncio
async def test_workflow_basic():
# Test basic functionality
pass
| Workflow | File | Description |
|---|---|---|
| MultiTurnWorkflow | areal/workflow/multi_turn.py | Multi-turn conversation |
| RLVRWorkflow | areal/workflow/rlvr.py | RL with verifiable rewards |
| VisionRLVRWorkflow | areal/workflow/vision_rlvr.py | Vision + RLVR |
arun_episode must be async def and non-blockingaiofiles for file operationsAsyncRewardWrapper for reward functions[batch, seq_len, ...]concat_padded_tensors for combining outputsopen() instead of aiofiles.open()await async callsAsyncRewardWrapper