Agent Skillsverl-project/verl-omni › run-cpu-tests

run-cpu-tests

GitHub

指导编写和运行 verl-omni CPU 测试,涵盖无 GPU 环境下的适配器和配置测试。包含 CI 触发机制、本地复现技巧及 PR 提交规范,用于添加测试或复现失败。

.agents/skills/run-cpu-tests/SKILL.md verl-project/verl-omni

Trigger Scenarios

需要编写或运行 CPU 测试 在本地复现 CI 失败 为 PR 生成测试证据

Install

npx skills add verl-project/verl-omni --skill run-cpu-tests -g -y
More Options

Non-standard path

npx skills add https://github.com/verl-project/verl-omni/tree/main/.agents/skills/run-cpu-tests -g -y

Use without installing

npx skills use verl-project/verl-omni@run-cpu-tests

指定 Agent (Claude Code)

npx skills add verl-project/verl-omni --skill run-cpu-tests -a claude-code -g -y

安装 repo 全部 skill

npx skills add verl-project/verl-omni --all -g -y

预览 repo 内 skill

npx skills add verl-project/verl-omni --list

SKILL.md

Frontmatter
{
    "name": "run-cpu-tests",
    "description": "How to write and run verl-omni CPU tests (test_*_on_cpu.py) that exercise adapters, rewards, and configs without a GPU or model weights. Use when adding tests, reproducing a failure locally, or producing the test evidence a PR body requires."
}

Run & Write CPU Tests

docs/contributing/testing_guide.md is authoritative for the layer hierarchy, the *_on_cpu.py naming rule, placement, coverage, the local pytest invocations, and the steps for adding a test. Follow it. This skill adds what it does not cover.

What CI does that the guide's local commands don't

  • The CPU job exports TORCH_COMPILE_DISABLE=1 and TORCHINDUCTOR_DISABLE=1 (.github/workflows/cpu_unit_tests.yml). Set both locally when reproducing a failure that only CI sees.
  • On pull requests the job triggers on types: [labeled] and only when the label is ci — a green checks page on an unlabelled PR means the tests never ran. The label is single-use: drop-ci-labels.yml removes it on every synchronize, so a new push does not re-run the job until you re-add ci.
  • tests/special_sanity/ runs as its own job; those files are test_*.py, so the CPU job's python_files override deliberately skips them.

Idioms the guide leaves to the reader

Configs — construct normally:

cfg = DiffusionLossConfig(loss_mode="flow_dppo")

Bypass __init__ only when __post_init__ does I/O (loading tokenizers, resolving paths), as DiffusionModelConfig does:

cfg = object.__new__(DiffusionModelConfig)
object.__setattr__(cfg, "architecture", "QwenImagePipeline")
object.__setattr__(cfg, "algorithm", "dpo")

object.__setattr__ is needed because BaseConfig gates assignment through _mutable_fields, not because the dataclass is frozen (config.md). Reaching for this where plain construction works is a review comment.

Mocks and assertionsMagicMock the transformer and assert on call args and output shapes rather than on real model output. TensorDict batches usually carry metadata, not pixels (TensorDict({}, batch_size=2) plus the fields under test). Use torch.testing.assert_close(a, b, rtol=..., atol=...) for tensors and pytest.approx for scalars — never .equal() on floats.

Before opening a PR

Paste the command and its output into the PR body (mandatory — commit-and-pr), then run pre-commit run --all-files.

Version History

  • f92f3f0 Current 2026-08-16 07:00

Same Skill Collection

.agents/skills/add-pipeline/SKILL.md
.agents/skills/add-reward-score/SKILL.md
.agents/skills/commit-and-pr/SKILL.md

Metadata

Files
0
Version
f92f3f0
Hash
ba8bbd55
Indexed
2026-08-16 07:00

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-18 07:25
浙ICP备14020137号-1 $mapa de visitantes$