File size: 1,816 Bytes
74b7543
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash

# =================================================================================================
# Evaluation Configuration
# =================================================================================================

# --- Paths ---
# Path to the trained model (checkpoint directory or HuggingFace model ID)
# Example: archives/online_test_v1/checkpoint-500
MODEL_PATH="/data/zixuan/phd/power_law_gsm/multi-hop_synthetic/archives/E20_R20_k4_D20_uniform/grid_v1_E20_R20_k4_D20"

# Path to the test data JSON file
# If set to "AUTO", it will look for eval_test.json in the MODEL_PATH
DATA_PATH="AUTO"

# --- Evaluation Parameters ---
# Whether to evaluate all checkpoints in the MODEL_PATH
EVAL_ALL=true
# Batch size for evaluation
BATCH_SIZE=64

# =================================================================================================
# Implementation
# =================================================================================================

# Handle AUTO data path
if [ "$DATA_PATH" = "AUTO" ]; then
    DATA_PATH="${MODEL_PATH}/eval_test.json"
fi

echo "Evaluating model(s) in: $MODEL_PATH"
echo "On data: $DATA_PATH"

if [ ! -d "$MODEL_PATH" ]; then
    echo "Error: Model path '$MODEL_PATH' does not exist."
    exit 1
fi

if [ ! -f "$DATA_PATH" ]; then
    echo "Error: Data file '$DATA_PATH' does not exist."
    exit 1
fi

if [ "$EVAL_ALL" = "true" ]; then
    echo "Running evaluation on all checkpoints..."
    python3 eval_all_ckpts.py \
        --model_dir "$MODEL_PATH" \
        --data_path "$DATA_PATH" \
        --batch_size $BATCH_SIZE \
        --include_base
else
    echo "Running evaluation on single model path..."
    python3 evaluate.py \
        --model_path "$MODEL_PATH" \
        --data_path "$DATA_PATH" \
        --batch_size $BATCH_SIZE
fi