# Lightning-AI/torchmetrics

Machine learning metrics for distributed, scalable PyTorch applications.

Repository: https://github.com/Lightning-AI/torchmetrics
Canonical: https://ross.abutalabs.com/products/torchmetrics
Homepage: https://lightning.ai/docs/torchmetrics/
Language: Python
License: Apache-2.0
License Family: permissive
Topics: python, data-science, machine-learning, pytorch, deep-learning, metrics, analyses
Last push: 2026-08-20T18:21:33+00:00

## Health v2 (maintenance only)
Score: 90/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 98, release rhythm 74, longevity 100
- inputs: {"age_days": 2080, "days_push": 13, "days_rel": 177, "gap_med": 18, "n_releases_24m": 18}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2461, forks 517 (observed 2026-08-28T04:06:53.463606+00:00)

## What it is
TorchMetrics is a PyTorch-native library of machine learning metrics that work in distributed and scalable training pipelines. It provides 100+ built-in metrics (classification, regression, retrieval, multimodal, etc.) with a simple API for defining custom metrics.

## Use cases
- compute accuracy, F1, and ROC-AUC during PyTorch training
- evaluate model metrics across distributed multi-GPU training
- implement a custom metric that accumulates batch statistics
- track validation metrics with PyTorch Lightning
- calculate image segmentation or object detection metrics
- evaluate retrieval and ranking quality for recommendation models

## When to choose
- you train models in PyTorch or PyTorch Lightning and need reliable, well-tested metrics
- you need metrics that aggregate correctly across distributed workers
- you want a broad catalog of metrics with a consistent API

## When to avoid
- you work in TensorFlow, JAX, or scikit-learn ecosystems with their own metric tooling
- you need only simple numpy-based evaluation without PyTorch

## Facets
- artifact type: library
- maturity: stable
- function: machine-learning, benchmarking, data-science
- domain: machine-learning, deep-learning, data-science
- platform: python
- tags: pytorch, metrics, distributed-computing, model-evaluation

## Member repositories
- Lightning-AI/torchmetrics (main) score 90

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:53.463606+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:29:19.078313+00:00, confidence not recorded.
  - readme: https://github.com/Lightning-AI/torchmetrics (fetched 2026-08-28T04:06:53.463606+00:00, sha 81c92b8431d2)
  - homepage: https://lightning.ai/docs/torchmetrics/ (fetched 2026-08-29T10:11:15.333660+00:00, sha 9c55a9440a9c)
  - registry_pypi: https://pypi.org/pypi/torchmetrics/json (fetched 2026-08-29T10:11:15.335894+00:00, sha 3793ae269ad6)
- Data as of 2026-08-30T08:39:29.467469+00:00.
