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
- 参考文档references/model-based-api.md5.1 KB
- 参考文档references/model-based-workflows.md3.2 KB
- 参考文档references/troubleshooting.md2.0 KB
- 脚本scripts/model_based_import_check.py3.7 KB
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.mdfor the shared Metric lifecycle, distributed sync, persistence, and Lightning logging. - Read
../vision-detection-metrics/SKILL.mdfor PSNR, SSIM, Dice, MeanIoU, mAP, and other non-model image/detection metrics. - Read
../audio-text-metrics/SKILL.mdfor SNR, PESQ, WER, ROUGE, BLEU, SacreBLEU, and Perplexity. - Read
../collections-wrappers-plotting/SKILL.mdfor MetricCollection, wrappers, trackers, and plotting.
Quick use
- Check whether the user actually needs a model-backed metric or only a simple tensor metric.
- Decide which pretrained model, tokenizer, or feature extractor to use, and whether a cache is already available.
- Check whether the requested environment can satisfy downloads, device placement, and memory use.
- Prefer no-download import/signature checks when you only need to document or inspect the API.
Fast checks
python scripts/model_based_import_check.pypython -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 InfoLMCLIPScore,CLIPImageQualityAssessment,openai/clip-...-> CLIP metricstorch_fidelity,feature extractor,InceptionScore,FID,KID-> image feature metricspiq,torchvisionweights,LPIPS,DISTS,ARNIQA,PerceptualPathLength-> image model-based metricslibrosa,onnxruntime,requests,DNSMOS,NISQA-> audio model-based metricsvmaf_torch,VideoMultiMethodAssessmentFusion-> video quality metric
04 同仓库更多 Skills
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.
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.
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.
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.
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.
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).