File size: 987 Bytes
7c2871f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
# Usage: bash scripts/eval_all.sh <method_name> <ckpt_path>
set -euo pipefail
cd "$(dirname "$0")/.."
[ -f .env ] && set -a && . ./.env && set +a

METHOD="${1:?method name required (cta|psm|radr)}"
CKPT="${2:?ckpt path required}"
OUT_DIR="outputs/$METHOD/eval_$(date +%Y%m%d_%H%M%S)"

CFG_DIR="outputs/$METHOD/hydra"
# pick latest hydra config file
CFG_FILE=$(find "$CFG_DIR" -name "config.yaml" -type f | sort | tail -1 || true)
if [ -z "$CFG_FILE" ]; then
  # fallback: re-compose
  mkdir -p "$OUT_DIR"
  python3 -c "
from hydra import initialize, compose
from omegaconf import OmegaConf
with initialize(version_base=None, config_path='../configs'):
    cfg = compose(config_name='train', overrides=['method=$METHOD'])
OmegaConf.save(cfg, '$OUT_DIR/config.yaml')
"
  CFG_FILE="$OUT_DIR/config.yaml"
fi

python3 tools/run_eval.py \
    --config "$CFG_FILE" \
    --ckpt "$CKPT" \
    --out_dir "$OUT_DIR" \
    --protocols "1,2,3,4"

echo "[eval] done → $OUT_DIR"