AGENT SKILL

model-based-metrics

Use TorchMetrics metrics that load pretrained models, feature extractors, external weights, caches, or download-backed assets.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
model-based-metrics
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Use TorchMetrics metrics that load pretrained models, feature extractors, external weights, caches, or download-backed assets.
disable-model-invocation
true

02 资源文件 4

03 SKILL.md 正文

Model-Based Metrics

Use this sub-skill when a TorchMetrics metric depends on pretrained weights, a model or tokenizer, external feature extractors, a cache, or a network-backed asset.

Route map

  • Read references/model-based-api.md when you need constructor arguments, supported model names, cache/device rules, or output-shape details for model-backed metrics.
  • Read references/model-based-workflows.md when you need copyable usage patterns or planning guidance for BERTScore, CLIPScore, CLIP-IQA, FID/KID, LPIPS/DISTS/ARNIQA, DNSMOS, NISQA, VMAF, or related metrics.
  • Read references/troubleshooting.md when import succeeds but model loading, cache lookup, device placement, or optional dependency handling fails.
  • Run scripts/model_based_import_check.py for a no-download import and signature check that confirms the installed package exposes the expected classes.

What this sub-skill covers

  • Text model-based metrics: BERTScore, InfoLM.
  • Multimodal CLIP metrics: CLIPScore, CLIPImageQualityAssessment.
  • Image feature/model metrics: FrechetInceptionDistance, KernelInceptionDistance, InceptionScore, MemorizationInformedFrechetInceptionDistance, LearnedPerceptualImagePatchSimilarity, DeepImageStructureAndTextureSimilarity, ARNIQA, PerceptualPathLength.
  • Audio model-backed metrics: DeepNoiseSuppressionMeanOpinionScore, NonIntrusiveSpeechQualityAssessment.
  • Video and facial/multimodal metrics: VideoMultiMethodAssessmentFusion, LipVertexError.

Route elsewhere

  • Read ../core-api/SKILL.md for the shared Metric lifecycle, distributed sync, persistence, and Lightning logging.
  • Read ../vision-detection-metrics/SKILL.md for PSNR, SSIM, Dice, MeanIoU, mAP, and other non-model image/detection metrics.
  • Read ../audio-text-metrics/SKILL.md for SNR, PESQ, WER, ROUGE, BLEU, SacreBLEU, and Perplexity.
  • Read ../collections-wrappers-plotting/SKILL.md for MetricCollection, wrappers, trackers, and plotting.

Quick use

  1. Check whether the user actually needs a model-backed metric or only a simple tensor metric.
  2. Decide which pretrained model, tokenizer, or feature extractor to use, and whether a cache is already available.
  3. Check whether the requested environment can satisfy downloads, device placement, and memory use.
  4. Prefer no-download import/signature checks when you only need to document or inspect the API.

Fast checks

  • python scripts/model_based_import_check.py
  • python -c "from torchmetrics.text import BERTScore; import inspect; print(inspect.signature(BERTScore.__init__))"

Common signals

  • model_name_or_path, model, user_tokenizer, user_forward_fn, baseline_path, baseline_url, rescale_with_baseline, truncation -> BERTScore or InfoLM
  • CLIPScore, CLIPImageQualityAssessment, openai/clip-... -> CLIP metrics
  • torch_fidelity, feature extractor, InceptionScore, FID, KID -> image feature metrics
  • piq, torchvision weights, LPIPS, DISTS, ARNIQA, PerceptualPathLength -> image model-based metrics
  • librosa, onnxruntime, requests, DNSMOS, NISQA -> audio model-based metrics
  • vmaf_torch, VideoMultiMethodAssessmentFusion -> video quality metric

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351