Installation¶
Requirements¶
torch-batteries requires Python 3.12 or newer and PyTorch 2.9 or newer. The core
package supports CPU, CUDA, and Apple MPS devices. Install it from PyPI:
The core installation includes PyTorch and tqdm. It does not install notebook,
plotting, vision, reinforcement-learning, diffusion, or tracking packages.
Optional dependencies¶
Install W&B only when experiment tracking is needed:
Install the dependencies used by the maintained notebooks:
Install both groups when reproducing every example:
Device selection¶
Battery uses device="auto" by default and chooses CUDA, then MPS, then CPU.
Pass an explicit device when placement must be controlled:
The model is moved during Battery construction. Loader batches are moved
recursively before each step. Non-tensor metadata is preserved.
Confirm the installation¶
If WandbTracker reports that W&B is unavailable, install the wandb extra in the
same environment that runs the training process.