amul-ai-eval / scripts /setup_cerai.sh
bpHigh's picture
HF Space: add charts tab
74e6b83
Raw
History Blame Contribute Delete
2.06 kB
#!/usr/bin/env bash
# Set up the upstream CeRAI AIEvaluationTool repo for the CLI evaluation flow
# (no Docker, SQLite backend). Re-runnable.
#
# Usage: bash scripts/setup_cerai.sh
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
CERAI_DIR="$ROOT/AIEvaluationTool"
CERAI_REPO="https://github.com/cerai-iitm/AIEvaluationTool"
CERAI_REF="main"
if [ ! -d "$CERAI_DIR/.git" ]; then
echo "[setup] Cloning CeRAI..."
git clone "$CERAI_REPO" "$CERAI_DIR"
fi
cd "$CERAI_DIR"
git fetch --quiet origin "$CERAI_REF"
git checkout --quiet "$CERAI_REF"
# Apply our local patches if any (we keep them out of the upstream tree).
if [ -d "$ROOT/patches/cerai" ] && compgen -G "$ROOT/patches/cerai/*.patch" > /dev/null; then
echo "[setup] Applying patches from $ROOT/patches/cerai/..."
for patch in "$ROOT/patches/cerai"/*.patch; do
git apply --check "$patch" && git apply "$patch"
done
fi
# Drop a CLI-only config that uses SQLite + our amul proxy as the LOCAL provider.
cp "$ROOT/configs/cerai-config.json" "$CERAI_DIR/config.json"
# Configure the Interface Manager service to talk to our proxy as an API target.
cp "$ROOT/configs/interface-manager-config.json" "$CERAI_DIR/src/app/interface_manager/config.json"
# Stage our generated testcases/plan into CeRAI's data/ dir (paths in config
# are resolved relative to CeRAI's working directory).
cp "$ROOT/data/processed/amul_dairy_datapoints.json" "$CERAI_DIR/data/amul_dairy_datapoints.json"
cp "$ROOT/data/processed/amul_dairy_plan.json" "$CERAI_DIR/data/amul_dairy_plan.json"
# Drop an empty .env so CeRAI's strategy/.env loaders don't crash.
[ -f "$CERAI_DIR/.env" ] || cp "$CERAI_DIR/.env.example" "$CERAI_DIR/.env"
[ -f "$CERAI_DIR/src/lib/strategy/.env" ] || cp "$CERAI_DIR/src/lib/strategy/.env.example" "$CERAI_DIR/src/lib/strategy/.env"
# Install Python deps via the slim requirements file (skips mariadb/Selenium/GPU/Stanza).
echo "[setup] Installing CeRAI deps (slim subset)..."
"$ROOT/.venv/bin/pip" install --quiet -r "$ROOT/scripts/cerai_requirements_slim.txt"
echo "[setup] Done."