Skip to content

Commit d531662

Browse files
repro
1 parent 8df316a commit d531662

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/bin/bash
2+
#
3+
# Refit one walk-forward origin and compare predictions to saved test_preds.csv.
4+
# Use this on a GPU node for torch models (transformer_lf, etc.).
5+
#
6+
# Quick check (maize NL Transformer, origin 2020, eos v3):
7+
# sbatch --partition=gpu --gpus=1 cybench/runs/slurm/verify_reproduction.sh
8+
#
9+
# Interactive login node (RF only):
10+
# MODEL=random_forest FORCE_CPU=1 bash cybench/runs/slurm/verify_reproduction.sh
11+
#
12+
#SBATCH --job-name=cybench_repro
13+
#SBATCH --output=output/verify_reproduction/out_%j.txt
14+
#SBATCH --error=output/verify_reproduction/err_%j.txt
15+
#SBATCH --mem-per-cpu=4G
16+
#SBATCH --ntasks=1
17+
#SBATCH --cpus-per-task=8
18+
#SBATCH --time=02:00:00
19+
##SBATCH --partition=gpu
20+
##SBATCH --gpus=1
21+
22+
set -euo pipefail
23+
24+
if [[ -f "${SLURM_SUBMIT_DIR:-}/cybench/runs/slurm/slurm_common.sh" ]]; then
25+
export SLURM_DIR="${SLURM_SUBMIT_DIR}/cybench/runs/slurm"
26+
else
27+
export SLURM_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
28+
fi
29+
source "${SLURM_DIR}/slurm_common.sh"
30+
slurm_setup
31+
mkdir -p output/verify_reproduction
32+
33+
CROP="${CROP:-maize}"
34+
COUNTRY="${COUNTRY:-NL}"
35+
MODEL="${MODEL:-transformer_lf}"
36+
HORIZON="${PREDICTION_HORIZON:-eos}"
37+
ORIGINS="${ORIGINS:-2020}"
38+
SEED="${SEED:-42}"
39+
FORCE_CPU="${FORCE_CPU:-0}"
40+
CYBENCH_EXPERIMENT_NAME="${CYBENCH_EXPERIMENT_NAME:-baselines_NL_eos_v2}"
41+
42+
LUSTRE_ROOT="${CYBENCH_OUTPUT_ROOT:-/lustre/backup/SHARED/AIN/agml/output}"
43+
BASELINES_DIR="${CYBENCH_BASELINES_DIR:-${BASELINES_DIR}}"
44+
if [[ ! -d "${BASELINES_DIR}" && -d "${LUSTRE_ROOT}/${CYBENCH_EXPERIMENT_NAME}" ]]; then
45+
BASELINES_DIR="${LUSTRE_ROOT}/${CYBENCH_EXPERIMENT_NAME}"
46+
fi
47+
48+
extra=()
49+
if [[ "${FORCE_CPU}" == "1" ]]; then
50+
extra+=(--force-cpu)
51+
fi
52+
53+
echo "Verify reproduction | ${CROP}/${COUNTRY} | model=${MODEL} | horizon=${HORIZON}"
54+
echo " baselines=${BASELINES_DIR}"
55+
echo " origins=${ORIGINS} | seed=${SEED} | device=$(device_mode_label)"
56+
57+
poetry run python cybench/runs/analysis/verify_walk_forward_reproduction.py \
58+
--crop "${CROP}" \
59+
--country "${COUNTRY}" \
60+
--model "${MODEL}" \
61+
--horizon "${HORIZON}" \
62+
--seed "${SEED}" \
63+
--baselines-dir "${BASELINES_DIR}" \
64+
--origins "${ORIGINS}" \
65+
"${extra[@]}" \
66+
-v

0 commit comments

Comments
 (0)