nn-training-workflows
Author and train Jittor models with layers, losses, optimizers, schedulers, and state handling.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- nn-training-workflows
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Author and train Jittor models with layers, losses, optimizers, schedulers, and state handling.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/nn-api-reference.md4.8 KB
- 参考文档references/training-recipes.md2.8 KB
- 参考文档references/troubleshooting.md3.8 KB
- 脚本scripts/training_smoke.py4.3 KB
03 SKILL.md 正文
nn-training-workflows
Use this sub-skill for Jittor model authoring, scratch training loops, optimizer and scheduler setup, parameter/state handling, gradient accumulation, and train/eval behavior.
Start here
- Read
references/nn-api-reference.mdfor the layer, loss, optimizer, scheduler, and init signatures that matter for training. - Read
references/training-recipes.mdfor the bounded quadratic-regression recipe, PyTorch-to-Jittor porting map, accumulation order, and save/load pattern. - Read
references/troubleshooting.mdwhen training fails, loss shapes mismatch, parameters are missing, or state does not reload. - Run
scripts/training_smoke.pyto verify a tiny CPU training loop; it is CPU-safe and network-free by default. Use--helpfirst, then--stepsand--assert-loss-dropfor a bounded check.
Use when
- You need to define a model by subclassing
Moduleand implementingexecute. - You need
nn.Linear,nn.Conv,nn.BatchNorm,nn.Dropout,nn.Sequential, or recurrent layers for a training graph. - You need
nn.SGD,nn.Adam,nn.AdamW,nn.RMSprop,nn.Adan,Optimizer.step,backward,zero_grad, gradient clipping, or a learning-rate scheduler. - You need
state_dict,load_state_dict,save,load, or checkpoint conversion between Jittor and PyTorch-style state bundles. - You need a bounded recipe for accumulation, clipping, or mode switching.
Do not use for
- Raw Var or autograd fundamentals.
- Dataset, dataloader, model-zoo, or checkpoint-download workflows.
- Backend flags, compiler setup, or runtime/performance tuning.
Operating rules
- Implement
execute, notforward. - Call
model.train()before training andmodel.eval()before validation or inference. - Use
optimizer.step(loss)for the simple case, oroptimizer.backward(loss)plusoptimizer.step()when you need accumulation. - Keep non-trainable state in buffers, not in hidden Python containers.
- Treat
state_dictshape and name mismatches as a load-time issue to inspect, not something to ignore silently.
Fast path
- Confirm the model exposes parameters.
- Pick the loss whose shape contract matches the target.
- Choose an optimizer and, if needed, a scheduler.
- Verify with
scripts/training_smoke.py. - If the loop is unstable, open the troubleshooting reference before changing the architecture.
04 同仓库更多 Skills
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.
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.
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.
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.
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.
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).