"""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)