Shared Real-Data Helpers for Model Examples #
The model examples should exercise real data paths. We keep the shared pieces here:
- 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.
Number of channels in the prepared CIFAR-10 image tensors.
Instances For
Height of the prepared CIFAR-10 image tensors.
Instances For
Width of the prepared CIFAR-10 image tensors.
Instances For
Number of CIFAR-10 classes, hence the width of one-hot targets.
Instances For
Default row budget for CIFAR-10 model example commands.
Instances For
Number of channels in converted ImageNet-style image tensors.
Instances For
Height of converted ImageNet-style image tensors.
Instances For
Width of converted ImageNet-style image tensors.
Instances For
Number of ImageNet-style classes expected by the converted label path.
Instances For
Default row budget for ImageNet64 model example runs.
Instances For
Shape of one CIFAR-10 image after conversion to channel-first layout.
Instances For
One-hot CIFAR-10 target shape.
Instances For
Take the top-left cropHeight × cropWidth view of a CIFAR image batch.
Instances For
Take the top-left cropHeight × cropWidth view of a CIFAR image batch.
Invalid crop sizes are reported at the executable boundary.
Instances For
Crop a CIFAR minibatch while leaving the one-hot class labels unchanged.
Instances For
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
Error message shown when a CIFAR-backed example cannot find the prepared arrays.
Instances For
Error message shown when an ImageNet64-backed example cannot find the prepared arrays.
Instances For
Error message shown when a text-model example cannot find a corpus.
Instances For
Error message shown when the Auto MPG CSV is missing.
Instances For
Error message shown when the household-power forecasting dataset is missing.
Instances For
Parse the shared NPY data flags with CIFAR-10's default paths and row count filled in.
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
Parsed CIFAR dataset and fixed-sample training flags for runnable model examples.
Instances For
Parsed CIFAR dataset and optimizer/training flags for classifier examples.
Instances For
Parse the standard CIFAR plus fixed-step training flags and reject unused arguments.
Generative examples use the same prepared CIFAR arrays and the same loss-curve logging contract; only the model and target construction differ.
Instances For
Parse the standard CIFAR plus optimizer/training flags.
Vision examples share the same CIFAR data boundary and optimizer controls; architecture files only
need to provide the model constructor and logging title. Any remaining arguments are preserved so
the caller can forward runtime flags such as --device cpu, --device cuda, or
--execution typed-graph to the public Trainer.RunConfig parser.
Instances For
Parse the shared flags for household-power forecasting windows.
Forecasting commands share --data-dir, --x, --y, --windows, --report-offset, and --seed.
Instances For
Parsed household-power forecasting data plus optimizer/training flags.
Instances For
Parse the standard household-power forecasting flags plus optimizer/training flags.
The forecasting command still owns the model and reporting logic, but the shared data/runtime flag surface lives here with the other real-data code.
Instances For
Build a batched CIFAR-10 loader from the image and label .npy files.
Both files are required up front, with a hint pointing at the converter script, so a missing dataset fails with something actionable rather than a decode error halfway through the first epoch.
Instances For
Common training-log notes for CIFAR-backed classifier examples.
Instances For
Load one shuffled epoch of full CIFAR-10 minibatches from prepared .npy arrays.
Instances For
Load the first full CIFAR-10 minibatch from the shared CIFAR loader.
Instances For
Load a user-prepared ImageNet-style 64x64 minibatch.
This loader reads prepared .npy arrays rather than JPEG files. 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
Load one shuffled epoch of full ImageNet64-style minibatches from prepared .npy arrays.
Instances For
Load the first full ImageNet64-style minibatch from the shared ImageNet64 loader.
Instances For
Load a CIFAR minibatch, flatten each channel-first image, and retain its first config.dataWidth
values. This is a prefix of the image buffer, not a spatial resize or learned feature extraction.
Widths larger than the full image are rejected.
Instances For
Public singleton dataset for compact vector generative examples over flattened CIFAR batches.
Autoencoder and supervised latent-bottleneck examples load one real CIFAR batch, flatten it to the compact vector boundary, build one supervised sample, and hand that sample to the public trainer API. The sample itself may be Float-specific; this dataset constructor casts it into the runtime-selected arithmetic representation so the command still works across the ordinary public runtime backends.
Instances For
Shared text-corpus CLI/data boundary for local text-model examples.
Instances For
Command-line options shared by local text-corpus examples.
Instances For
Parse the shared --data-file flag used by local text-model examples.
--tiny-shakespeare is accepted as an explicit shortcut for the default corpus path.
Instances For
Read the selected text corpus and fail with a shared preparation hint when it is missing.
Instances For
Text corpus selection plus the number of causal training windows to expose.
- corpus : TextCorpusFlags
Selected UTF-8 corpus.
- windows : ℕ
Number of approximately evenly spaced windows in the finite training dataset.
Instances For
Instances For
Command-line options shared by finite-window text examples.
Instances For
Read the selected text corpus.