#!/usr/bin/env bash
# Paper FID protocol on the authors' released OT-CFM CIFAR-10 weights (400k steps):
# 50,000 samples with the dopri5 solver, FID against CIFAR-10 train (clean-fid).
set -o pipefail
ROW=/var/tmp/kv-repro/017-atong01-conditional-flow-matching
cd examples/images/cifar10 || exit 1
echo "KVERITAS_ARTIFACT role=model name=otcfm_cifar10_weights_step_400000.pt path=../data/results/otcfm/otcfm_cifar10_weights_step_400000.pt visibility=public"
echo "KVERITAS_PHASE name=fid"
python -u compute_fid.py --model otcfm --step 400000 --integration_method dopri5 --input_dir "$ROW/data/results" 2>&1 | tee "$ROW/fid.out" || exit 1
fid=$(grep -oP '^FID:\s+\K[0-9.]+' "$ROW/fid.out")
echo "KVERITAS_METRIC name=fid_50k value=$fid"
echo "KVERITAS_CLAIM metric=fid_50k value=$fid"
