AGENT SKILL

training

Use BERT-pytorch to instantiate the model, train on a tiny corpus, choose CPU or CUDA, and save checkpoints.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
training
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Use BERT-pytorch to instantiate the model, train on a tiny corpus, choose CPU or CUDA, and save checkpoints.
disable-model-invocation
true

02 资源文件 3

03 SKILL.md 正文

training

Use this sub-skill when the task is about bert, BERT, BERTLM, BERTTrainer, model construction, device choice, training, or checkpoint saving.

What this covers

  • Instantiate BERT and BERTLM.
  • Build a BERTTrainer around a DataLoader.
  • Choose CPU or CUDA explicitly for a smoke run.
  • Save checkpoints and understand the .ep{epoch} suffix.
  • Diagnose hidden-size, attention-head, CUDA, and checkpoint-path errors.

What to do first

  • Build or load a valid vocab and corpus first; if those are missing, hand off to ../data-preparation/SKILL.md.
  • Use scripts/train_smoke.py for a safe one-epoch smoke run with explicit device selection.
  • Use CPU smoke when you only need a deterministic quick check.
  • Use CUDA smoke only when torch.cuda.is_available() is true and the host really has a compatible GPU setup.

Read these references

  • references/training-workflow.md: model/trainer flow, device selection, and checkpoint semantics.
  • references/troubleshooting.md: CLI bool flags, hidden/head mismatch, GPU, memory, and save-path issues.
  • ../data-preparation/SKILL.md: if the corpus or vocab is the actual blocker.

Related scripts

  • scripts/train_smoke.py: build a tiny dataset, train one epoch, and save a checkpoint.
  • ../../scripts/make_tiny_corpus.py: create a deterministic tiny corpus fixture when you want to run the smoke script against a known input.

Common outputs

  • BERT.forward() returns the encoded sequence tensor before the language-model heads.
  • BERTLM.forward() returns next-sentence and masked-language-model log probabilities.
  • BERTTrainer.save(epoch, file_path) writes file_path + ".ep{epoch}".
  • BERTTrainer chooses cuda:0 only when CUDA is available and requested.

Boundary reminders

  • Do not solve corpus layout or vocab serialization here.
  • Do not bury device-selection guidance inside the data-preparation route.
  • Keep the route focused on model instantiation, training, and checkpointing.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351