fhyfhy's picture
Add code/
74b7543 verified
Raw History Blame Contribute Delete
1.82 kB
#!/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