Training
Use this sub-skill for ordinary Chainer model-building and training tasks.
It covers define-by-run code, datasets, iterators, trainers, extensions, serializers, and single-node CPU or GPU execution.
Typical requests
- "How do I define a model with
Link, Chain, or ChainList?"
- "How do I train a classifier or language model?"
- "How do I save and resume a
Trainer?"
- "How do I use
SerialIterator, Evaluator, or LogReport?"
- "How do I move the model or data to GPU?"
- "How do I use the MNIST, CIFAR, PTB, or serialization examples?"
Read these first
references/workflows.md for the training flow.
references/api-reference.md for the key classes and exact signatures.
references/examples.md for the example-family map.
references/troubleshooting.md for training, serialization, and device issues.
Use these scripts
../../scripts/training_smoke.py for a tiny end-to-end training loop.
../../scripts/serialization_smoke.py for NPZ and HDF5 save/load checks.
../../scripts/runtime_probe.py when the environment might not import cleanly.
Include here
- Define-by-run model construction with
Variable, Function, Link, Chain, ChainList, and Sequential.
- Dataset and iterator workflows, including
DatasetMixin, TupleDataset, SerialIterator, and minibatch conversion.
Trainer, StandardUpdater, ParallelUpdater, triggers, and built-in extensions.
- Snapshot and persistence workflows with
save_npz, load_npz, and HDF5 when available.
- CPU and GPU single-node workflows, including
to_gpu, to_cpu, get_device, and using_device.
- Static-graph optimization examples when the model is a repeated schedule.
Route elsewhere
- ONNX or Caffe conversion ->
../export/
- ChainerMN / MPI / multi-node training ->
../distributed/
- ChainerX build or device behavior ->
../chainerx/
- Repository build and test questions -> root install and troubleshooting references
Quick mental model
A typical single-node workflow is:
- Build the model with
Link or Chain.
- Prepare a dataset and iterator.
- Wrap the model with an optimizer.
- Create an updater and trainer.
- Add evaluators, reporters, and snapshot extensions.
- Save and load state with serializers.
If the user asks for a runnable check, prefer the bundled smoke scripts over the original repo examples.
1---2name: training-43description: "Routes Chainer define-by-run, dataset, trainer, serializer, and4 single-node example workflows."5metadata:6 source: https://skillmd.com/skills/vectorspacelab/training-47 disco-role: operating8disable-model-invocation: true9license: MIT10---1112# Training1314Use this sub-skill for ordinary Chainer model-building and training tasks.15It covers define-by-run code, datasets, iterators, trainers, extensions, serializers, and single-node CPU or GPU execution.1617## Typical requests1819- "How do I define a model with `Link`, `Chain`, or `ChainList`?"20- "How do I train a classifier or language model?"21- "How do I save and resume a `Trainer`?"22- "How do I use `SerialIterator`, `Evaluator`, or `LogReport`?"23- "How do I move the model or data to GPU?"24- "How do I use the MNIST, CIFAR, PTB, or serialization examples?"2526## Read these first2728- `references/workflows.md` for the training flow.29- `references/api-reference.md` for the key classes and exact signatures.30- `references/examples.md` for the example-family map.31- `references/troubleshooting.md` for training, serialization, and device issues.3233## Use these scripts3435- `../../scripts/training_smoke.py` for a tiny end-to-end training loop.36- `../../scripts/serialization_smoke.py` for NPZ and HDF5 save/load checks.37- `../../scripts/runtime_probe.py` when the environment might not import cleanly.3839## Include here4041- Define-by-run model construction with `Variable`, `Function`, `Link`, `Chain`, `ChainList`, and `Sequential`.42- Dataset and iterator workflows, including `DatasetMixin`, `TupleDataset`, `SerialIterator`, and minibatch conversion.43- `Trainer`, `StandardUpdater`, `ParallelUpdater`, triggers, and built-in extensions.44- Snapshot and persistence workflows with `save_npz`, `load_npz`, and HDF5 when available.45- CPU and GPU single-node workflows, including `to_gpu`, `to_cpu`, `get_device`, and `using_device`.46- Static-graph optimization examples when the model is a repeated schedule.4748## Route elsewhere4950- ONNX or Caffe conversion -> `../export/`51- ChainerMN / MPI / multi-node training -> `../distributed/`52- ChainerX build or device behavior -> `../chainerx/`53- Repository build and test questions -> root install and troubleshooting references5455## Quick mental model5657A typical single-node workflow is:58591. Build the model with `Link` or `Chain`.602. Prepare a dataset and iterator.613. Wrap the model with an optimizer.624. Create an updater and trainer.635. Add evaluators, reporters, and snapshot extensions.646. Save and load state with serializers.6566If the user asks for a runnable check, prefer the bundled smoke scripts over the original repo examples.