Download deployment/cache_metrics.py from BonanDing/worldmem-baseline-evals: direct link, hf CLI and curl.
- Browser
- Download file 561 Bytes
-
https://huggingface.co/BonanDing/worldmem-baseline-evals/resolve/181f4402aeeef8bd63844fcf2146162a5cc5f1b3/deployment/cache_metrics.py
- Command line
-
hf download hf://BonanDing/worldmem-baseline-evals@181f4402aeeef8bd63844fcf2146162a5cc5f1b3/deployment/cache_metrics.py
-
curl -L -o cache_metrics.py https://huggingface.co/BonanDing/worldmem-baseline-evals/resolve/181f4402aeeef8bd63844fcf2146162a5cc5f1b3/deployment/cache_metrics.py
561 Bytes
| """Prepare the exact common metric weights before offline evaluation workers.""" | |
| from pathlib import Path | |
| import sys | |
| sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "shared/metric_vendor")) | |
| from torchmetrics.image.fid import FrechetInceptionDistance | |
| from torchmetrics.image.lpip import LearnedPerceptualImagePatchSimilarity | |
| LearnedPerceptualImagePatchSimilarity(net_type="alex", normalize=True).eval() | |
| FrechetInceptionDistance(feature=2048, normalize=False).eval() | |
| print("Common LPIPS AlexNet and FID Inception weights are cached.", flush=True) | |