L’interface est localisée ; les présentations et documents des Skills sont traduits automatiquement par IA dans votre langue. Le code, les commandes, chemins et termes techniques restent en version originale, et le document de l’auteur fait foi.
Explorer les Skills
Productivité · SKILL.md

torchmetrics

torchmetrics

Use TorchMetrics to choose, inspect, and combine metric families for PyTorch evaluation, including core API, domain metrics, model-based metrics, and wrappers.

Independent GitHub snapshot · Automated classification · Original documentation governs

Documentation de la Skill

GitHub

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

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:

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
Skills enregistrées