forked from allenai/open-instruct
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathfull_eval.sh
346 lines (287 loc) · 10.5 KB
/
full_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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
# --------------------------------------------------------------------------------
# Main Configuration
#---------------------------------------------------------------------------------
CUDA_VISIBLE_DEVICES=0
model_name_or_path=$1 # Model Path or Hugging Face name.
save_dir=$2 # Root directory to save results. Each task will be a subfolder where the respective results are stored. Caution: Ensure that the directory doesn't exist to avoid overwriting results.
chat_formatting_function=$3 # Optional. Options = [tulu, llama2, gemma]. If not provided, model will not use chat format.
eval_batch_size=10 # Batch Size to be used for evaluating.
run_eval=run_eval # Options = [run_eval, run_multi_turn_eval] Used for chat variants; Ignore for base model evaluations.
ntrains=(0) # Number of few-shot examples to be used for evaluation.
langs=(hi) # Languages to be evaluated.
if [ -z "$save_dir" ]; then
save_dir="results/" # Variable is Empty, Take default folder as results/
fi
if [ -z "$chat_formatting_function" ]; then
: # Do Nothing. Variable is Empty, No chat format will be used
else
chat_formatting_function="--use_chat_format --chat_formatting_function eval.templates.create_prompt_with_${chat_formatting_function}_chat_format"
fi
# --------------------------------------------------------------------------------
# Indic NLU
#---------------------------------------------------------------------------------
# IndicSentiment
for ntrain in ${ntrains[@]}; do
for lang in ${langs[@]}; do
echo "Evaluating ${ntrain}-shot IndicSentiment (${lang})..."
echo "Results will be stored at $save_dir/indicsentiment/$lang/$ntrain-shot/"
python3 -m eval.indicsentiment.$run_eval \
--ntrain $ntrain \
--save_dir "${save_dir}/indicsentiment/$lang/${ntrain}-shot/" \
--model_name_or_path $model_name_or_path \
--tokenizer_name_or_path $model_name_or_path \
--eval_batch_size $eval_batch_size \
--lang $lang \
$chat_formatting_function
done
done
# IndicCOPA
for ntrain in ${ntrains[@]}; do
for lang in ${langs[@]}; do
echo "Evaluating ${ntrain}-shot IndicCOPA (${lang})..."
echo "Results will be stored at $save_dir/indiccopa/$lang/$ntrain-shot/"
python3 -m eval.indiccopa.$run_eval \
--ntrain $ntrain \
--save_dir "${save_dir}/indiccopa/$lang/${ntrain}-shot/" \
--model_name_or_path $model_name_or_path \
--tokenizer_name_or_path $model_name_or_path \
--eval_batch_size $eval_batch_size \
--lang $lang \
$chat_formatting_function
done
done
# IndicXNLI
for ntrain in ${ntrains[@]}; do
for lang in ${langs[@]}; do
echo "Evaluating ${ntrain}-shot IndicXNLI (${lang})..."
echo "Results will be stored at $save_dir/indicxnli/$lang/$ntrain-shot/"
python3 -m eval.indicxnli.$run_eval \
--ntrain $ntrain \
--save_dir "${save_dir}/indicxnli/$lang/${ntrain}-shot/" \
--model_name_or_path $model_name_or_path \
--tokenizer_name_or_path $model_name_or_path \
--eval_batch_size $eval_batch_size \
--lang $lang \
$chat_formatting_function
done
done
# IndicXParaphrase
for ntrain in ${ntrains[@]}; do
for lang in ${langs[@]}; do
echo "Evaluating ${ntrain}-shot IndicXParaphrase (${lang})..."
echo "Results will be stored at $save_dir/indicxparaphrase/$lang/$ntrain-shot/"
python3 -m eval.indicxparaphrase.$run_eval \
--ntrain $ntrain \
--save_dir "${save_dir}/indicxparaphrase/$lang/${ntrain}-shot/" \
--model_name_or_path $model_name_or_path \
--tokenizer_name_or_path $model_name_or_path \
--eval_batch_size $eval_batch_size \
--lang $lang \
$chat_formatting_function
done
done
# --------------------------------------------------------------------------------
# English NLU
#---------------------------------------------------------------------------------
# MMLU
for ntrain in ${ntrains[@]}; do
for lang in ${langs[@]}; do
echo "Evaluating ${ntrain}-shot MMLU..."
echo "Results will be stored at $save_dir/mmlu/$lang/$ntrain-shot/"
python3 -m eval.mmlu.$run_eval \
--ntrain $ntrain \
--data_dir data/eval/mmlu \
--save_dir "${save_dir}/mmlu/$lang/${ntrain}-shot/" \
--model_name_or_path $model_name_or_path \
--tokenizer_name_or_path $model_name_or_path \
--eval_batch_size $eval_batch_size \
$chat_formatting_function
done
done
# BoolQ
for ntrain in ${ntrains[@]}; do
for lang in ${langs[@]}; do
echo "Evaluating ${ntrain}-shot BoolQ..."
echo "Results will be stored at $save_dir/boolq/$lang/$ntrain-shot/"
python3 -m eval.boolq.$run_eval \
--ntrain $ntrain \
--save_dir "${save_dir}/boolq/$lang/${ntrain}-shot/" \
--model_name_or_path $model_name_or_path \
--tokenizer_name_or_path $model_name_or_path \
--eval_batch_size $eval_batch_size \
$chat_formatting_function
done
done
# ARC-Easy
for ntrain in ${ntrains[@]}; do
for lang in ${langs[@]}; do
echo "Evaluating ${ntrain}-shot ARC-Easy..."
echo "Results will be stored at $save_dir/arc-easy/$lang/$ntrain-shot/"
python3 -m eval.arc.$run_eval \
--ntrain $ntrain \
--dataset "ai2_arc" \
--subset "easy" \
--save_dir "${save_dir}/arc-easy/$lang/${ntrain}-shot/" \
--model_name_or_path $model_name_or_path \
--tokenizer_name_or_path $model_name_or_path \
--eval_batch_size $eval_batch_size \
$chat_formatting_function
done
done
# ARC-Challenge
for ntrain in ${ntrains[@]}; do
for lang in ${langs[@]}; do
echo "Evaluating ${ntrain}-shot ARC-Challenge..."
echo "Results will be stored at $save_dir/arc-challenge/$lang/$ntrain-shot/"
python3 -m eval.arc.$run_eval \
--ntrain $ntrain \
--dataset "ai2_arc" \
--subset "challenge" \
--save_dir "${save_dir}/arc-challenge/$lang/${ntrain}-shot/" \
--model_name_or_path $model_name_or_path \
--tokenizer_name_or_path $model_name_or_path \
--eval_batch_size $eval_batch_size \
$chat_formatting_function
done
done
# Hellaswag
for ntrain in ${ntrains[@]}; do
for lang in ${langs[@]}; do
echo "Evaluating ${ntrain}-shot Hellaswag..."
echo "Results will be stored at $save_dir/hellaswag/$lang/$ntrain-shot/"
python3 -m eval.hellaswag.$run_eval \
--ntrain $ntrain \
--save_dir "${save_dir}/hellaswag/$lang/${ntrain}-shot/" \
--model_name_or_path $model_name_or_path \
--tokenizer_name_or_path $model_name_or_path \
--eval_batch_size $eval_batch_size \
$chat_formatting_function
done
done
# --------------------------------------------------------------------------------
# English to Indic MT
#---------------------------------------------------------------------------------
# FLORES
for ntrain in ${ntrains[@]}; do
for lang in ${langs[@]}; do
echo "Evaluating ${ntrain}-shot FLORES from en-$lang..."
echo "Results will be stored at $save_dir/flores/en-$lang/$ntrain-shot/"
python3 -m eval.flores.$run_eval \
--ntrain $ntrain \
--save_dir "${save_dir}/flores/en-$lang/${ntrain}-shot/" \
--src_lang en \
--tgt_lang $lang \
--model_name_or_path $model_name_or_path \
--tokenizer_name_or_path $model_name_or_path \
--eval_batch_size $eval_batch_size \
$chat_formatting_function
echo "Evaluating ${ntrain}-shot FLORES from $lang-en..."
echo "Results will be stored at $save_dir/flores/$lang-en/$ntrain-shot/"
python3 -m eval.flores.$run_eval \
--ntrain $ntrain \
--save_dir "$save_dir/flores/$lang-en/$ntrain-shot/" \
--src_lang $lang \
--tgt_lang en \
--model_name_or_path $model_name_or_path \
--tokenizer_name_or_path $model_name_or_path \
--eval_batch_size $eval_batch_size \
$chat_formatting_function
done
done
# IN22-Gen
for ntrain in ${ntrains[@]}; do
for lang in ${langs[@]}; do
echo "Evaluating ${ntrain}-shot FLORES from en-$lang..."
echo "Results will be stored at $save_dir/in22-gen/en-$lang/$ntrain-shot/"
python3 -m eval.in22.$run_eval \
--ntrain $ntrain \
--save_dir "$save_dir/in22-gen/en-$lang/$ntrain-shot/" \
--src_lang en \
--tgt_lang $lang \
--model_name_or_path $model_name_or_path \
--tokenizer_name_or_path $model_name_or_path \
--eval_batch_size $eval_batch_size \
$chat_formatting_function
echo "Evaluating ${ntrain}-shot FLORES from $lang-en..."
echo "Results will be stored at $save_dir/in22-gen/$lang-en/$ntrain-shot/"
python3 -m eval.in22.$run_eval \
--ntrain $ntrain \
--save_dir "$save_dir/in22-gen/$lang-en/$ntrain-shot/" \
--src_lang $lang \
--tgt_lang en \
--model_name_or_path $model_name_or_path \
--tokenizer_name_or_path $model_name_or_path \
--eval_batch_size $eval_batch_size \
$chat_formatting_function
done
done
eval_batch_size=64 # Batch Size to be used for evaluating.
# --------------------------------------------------------------------------------
# Indic NLG
#---------------------------------------------------------------------------------
# IndicQA no context
for ntrain in ${ntrains[@]}; do
for lang in ${langs[@]}; do
echo "Evaluating ${ntrain}-shot IndicQA with no context..."
echo "Results will be stored at ${save_dir}/indicqa/$lang/no-context/$ntrain-shot/"
python3 -m eval.indicqa.$run_eval \
--ntrain $ntrain \
--max_context_length 768 \
--no_context \
--save_dir "${save_dir}/indicqa/$lang/no-context/${ntrain}-shot/" \
--lang $lang \
--model_name_or_path $model_name_or_path \
--tokenizer_name_or_path $model_name_or_path \
--eval_batch_size $eval_batch_size \
$chat_formatting_function
done
done
# IndicQA with context
for ntrain in ${ntrains[@]}; do
for lang in ${langs[@]}; do
echo "Evaluating ${ntrain}-shot IndicQA with context..."
echo "Results will be stored at ${save_dir}/indicqa/$lang/with-context/$ntrain-shot/"
python3 -m eval.indicqa.$run_eval \
--ntrain $ntrain \
--max_context_length 768 \
--no_context \
--save_dir "${save_dir}/indicqa/$lang/with-context/${ntrain}-shot/" \
--lang $lang \
--model_name_or_path $model_name_or_path \
--tokenizer_name_or_path $model_name_or_path \
--eval_batch_size $eval_batch_size \
$chat_formatting_function
done
done
# Indic Headline
for ntrain in ${ntrains[@]}; do
for lang in ${langs[@]}; do
echo "Evaluating ${ntrain}-shot IndicHeadline..."
echo "Results will be stored at ${save_dir}/indicheadline/$lang/$ntrain-shot/"
python3 -m eval.indicheadline.$run_eval \
--ntrain $ntrain \
--max_context_length 512 \
--save_dir "${save_dir}/indicheadline/$lang/${ntrain}-shot/" \
--lang $lang \
--model_name_or_path $model_name_or_path \
--tokenizer_name_or_path $model_name_or_path \
--eval_batch_size $eval_batch_size \
$chat_formatting_function
done
done
# IndicWikiBio
for ntrain in ${ntrains[@]}; do
for lang in ${langs[@]}; do
echo "Evaluating ${ntrain}-shot IndicWikiBio..."
echo "Results will be stored at ${save_dir}/indicwikibio/$lang/$ntrain-shot/"
python3 -m eval.indicwikibio.$run_eval \
--ntrain $ntrain \
--max_context_length 512 \
--save_dir "${save_dir}/indicwikibio/$lang/${ntrain}-shot/" \
--lang $lang \
--model_name_or_path $model_name_or_path \
--tokenizer_name_or_path $model_name_or_path \
--eval_batch_size $eval_batch_size \
$chat_formatting_function
done
done