Getting Started¶
This section takes you from installation to a complete event-driven PyTorch workflow.
By the end, you will know where training behavior lives, what Battery manages, and
how to inspect the results returned by each workflow.
Before you begin¶
You should be comfortable creating a PyTorch nn.Module, optimizer, dataset, and
DataLoader. No knowledge of the torch-batteries event system is required. The first
example runs on CPU with synthetic data and does not need downloads or external
services.
Recommended path¶
| Step | Page | What you will accomplish |
|---|---|---|
| 1 | Installation | Install the core package or an optional extra and verify the active version. |
| 2 | Quick Start | Train, validate, test, and predict with a complete copyable example. |
| 3 | Core Concepts | Understand the roles of the model, events, Battery, metrics, callbacks, and results. |
Read these pages in order on your first visit. Later, the Core Concepts page is a useful map when deciding whether new behavior belongs in a charged model method, a callback, or application code.
What the quick start establishes¶
A standard torch-batteries workflow has a small public surface:
- A model owns forward computation and methods charged to lifecycle events.
- Step methods return
StepOutputwith loss, predictions, targets, and optional manual metrics. Batteryowns device placement, phase loops, optimization, metric aggregation, callbacks, and structured results.- The application creates loaders and decides how to persist or consume results.
Continue by task¶
After completing the quick start, choose the guide that matches your next problem:
- Training and Evaluation for workflow contracts and legacy step-return forms.
- Metrics for callable, stateful, or collected calculations.
- Batches and Devices for nested inputs and device movement.
- Callbacks and Optimization for early stopping, schedulers, precision, clipping, and accumulation.
- Checkpoints and Resume for durable training state.
- Prediction for concatenated or streaming inference.
If something fails during setup, start with Troubleshooting.