Shared Real-Data Helpers for Model Examples #
NN/Examples/Models/* should exercise real data paths. This file centralizes the shared parts:
- loading a prepared CIFAR-10 NPY minibatch,
- reading a local text corpus, and
- printing the same "how to prepare data" hint everywhere.
The data files are prepared by scripts/datasets/download_example_data.py; examples report missing inputs
explicitly instead of silently falling back to synthetic tensors.
ImageNet-style converted image shape used by the higher-resolution diffusion example.
Instances For
One-hot target shape for ImageNet-style folders.
The diffusion example ignores labels, but reusing Data.LabeledSource keeps the data path identical
to the supervised examples and lets class-directory conversion catch malformed labels early.
Instances For
Parse the shared flags for an ImageNet-style 64x64 NPY dataset.
The expected input is produced by scripts/datasets/torchlean_data_convert.py image-folder; that converter
handles JPEG/PNG decoding, RGB conversion, resizing, class-directory labels, and the final NCHW
layout. Lean then reads only the simple .npy tensors.
Instances For
Instances For
Instances For
Load a user-prepared ImageNet-style 64x64 minibatch.
This is intentionally a .npy reader, not a JPEG reader. The Python converter is the trust boundary
for filesystem image decoding and resizing; this Lean path checks the resulting tensor shape and class
range before handing the batch to examples.
Instances For
Instances For
Load a CIFAR minibatch and expose it as a compact flattened vector batch.
The file paths and download hints remain in NN.Examples, but the flattening logic itself lives in
NN.API.Models.Generative so users can reuse it with their own image tensors.