-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevaluate.sh
More file actions
35 lines (30 loc) · 1.21 KB
/
Copy pathevaluate.sh
File metadata and controls
35 lines (30 loc) · 1.21 KB
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
35
#!/usr/bin/env bash
# Evaluate a trained checkpoint across every sparse shell / gradient-count setting.
#
# `experiment.json` is written next to the checkpoint during training and is
# used to rebuild the exact model architecture, so no architecture flags need
# to be repeated here.
set -euo pipefail
# Training writes to <checkpoint_path>/spatialAttLiteStrong-mask-wb/<experiment_name>/,
# where the best checkpoint is named
# checkpoints/best_checkpoint_epoch_<epoch>_MSE_<val_metric>.pth
run_dir="./checkpoints/spatialAttLiteStrong-mask-wb/<experiment_name>"
checkpoint="$(ls -t "$run_dir"/checkpoints/best_checkpoint_epoch_*.pth 2>/dev/null | head -1)"
experiment_config="$run_dir/experiment.json"
data_path="./data/HCP100_compact"
output="./results/sparse_test.json"
if [[ -z "$checkpoint" ]]; then
echo "No best checkpoint found under $run_dir/checkpoints/" >&2
echo "Set run_dir at the top of this script to your experiment directory." >&2
exit 1
fi
python evaluation/evaluate_sparse.py \
--checkpoint "$checkpoint" \
--experiment_config "$experiment_config" \
--data_path "$data_path" \
--output "$output" \
--device cuda \
--batch_size 512 \
--num_workers 8 \
--amp 1 \
"$@"