#!/bin/bash
curdir=`dirname $0`
. $curdir/../../../../vars
source $CONDA_DIR/bin/activate
conda activate dataman

export CUDA_DEVICE_MAX_CONNECTIONS=1
export CUDA_VISIBLE_DEVICES=0

BEST_STEPS=($(python $CODE_DIR/sft/select_ckpt.py --json_file_path $CKPT_DIR/DataMan/sft/zh/all_rating/modelscale_models/Qwen2-1_5B-4k_bal_q3-zh/trainer_state.json))

# Valid Set
# for step in "${BEST_STEPS[@]}"; do
#     echo "Valid Set!" >> $CKPT_DIR/DataMan/sft/zh/all_rating/modelscale_models/Qwen2-1_5B-4k_bal_q3-zh.log
#     echo "Step: $step" >> $CKPT_DIR/DataMan/sft/zh/all_rating/modelscale_models/Qwen2-1_5B-4k_bal_q3-zh.log
#     python $CODE_DIR/sft/evaluate_qwen2.py --model_name_or_path $CKPT_DIR/DataMan/sft/zh/all_rating/modelscale_models/Qwen2-1_5B-4k_bal_q3-zh/checkpoint-$step \
#     --input_path $DATA_DIR/DataMan/Qwen-sft/Qwen2-zh/finetune_valid.jsonl \
#     --output_path $CKPT_DIR/DataMan/sft/zh/all_rating/modelscale_models/Qwen2-1_5B-4k_bal_q3-zh.log \
#     --max_tokens 29 --seed 1024 --model_type all_rating
# done

# Test Set
for step in 1000; do
    echo "Step: $step" >> $CKPT_DIR/DataMan/sft/zh/all_rating/modelscale_models/Qwen2-1_5B-4k_bal_q3-zh.log
    python $CODE_DIR/sft/evaluate_qwen2.py --model_name_or_path $CKPT_DIR/DataMan/sft/zh/all_rating/modelscale_models/Qwen2-1_5B-4k_bal_q3-zh/checkpoint-$step \
    --input_path $DATA_DIR/DataMan/Qwen-sft/Qwen2-zh/finetune_test.jsonl \
    --output_path $CKPT_DIR/DataMan/sft/zh/all_rating/modelscale_models/Qwen2-1_5B-4k_bal_q3-zh.log \
    --max_tokens 29 --seed 1024 --model_type all_rating
done