-
Notifications
You must be signed in to change notification settings - Fork 3
/
eval.sh
executable file
·65 lines (53 loc) · 2.4 KB
/
eval.sh
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
60
61
62
63
64
65
#!/bin/bash
CONFIG="./config.sh"
[[ ! -f "${CONFIG}" ]] && echo "${CONFIG} not found: Create ${CONFIG} from config.example.sh with your configurations." && exit 1
# Import configurations and export for script.
set -a
source ${CONFIG}
set +a
[[ -z "$EVAL_VENV" ]] && echo "EVAL_VENV not set in config.sh" && exit 1
[[ -z "$HF_LOGIN" ]] && echo "HF_LOGIN not set in config.sh" && exit 1
source $EVAL_VENV/bin/activate
DATA_DIR=<path to data>
RESULTS_DIR=<path to all translations>
MODELS=<list of models>
declare -A MODEL_CKPS=(
<model name>=<list of checkpoints>
)
DATASETS=(flores wmt law medical tico chat_wmt)
declare -A DATASETS_LPS=(
["flores"]="de-en en-de fr-en en-fr nl-en en-nl pt-en en-pt ru-en en-ru zh-en en-zh"
["wmt"]="de-en en-de ru-en en-ru zh-en en-zh"
["law"]="de-en en-de"
["medical"]="de-en en-de"
["tico"]="en-fr en-pt"
["chat_wmt"]="en-de en-fr en-pt"
)
for MODEL in "${MODELS[@]}"; do
for DATASET in "${DATASETS[@]}"; do
LPS="${DATASETS_LPS[$DATASET]}"
for LP in $LPS; do
CKPTS="${MODEL_CKPS[$MODEL]}"
for CKPT in $CKPTS; do
echo "Evaluating $MODEL/$DATASET/$LP/$CKPT"
SOURCES_PATH=$DATA_DIR/$DATASET/$LP/train_eval.input.txt
REFERENCES_PATH=$DATA_DIR/$DATASET/$LP/train_eval.output.txt
CKPT_DIR=$RESULTS_DIR/$MODEL/$DATASET/$LP/$CKPT
ZERO_SHOT_INSTRUCTIONS_DIR=$CKPT_DIR/zero_shot_instructions
FEW_SHOT_INSTRUCTIONS_DIR=$CKPT_DIR/few_shot_instructions2
python translation_llm/eval.py \
--sources_path $SOURCES_PATH \
--translations_path $ZERO_SHOT_INSTRUCTIONS_DIR/translations.txt \
--references_path $REFERENCES_PATH \
--sys_scores_path $ZERO_SHOT_INSTRUCTIONS_DIR/sys_scores.txt \
--seg_scores_path $ZERO_SHOT_INSTRUCTIONS_DIR/seg_scores.txt
python translation_llm/eval.py \
--sources_path $SOURCES_PATH \
--translations_path $FEW_SHOT_INSTRUCTIONS_DIR/translations.txt \
--references_path $REFERENCES_PATH \
--sys_scores_path $FEW_SHOT_INSTRUCTIONS_DIR/sys_scores.txt \
--seg_scores_path $FEW_SHOT_INSTRUCTIONS_DIR/seg_scores.txt
done
done
done
done