huahua123313's picture
Add files using upload-large-folder tool
7c2871f verified
Raw
History Blame Contribute Delete
987 Bytes
#!/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"