trainer

A workflow for preparing and running machine-learning model training with LLaMA-Factory or Verl. It checks training data and settings, starts or reconnects to training workers, and handles results.

In plain words
What is it for?
Use it to validate SFT data or GRPO data, configure rewards, create training settings, run training, monitor workers, compare checkpoints, export models, and inspect failures.
Why use it?
It reduces errors caused by invalid data, mismatched training settings, or lost worker connections. It also keeps checkpoint comparison and model export in one workflow.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/opendcai/dataflow-loopai/trainer
Any agent
npx skills add OpenDCAI/Dataflow-LoopAI --skill trainer
Clone the repo
git clone --depth 1 https://github.com/OpenDCAI/Dataflow-LoopAI

Made for: Claude Code, Codex.

Per session 64 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,800 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00064 $0.04800
Opus 5 $0.00032 $0.02400
Sonnet 5 $0.00013 $0.00960
Haiku 4.5 $0.00006 $0.00480

Measured 2d ago against content hash 2d4abca6bc4d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

trainer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/Trainer/SKILL.md · 514 lines

How it starts

The opening of the file, as written. The whole thing — 514 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Trainer Skill

Purpose

Trainer Skill is the Codex-facing entry point and the canonical Python implementation for LoopAI model training.

Use this skill for:

  • Running sft + llamafactory or grpo + verl; do not mix backend/stage pairs
  • Validating SFT JSON/JSONL or GRPO Parquet data and reward configuration
  • Generating and approving backend-specific training YAML
  • Running or reconnecting to the persistent Trainer worker
  • Reading local metrics, selecting checkpoints, and exporting Verl FSDP actors
  • Returning structured Trainer errors without relying on SwanLab or Trainer MCP

Do not use this skill for Judger, Analyzer, data crawling, or broad project refactors.

Python Implementation

loopai/skills/Trainer/
├── __init__.py        # prepare() / run_prepared() / run() / result helpers
├── trainer_agent.py   # LangGraph subgraph used by Starter and the skill runner
├── nodes/             # data validation, config generation, training execution
├── rewards/           # stable LoopAI routing to Verl reward implementations
├── utils/             # persistent worker, Verl/SFT launchers, events, parsers
├── templates/         # bundled training templates
├── results.py         # parses metrics and selects the best checkpoint
├── runner.py          # skill entry that runs the Trainer subgraph
├── runtime_config.py  # resolves kwargs/env/state/starter.yaml
└── worker_entry.py    # independent process that owns training and finalization

The root skill description lives at:

skills/Trainer/SKILL.md

Mandatory YAML Approval

For every user-initiated training round, use this two-stage workflow:

  1. Call prepare() to validate the data and generate the final training YAML. This stage must not start training.
  2. Read result["trainer"]["trainer_result"]["data"] and show the user:
    • config_path
    • the complete config_yaml in a YAML code block
    • the selected train_framework and train_stage
    • for SFT: dataset/model paths, learning rate, epochs, batch size, LoRA fields, devices, output directory, and save_total_limit
    • for GRPO: train/validation Parquet paths, model, reward mode/preset or custom function, rollout backend, GPUs, batch/token limits, save/test frequency, checkpoint directory, selection metric, and checkpoint retention
  3. Stop and wait for explicit user approval. Do not treat a previous round's approval as approval for a new round.
  4. If the user requests edits, update the generated YAML, call inspect_prepared_config(), show the complete updated YAML, and wait for approval again.
  5. Only after approval, call run_prepared() with the displayed config_path, its displayed config_sha256, and the trainer_version_id returned by prepare().
  6. Keep run_prepared() in the foreground until training reaches completed, failed, or cancelled.

Read the full file on GitHub · 514 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 514 lines · 64 tokens per session scan A 2d4abca6bc4d

Subscribe to this mod's changes

trainer is a skill published in the GitHub repository OpenDCAI/Dataflow-LoopAI (22 stars, last pushed 2d ago), licensed Apache-2.0. It adds 64 tokens to every session and 4,800 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

loopx-project

Use when connecting a repository or project goal document to LoopX, maintaining project-local goal state, refreshing stale dashboard status, syncing local projects into the shared global registry, or diagnosing LoopX CLI/PATH/status/history issues across multiple repos. For registering durable project materials such…

huangruiteng/loopx · 74 tokens

loopx-auto-research

Use when a LoopX worker is operating an auto-research lane, demo pane, frontier item, evidence packet, promotion/retirement decision, or visible tmux/Codex auto-research rehearsal. Identity must come from the LoopX role profile and quota/frontier packet; this skill only provides role-specific execution checklists…

huangruiteng/loopx · 79 tokens

loopx-change-quality

Qualify the exact final diff for a LoopX-managed goal. Use when goal policy enables changequalityqualification, before a non-trivial delivery or merge, and when producing or repairing an exact-scope quality receipt. The workflow is language-neutral, permits at most one policy-authorized safe-fix pass, and never grants…

huangruiteng/loopx · 75 tokens

loopx-material

Operate an explicitly activated LoopX Material Lifecycle for a connected project. Use for material-store inventory, lossless migration, candidate/archive transitions, exact-read-backed ranking, ranked-entry rebuilds, bounded Explore intake, owner-gated apply, rollback, and audit. Do not use for ordinary one-off…

huangruiteng/loopx · 74 tokens

loopx-pr-program

Use when LoopX must manage a multi-PR or multi-MR delivery program across one or more repositories: inventory current change requests, reconcile new/merged/closed or retargeted work, preserve requirement and dependency priorities, maintain a roadmap document, or monitor material lifecycle/check/review changes over…

huangruiteng/loopx · 95 tokens

loopx-self-repair

Diagnose and repair LoopX control-plane drift or agent behavior drift. Use when a LoopX task makes unexpectedly small progress, follows a stale or contradictory recommendedaction, ignores a higher-priority blocked item while doing fallback work, reports vague owner/user gates, loses todo projection, misaligns…

huangruiteng/loopx · 102 tokens