Skip to content

Complete PyTorch projects

Start at P1 and build toward P8, or choose the workflow linked from your current guide. Each card states what to read, what data it needs and what output to inspect.

P1–P4 · Foundations

P1 · Nonlinear regression

Compare a straight-line model with a nonlinear network and inspect validation mean squared error (MSE).

Read first: 1.1 · Build and train

Data: Synthetic numeric data generated by the script; CPU, no download.

Inspect: The script prints validation losses and refreshes the retained prediction chart; run a disposable copy to preserve the checked-in image.

P2 · EMNIST letters

Trace grayscale images through a CNN and inspect class-level mistakes.

Read first: 1.1 · Build and train · 1.2 · Images and CNNs

Data: Public EMNIST Letters through TorchVision; full runs download missing data. The smoke check needs no download.

Inspect: Inspect predictions, curves, confusion matrix and the selected checkpoint in artifacts/emnist/.

P3 · Robust image pipeline

Make readable files, rejected samples and stable class IDs explicit before training.

Read first: 1.1 · Build and train · 1.2 · Images and CNNs

Data: Public CIFAR-10, materialized into five class folders with a deliberate corrupt file. The smoke check uses local temporary files.

Inspect: Inspect the rejected-file report, saved class mapping and predictions in artifacts/robust-pipeline/.

P4 · Nature CNN

Connect reusable CNN blocks with training/validation curves and checkpoint selection.

Read first: 1.2 · Images and CNNs

Data: Public CIFAR-100 filtered to 15 nature classes; full runs download missing data. The shape smoke check is offline.

Inspect: Inspect the validation-selected checkpoint and final test report in artifacts/nature-cnn/; the three curve diagrams are illustrations.

P5–P7 · Training, vision and text

P5 · Controlled training comparison

Compare two learning rates with matched starts, splits, schedules and accumulation.

Read first: 2.1 · Metrics and tuning · 2.2 · Efficient pipelines

Data: Small generated classification dataset; offline CPU default.

Inspect: Inspect per-epoch validation metrics and the comparison JSON; a short toy run does not choose a universal learning rate.

P6 · Image augmentation and head training

Inspect transform order, frozen backbone state and a changing classifier head.

Read first: 3.1 · Data, transforms and noise · 3.2 · Pretrained models

Data: Generated images and random ResNet weights by default; offline CPU. Own image folders plus --pretrained are optional.

Inspect: Inspect transform panels, unchanged backbone/buffers and changed head weights; the default demonstrates mechanics, not transfer quality.

P7 · Variable-length text classifier

Build a training-only vocabulary and batch different lengths with IDs and offsets.

Read first: 4.1 · Tokens and embeddings · 4.2 · Classifiers and fine-tuning

Data: Original tiny phrases included in the script; offline CPU, no pretrained download.

Inspect: Inspect vocabulary, predictions and the saved text contract; reversing word order demonstrates the pooling limit.

P8 · Model lifecycle

P8 · Model lifecycle and pruning

Restore weights, resume one update, reuse an encoder and inspect pruning state.

Read first: 6.1 · Memory, checkpoints and tracking · 6.2 · Compression, export and deployment

Data: Six generated feature rows and a tiny model; offline CPU, no downloads.

Inspect: Inspect equality checks, shapes, zero counts and actual file bytes in report.json; the script does not benchmark speed.

Running and interpreting the examples

Run commands from the repository root after preparing the project dependencies described in the README. On Windows, use py -3.14 in place of python if that is your installed launcher. The Complete source section of each project contains the maintained script.

P1 and P5–P8 use small offline CPU defaults. P2–P4 offer --smoke-test without dataset downloads; their training runs use --device auto and may download missing public datasets. Add --device cpu to require CPU. Optional full/GPU runs increase the budget and need compatible hardware.

P1 refreshes a checked-in prediction image. Run it in a disposable copy when you want to preserve the retained chart. Other experiment outputs belong under ignored artifacts/; a weight file needs its architecture and input contract to be useful later.

What a small run proves

Synthetic inputs and smoke checks make mechanics inspectable. They do not establish real-data quality, pretrained transfer performance or a device speedup. Compare a reported value with its declared inputs, configuration and evidence before drawing a conclusion.

Return to the learning map for the guide route, or use Quick reference to debug a specific operation.