TorchLean API

NN.Examples.Data.Loaders.Cifar10Images

CIFAR10-style image loader tutorial (NPY, offline) #

This tutorial mirrors a classic PyTorch recipe:

  1. Load a labeled image dataset from disk (.npy exported from NumPy/PyTorch).
  2. Split into train/test.
  3. Build a small CNN by explicitly stacking layers.
  4. Train for multiple epochs over shuffled minibatches through the public Trainer API.

To keep this runnable without network downloads, generate a small deterministic "CIFAR10-shaped" dataset locally:

Generate it with:

python3 NN/Examples/Data/generate_small_data.py

Build:

Run this tutorial with lake exe torchlean data_cifar10 --check-only to validate the files, or omit --check-only to train and print a prediction for a blank image. The held-out split is reported here; this tutorial does not compute test accuracy.

For command-line CIFAR training, use torchlean cnn or torchlean vit with --x, --y, and --n-total.

Optional flags (tutorial-specific):

Why this tutorial matters:

Command name used in diagnostics and by the top-level example runner.

Instances For

    CIFAR-10 has ten classes.

    Instances For

      CIFAR-10 images are 32 by 32.

      Instances For

        Default number of leading images loaded from pre-generated or downloaded files.

        Instances For

          Small CNN (no BatchNorm): Conv -> ReLU -> Pool -> Conv -> ReLU -> Pool -> Linear(10).

          Instances For

            Shared offline CIFAR10-like tensor source used by this tutorial.

            Instances For

              Command-line help for the CIFAR10-style NPY loader tutorial.

              Instances For

                Entry point. --check-only loads and validates the data and split without training. --real-cifar10 selects prepared real-data paths; neither mode generates missing files. Both switches are stripped before the remaining flags reach the shared training-flag parser.

                Instances For