Skip to content
Back to skills

Torchmetrics

ASecurity

"Use TorchMetrics to choose, inspect, and combine metric families

  • 247 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 9, 2026
developmentpythonbashdebuggingapibackend

Works with

  • cli
  • api

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 20 files and shows the line behind each finding

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill torchmetrics --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Torchmetrics?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Torchmetrics
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-torchmetrics/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-torchmetrics)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: torchmetrics
description: "Use TorchMetrics to choose, inspect, and combine metric families
  for PyTorch evaluation, including core API, domain metrics, model-based
  metrics, and wrappers."
disable-model-invocation: true
metadata:
  disco-role: operating
license: Apache 2.0
---

# TorchMetrics

TorchMetrics is a metric library for PyTorch evaluation.
Use this skill when the request is about choosing, calling, combining, or debugging TorchMetrics APIs rather than about training a model itself.

## Start here

- Read [references/metric-selection-cheatsheet.md](references/metric-selection-cheatsheet.md) to map a user request to the right sub-skill.
- Run [scripts/check_torchmetrics_environment.py](scripts/check_torchmetrics_environment.py) with `--device auto` to confirm the install and core imports.
- Read [references/repo-provenance.md](references/repo-provenance.md) when you need freshness, source-version, or staleness checks.
- Read [references/troubleshooting.md](references/troubleshooting.md) when install, import, backend, device, distributed, plotting, or model-download problems appear.

## Route map

- `core-api` — `Metric`, functional versus module metrics, `update` / `compute` / `forward` / `reset`, custom metric state, Lightning logging, DDP behavior, persistence.
- `basic-metric-domains` — classification, regression, retrieval, clustering, nominal, and other tensor-only metric families.
- `vision-detection-metrics` — image quality, segmentation, detection, and panoptic metrics.
- `audio-text-metrics` — audio and speech quality metrics plus no-download text metrics such as ROUGE, WER, CER, BLEU, SacreBLEU, and Perplexity.
- `model-based-metrics` — BERTScore, InfoLM, CLIPScore, CLIP-IQA, FID/KID/LPIPS/DISTS/ARNIQA/PPL, DNSMOS, NISQA, VMAF, and similar metrics that need pretrained assets or external model planning.
- `collections-wrappers-plotting` — `MetricCollection`, wrappers, trackers, and plotting.

## How to choose

1. If the task is about implementing or debugging a custom `Metric`, start with `core-api`.
2. If the task names a familiar metric family such as accuracy, F1, MSE, nDCG, or Cramer's V, use the sub-skill that owns that family.
3. If the task is about combining metrics, renaming outputs, tracking metrics over epochs, or plotting results, use `collections-wrappers-plotting`.
4. If the metric may instantiate a pretrained model, feature extractor, or large optional asset, route to `model-based-metrics`.
5. If a request spans families, choose the primary metric family first, then follow the route back to `core-api` or `collections-wrappers-plotting` as needed.

## Install guidance

TorchMetrics has no verified console CLI. Install it from Python:

```bash
pip install torchmetrics
```

Then add only the extra that matches the route you chose when needed, for example `torchmetrics[audio]`, `torchmetrics[image]`, `torchmetrics[text]`, `torchmetrics[detection]`, `torchmetrics[multimodal]`, `torchmetrics[video]`, `torchmetrics[visual]`, or `torchmetrics[clustering]`.
Avoid `torchmetrics[all]` unless you truly need a very broad evaluation environment.

## Fast checks

- `python -c "import torchmetrics; print(torchmetrics.__version__)"`
- `python scripts/check_torchmetrics_environment.py --device auto`

## Common signals

- `Metric`, `add_state`, `compute_with_cache`, `LightningModule`, or `DDP` -> `core-api`
- `Accuracy`, `F1`, `MSE`, `nDCG`, `ClusterAccuracy`, or `CramersV` -> `basic-metric-domains`
- `PSNR`, `DiceScore`, `MeanAveragePrecision`, or `PanopticQuality` -> `vision-detection-metrics`
- `SNR`, `PESQ`, `WER`, `ROUGE`, or `Perplexity` -> `audio-text-metrics`
- `BERTScore`, `CLIPScore`, `FID`, `LPIPS`, `DNSMOS`, or `VMAF` -> `model-based-metrics`
- `MetricCollection`, `ClasswiseWrapper`, `MetricTracker`, or `.plot()` -> `collections-wrappers-plotting`

Files in this skill

  • SKILL.md3.8 KB
  • references/metric-selection-cheatsheet.md2.3 KB
  • references/repo-provenance.md957 B
  • references/repo-routing-metadata.json516 B
  • references/troubleshooting.md4.4 KB
  • scripts/check_torchmetrics_environment.py5.4 KB
  • sub-skills/audio-text-metrics/SKILL.md2.8 KB
  • sub-skills/audio-text-metrics/references/audio-text-api.md4.5 KB
  • sub-skills/audio-text-metrics/references/audio-text-workflows.md3.1 KB
  • sub-skills/audio-text-metrics/references/troubleshooting.md2.2 KB
  • sub-skills/audio-text-metrics/scripts/audio_text_metric_smoke.py4 KB
  • sub-skills/basic-metric-domains/SKILL.md3.9 KB
  • sub-skills/basic-metric-domains/references/basic-domains-api.md5.9 KB
  • sub-skills/basic-metric-domains/references/domain-workflows.md3.5 KB
  • sub-skills/basic-metric-domains/references/troubleshooting.md2.5 KB
  • sub-skills/basic-metric-domains/scripts/basic_domain_metric_smoke.py3.5 KB
  • sub-skills/collections-wrappers-plotting/SKILL.md3.4 KB
  • sub-skills/collections-wrappers-plotting/references/collections-wrappers-api.md3.9 KB
  • sub-skills/collections-wrappers-plotting/references/plotting-and-tracking.md3 KB
  • sub-skills/collections-wrappers-plotting/references/troubleshooting.md2.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.