Lightning-AI/torchmetrics
A PyTorch library providing implementations of evaluation metrics (accuracy, precision, F1, etc.) designed to work in distributed, scalable training environments.

Torchmetrics is a machine learning metrics library built specifically for PyTorch applications. It provides a collection of standardized metric implementations (accuracy, precision, recall, F1, AUC, etc.) that support distributed computation and are compatible with PyTorch Lightning. Metrics are implemented as torch.nn modules that can be passed to GPU and work across multiple devices for large-scale model evaluation.
Frequently asked
- What is Lightning-AI/torchmetrics?
- A PyTorch library providing implementations of evaluation metrics (accuracy, precision, F1, etc.) designed to work in distributed, scalable training environments.
- Is torchmetrics open source?
- Yes — Lightning-AI/torchmetrics is open source, released under the Apache-2.0 license.
- What language is torchmetrics written in?
- Lightning-AI/torchmetrics is primarily written in Python.
- How popular is torchmetrics?
- Lightning-AI/torchmetrics has 2.4k stars on GitHub.
- Where can I find torchmetrics?
- Lightning-AI/torchmetrics is on GitHub at https://github.com/Lightning-AI/torchmetrics.