CSV loader tutorial #
This tutorial mirrors the "data first" workflow people expect from PyTorch:
- Load a dataset from disk (CSV).
- Turn it into a fixed-size batched dataset.
- Train through the public
TrainerAPI.
Generate a small deterministic regression dataset with
python3 NN/Examples/Data/generate_small_data.py:
NN/Examples/Data/small_regression.csvwith rowsx1,x2,y(25 samples).
Build:
lake build NN.Examples.Data.Loaders.Csv
The tutorial code is compiled with the rest of TorchLean. For command-line model training, use the
torchlean executable examples in NN/Examples/Models.
Optional flags (tutorial-specific):
--data-dir PATH(default:NN/Examples/Data)--csv PATH(override the CSV file)--seed S(controls shuffling and model initialization)--batch N--steps N
Public API used here:
Data.tabularCsvDatasetTrainer.newTrainer.RunConfigTrainer.TrainOptionstrainer.train
def
NN.Examples.Data.Loaders.Csv.mkModel
{batch : ℕ}
:
TorchLean.nn.M (TorchLean.nn.Sequential (TorchLean.Shape.mat batch inDim) (TorchLean.Shape.mat batch outDim))
A small 2-layer batched MLP 2 -> 8 -> 1.
Instances For
Command-line help for the CSV loader tutorial.