train

A command for training machine-learning and deep-learning models, including fine-tuning, transfer learning, and training from scratch.

In plain words
What is it for?
Use it to check GPUs and dependencies, prepare and split datasets, set training options, start jobs, monitor logs and metrics, and save or resume checkpoints.
Why use it?
It organizes common preparation and training checks, so you do not have to remember each step before starting a long model run.

Command

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 commands/xiaobei930/cc-best/train
Clone the repo
git clone --depth 1 https://github.com/xiaobei930/cc-best
Per session 8 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 589 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.00008 $0.00589
Opus 5 $0.00004 $0.00295
Sonnet 5 $0.00002 $0.00118
Haiku 4.5 $0.00001 $0.00059

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

Security

Grade A, and why

train 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.

commands/train.md · 106 lines

What it actually says

/train - 训练模型

训练项目中的机器学习/深度学习模型。

适用场景

  • 模型微调
  • 迁移学习
  • 从头训练

通用训练流程

1. 环境检查

# GPU 检查
python -c "import torch; print(f'CUDA: {torch.cuda.is_available()}')"
nvidia-smi

# 依赖检查
pip list | grep -E "torch|tensorflow|transformers"

2. 数据准备

  • 检查训练数据集是否就绪
  • 验证数据格式和质量
  • 划分训练/验证/测试集

3. 训练配置

# 示例配置结构
model:
  name: "model_name"
  pretrained: true

training:
  epochs: 10
  batch_size: 32
  learning_rate: 1e-4

data:
  train_path: "data/train"
  val_path: "data/val"

4. 启动训练

# 通用启动命令
python train.py --config config/train.yaml

# 使用 GPU
CUDA_VISIBLE_DEVICES=0 python train.py

# 后台运行
nohup python train.py > train.log 2>&1 &

训练监控

日志记录

  • Loss 变化曲线
  • 验证集指标
  • 学习率变化

Checkpoint 管理

  • 定期保存模型权重
  • 保留最优模型
  • 支持断点续训

常用框架

框架 训练命令
PyTorch python train.py
Hugging Face python -m transformers.trainer
TensorFlow python train.py
PyTorch Lightning python train.py

注意事项

  • 确保有足够的 GPU 显存
  • 使用 tmux/screen 后台运行长时间任务
  • 定期保存训练状态和 checkpoint
  • 记录实验参数和结果

项目定制

根据项目需要修改此文件,添加具体的:

  • 模型类型和参数
  • 数据集路径
  • 训练脚本位置
  • 评估指标

记住: 训练是投资而非成本——花 10 分钟训练 AI 理解项目规范,省下数小时的手动纠正。

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 · 106 lines · 8 tokens per session scan A 30ccab3a554f

Subscribe to this mod's changes

train is a command published in the GitHub repository xiaobei930/cc-best (50 stars, last pushed 2mo ago), licensed MIT. It adds 8 tokens to every session and 589 once invoked, about $0.0000 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.