-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
586 lines (559 loc) · 19.9 KB
/
run.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
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
NAMES=(
llama-3-70b
llama-3-8b
llama-2-70b
llama-2-13b
llama-2-7b
tulu-2-dpo-70b
tulu-2-70b
tulu-2-dpo-13b
tulu-2-13b
tulu-2-dpo-7b
tulu-2-7b
mistral-7b-v0.1
mistral-7b-v0.2
mixtral-8x7b
yi-1.5-34b
yi-1.5-9b
qwen-1.5-72b
qwen-1.5-32b
qwen-2-72b
command-r-plus
command-r-v01
gemma-7b
gemma-2b
mistral-7b-v0.3
phi-3-small
glm-4-9b
gemma-2-9b
gemma-2-27b
llama-3.1-70b
llama-3.1-8b
qwen-2.5-72b
) # model name
CKPTS=(
meta-llama/Meta-Llama-3-70B-Instruct
meta-llama/Meta-Llama-3-8B-Instruct
meta-llama/Llama-2-70b-chat-hf
meta-llama/Llama-2-13b-chat-hf
meta-llama/Llama-2-7b-chat-hf
allenai/tulu-2-dpo-70b
allenai/tulu-2-70b
allenai/tulu-2-dpo-13b
allenai/tulu-2-13b
allenai/tulu-2-dpo-7b
allenai/tulu-2-7b
mistralai/Mistral-7B-Instruct-v0.1
mistralai/Mistral-7B-Instruct-v0.2
mistralai/Mixtral-8x7B-Instruct-v0.1
01-ai/Yi-1.5-34B-Chat
01-ai/Yi-1.5-9B-Chat
Qwen/Qwen1.5-72B-Chat
Qwen/Qwen1.5-32B-Chat
Qwen/Qwen2-72B-Instruct
CohereForAI/c4ai-command-r-plus
CohereForAI/c4ai-command-r-v01
google/gemma-7b-it
google/gemma-2b-it
mistralai/Mistral-7B-Instruct-v0.3
microsoft/Phi-3-small-8k-instruct
THUDM/glm-4-9b-chat
google/gemma-2-9b-it
google/gemma-2-27b-it
meta-llama/Meta-Llama-3.1-70B-Instruct
meta-llama/Meta-Llama-3.1-8B-Instruct
Qwen/Qwen2.5-72B-Instruct
) # model checkpoint
CLSS=(
llama3vllm
llama3vllm
llama2vllm
llama2vllm
llama2vllm
tulu2vllm
tulu2vllm
tulu2vllm
tulu2vllm
tulu2vllm
tulu2vllm
mistralvllm
mistralvllm
mistralvllm
hfvllm
hfvllm
hfvllm
hfvllm
hfvllm
coherevllm
coherevllm
gemmavllm
gemmavllm
mistralvllm
hfnosysvllm
glmvllm
gemmavllm
gemmavllm
llama3.1vllm
llama3.1vllm
hfvllm
) # model class
CONFIGS=(
base
cot
metric
reference
metric-reference
swap_and_synthesize
fine_grained
fine_grained_llama2
multi-role-round1
multi-role-round2
multi-role-round2-llama2
multi-aspect-single
multi-aspect-single-llama2
multi-aspect-two
multi-aspect-two-llama2
gpt4-reference
prepair
self-consistency
protocol-consistency
)
CONFIG_DIRS=(
configs/default/pairwise_base
configs/default/pairwise_cot
configs/default/pairwise_metric
configs/default/pairwise_reference
configs/default/pairwise_metric_reference
configs/default/pairwise_synthesize
configs/default/pairwise_cot_finegrained
configs/default/pairwise_cot_finegrained_llama2
configs/default/pairwise_chateval_round_1
configs/default/pairwise_chateval_round_2
configs/default/pairwise_chateval_round_2_llama2
configs/default/pairwise_analysis_aggr_single_stage
configs/default/pairwise_analysis_aggr_single_stage_llama2
configs/default/pairwise_analysis_aggr
configs/default/pairwise_analysis_aggr_llama2
configs/default/pairwise_reference_gpt4
configs/default/pairwise_prepair
configs/default/sc/pairwise_cot_sc
configs/default/sc/pairwise_protocol_consistency
) # config dir
ALL_SELECTED_MODELS=(
llama-3-70b
llama-3-8b
llama-2-70b
llama-2-13b
llama-2-7b
tulu-2-dpo-70b
tulu-2-70b
tulu-2-dpo-13b
tulu-2-13b
tulu-2-dpo-7b
tulu-2-7b
# mistral-7b-v0.1
# mistral-7b-v0.2
mixtral-8x7b
yi-1.5-34b
yi-1.5-9b
qwen-1.5-72b
qwen-1.5-32b
qwen-2-72b
# command-r-plus
# command-r-v01
gemma-7b
gemma-2b
mistral-7b-v0.3
# phi-3-small
glm-4-9b
# gemma-2-9b
# gemma-2-27b
llama-3.1-70b
llama-3.1-8b
qwen-2.5-72b
) # 24 base LLMs selected, llama-3.1-405b would require more than 8 GPUs
ALL_SELECTED_CONFIGS=(
base
cot
metric
reference
metric-reference
swap_and_synthesize
fine_grained
fine_grained_llama2
multi-role-round1
multi-role-round2
multi-role-round2-llama2
multi-aspect-single
multi-aspect-single-llama2
multi-aspect-two
multi-aspect-two-llama2
gpt4-reference
prepair
self-consistency
protocol-consistency
) # all configs for 15 evaluation protocols
GPU_IDS=0,1,2,3,4,5,6,7 # Change this to the GPU ids you want to use
NUM_GPUS=8 # Change this to the number of GPUs you want to use
PROTOCOL_FIRST=true
# Get results for LLMs that support >4K context length
SELECTED_MODELS=(
llama-3-70b
llama-3-8b
tulu-2-dpo-70b
tulu-2-70b
tulu-2-dpo-13b
tulu-2-13b
tulu-2-dpo-7b
tulu-2-7b
mixtral-8x7b
qwen-1.5-72b
qwen-1.5-32b
qwen-2-72b
gemma-7b
gemma-2b
mistral-7b-v0.3
glm-4-9b
llama-3.1-70b
llama-3.1-8b
qwen-2.5-72b
)
SELECTED_CONFIGS=(
base
cot
metric
reference
metric-reference
swap_and_synthesize
fine_grained
multi-role-round1
multi-role-round2
multi-aspect-single
multi-aspect-two
gpt4-reference
prepair
self-consistency
)
echo number of GPUs $NUM_GPUS
echo number of ckpts ${#CKPTS[@]}
echo number of configs ${#CONFIGS[@]}
echo number of models ${#NAMES[@]}
echo number of clss ${#CLSS[@]}
echo number of selected models ${#SELECTED_MODELS[@]}
echo number of selected configs ${#SELECTED_CONFIGS[@]}
echo number of config dirs ${#CONFIG_DIRS[@]}
if [[ "${PROTOCOL_FIRST}" == "false" ]]; then
# finishing the models first
for model in "${SELECTED_MODELS[@]}"; do
for i in "${!NAMES[@]}"; do
if [[ "${NAMES[i]}" == "$model" ]]; then
for config in "${SELECTED_CONFIGS[@]}"; do
for j in "${!CONFIGS[@]}"; do
if [[ "${CONFIGS[j]}" == "${config}" ]]; then
# run the forward pass
forward_config=${CONFIG_DIRS[$j]}.yaml
echo ${config} $forward_config ${NAMES[$i]} ${CKPTS[$i]} ${CLSS[$i]}
RAY_memory_monitor_refresh_ms=0 CUDA_VISIBLE_DEVICES=${GPU_IDS} python run.py \
--model_pt ${CKPTS[$i]} \
--model_name ${NAMES[$i]} \
--model_cls ${CLSS[$i]} \
--tensor_parallel_size $NUM_GPUS \
--gpu_memory_utilization 0.9 \
--batch_size 8 \
--swap_space 8 \
--download_dir $HOME/.cache/huggingface/hub \
--verbose \
--resume \
--config_dir $forward_config \
--use_cache \
--datasets llmbar_natural llmbar_adversarial mtbench instrusum
# run the swap pass
backward_config=${CONFIG_DIRS[$j]}_swap.yaml
echo ${config}_swap $backward_config ${NAMES[$i]} ${CKPTS[$i]} ${CLSS[$i]}
RAY_memory_monitor_refresh_ms=0 CUDA_VISIBLE_DEVICES=${GPU_IDS} python run.py \
--model_pt ${CKPTS[$i]} \
--model_name ${NAMES[$i]} \
--model_cls ${CLSS[$i]} \
--tensor_parallel_size $NUM_GPUS \
--gpu_memory_utilization 0.9 \
--batch_size 8 \
--swap_space 8 \
--download_dir $HOME/.cache/huggingface/hub \
--verbose \
--resume \
--config_dir $backward_config \
--use_cache \
--datasets llmbar_natural llmbar_adversarial mtbench instrusum
break
fi
done
done
break
fi
done
done
else
# finishing the configs first
for config in "${SELECTED_CONFIGS[@]}"; do
for j in "${!CONFIGS[@]}"; do
if [[ "${CONFIGS[j]}" == "${config}" ]]; then
for model in "${SELECTED_MODELS[@]}"; do
for i in "${!NAMES[@]}"; do
if [[ "${NAMES[i]}" == "$model" ]]; then
# run the forward pass
forward_config=${CONFIG_DIRS[$j]}.yaml
echo ${config} $forward_config ${NAMES[$i]} ${CKPTS[$i]} ${CLSS[$i]}
RAY_memory_monitor_refresh_ms=0 CUDA_VISIBLE_DEVICES=${GPU_IDS} python run.py \
--model_pt ${CKPTS[$i]} \
--model_name ${NAMES[$i]} \
--model_cls ${CLSS[$i]} \
--tensor_parallel_size $NUM_GPUS \
--gpu_memory_utilization 0.9 \
--batch_size 8 \
--swap_space 8 \
--download_dir $HOME/.cache/huggingface/hub \
--verbose \
--resume \
--config_dir $forward_config \
--use_cache \
--datasets llmbar_natural llmbar_adversarial mtbench instrusum
# run the swap pass
backward_config=${CONFIG_DIRS[$j]}_swap.yaml
echo ${config}_swap $backward_config ${NAMES[$i]} ${CKPTS[$i]} ${CLSS[$i]}
RAY_memory_monitor_refresh_ms=0 CUDA_VISIBLE_DEVICES=${GPU_IDS} python run.py \
--model_pt ${CKPTS[$i]} \
--model_name ${NAMES[$i]} \
--model_cls ${CLSS[$i]} \
--tensor_parallel_size $NUM_GPUS \
--gpu_memory_utilization 0.9 \
--batch_size 8 \
--swap_space 8 \
--download_dir $HOME/.cache/huggingface/hub \
--verbose \
--resume \
--config_dir $backward_config \
--use_cache \
--datasets llmbar_natural llmbar_adversarial mtbench instrusum
break
fi
done
done
break
fi
done
done
fi
# Get results for LLMs that support 4K context length
SELECTED_MODELS=(
llama-2-70b
llama-2-13b
llama-2-7b
yi-1.5-34b
yi-1.5-9b
)
SELECTED_CONFIGS=(
base
cot
metric
reference
metric-reference
swap_and_synthesize
fine_grained_llama2
multi-role-round1
multi-role-round2-llama2
multi-aspect-single-llama2
multi-aspect-two-llama2
gpt4-reference
prepair
self-consistency
protocol-consistency
)
echo number of GPUs $NUM_GPUS
echo number of ckpts ${#CKPTS[@]}
echo number of configs ${#CONFIGS[@]}
echo number of models ${#NAMES[@]}
echo number of clss ${#CLSS[@]}
echo number of selected models ${#SELECTED_MODELS[@]}
echo number of selected configs ${#SELECTED_CONFIGS[@]}
echo number of config dirs ${#CONFIG_DIRS[@]}
if [[ "${PROTOCOL_FIRST}" == "false" ]]; then
# finishing the models first
for model in "${SELECTED_MODELS[@]}"; do
for i in "${!NAMES[@]}"; do
if [[ "${NAMES[i]}" == "$model" ]]; then
for config in "${SELECTED_CONFIGS[@]}"; do
for j in "${!CONFIGS[@]}"; do
if [[ "${CONFIGS[j]}" == "${config}" ]]; then
# run the forward pass
forward_config=${CONFIG_DIRS[$j]}.yaml
echo ${config} $forward_config ${NAMES[$i]} ${CKPTS[$i]} ${CLSS[$i]}
RAY_memory_monitor_refresh_ms=0 CUDA_VISIBLE_DEVICES=${GPU_IDS} python run.py \
--model_pt ${CKPTS[$i]} \
--model_name ${NAMES[$i]} \
--model_cls ${CLSS[$i]} \
--tensor_parallel_size $NUM_GPUS \
--gpu_memory_utilization 0.9 \
--batch_size 8 \
--swap_space 8 \
--download_dir $HOME/.cache/huggingface/hub \
--verbose \
--resume \
--config_dir $forward_config \
--use_cache \
--datasets llmbar_natural llmbar_adversarial mtbench instrusum
# run the swap pass
backward_config=${CONFIG_DIRS[$j]}_swap.yaml
echo ${config}_swap $backward_config ${NAMES[$i]} ${CKPTS[$i]} ${CLSS[$i]}
RAY_memory_monitor_refresh_ms=0 CUDA_VISIBLE_DEVICES=${GPU_IDS} python run.py \
--model_pt ${CKPTS[$i]} \
--model_name ${NAMES[$i]} \
--model_cls ${CLSS[$i]} \
--tensor_parallel_size $NUM_GPUS \
--gpu_memory_utilization 0.9 \
--batch_size 8 \
--swap_space 8 \
--download_dir $HOME/.cache/huggingface/hub \
--verbose \
--resume \
--config_dir $backward_config \
--use_cache \
--datasets llmbar_natural llmbar_adversarial mtbench instrusum
break
fi
done
done
break
fi
done
done
else
# finishing the configs first
for config in "${SELECTED_CONFIGS[@]}"; do
for j in "${!CONFIGS[@]}"; do
if [[ "${CONFIGS[j]}" == "${config}" ]]; then
for model in "${SELECTED_MODELS[@]}"; do
for i in "${!NAMES[@]}"; do
if [[ "${NAMES[i]}" == "$model" ]]; then
# run the forward pass
forward_config=${CONFIG_DIRS[$j]}.yaml
echo ${config} $forward_config ${NAMES[$i]} ${CKPTS[$i]} ${CLSS[$i]}
RAY_memory_monitor_refresh_ms=0 CUDA_VISIBLE_DEVICES=${GPU_IDS} python run.py \
--model_pt ${CKPTS[$i]} \
--model_name ${NAMES[$i]} \
--model_cls ${CLSS[$i]} \
--tensor_parallel_size $NUM_GPUS \
--gpu_memory_utilization 0.9 \
--batch_size 8 \
--swap_space 8 \
--download_dir $HOME/.cache/huggingface/hub \
--verbose \
--resume \
--config_dir $forward_config \
--use_cache \
--datasets llmbar_natural llmbar_adversarial mtbench instrusum
# run the swap pass
backward_config=${CONFIG_DIRS[$j]}_swap.yaml
echo ${config}_swap $backward_config ${NAMES[$i]} ${CKPTS[$i]} ${CLSS[$i]}
RAY_memory_monitor_refresh_ms=0 CUDA_VISIBLE_DEVICES=${GPU_IDS} python run.py \
--model_pt ${CKPTS[$i]} \
--model_name ${NAMES[$i]} \
--model_cls ${CLSS[$i]} \
--tensor_parallel_size $NUM_GPUS \
--gpu_memory_utilization 0.9 \
--batch_size 8 \
--swap_space 8 \
--download_dir $HOME/.cache/huggingface/hub \
--verbose \
--resume \
--config_dir $backward_config \
--use_cache \
--datasets llmbar_natural llmbar_adversarial mtbench instrusum
break
fi
done
done
break
fi
done
done
fi
# Run protocol-consistency, which only needs to vote on the previous results
SELECTED_MODELS=(
llama-3-70b
llama-3-8b
llama-2-70b
llama-2-13b
llama-2-7b
tulu-2-dpo-70b
tulu-2-70b
tulu-2-dpo-13b
tulu-2-13b
tulu-2-dpo-7b
tulu-2-7b
mixtral-8x7b
yi-1.5-34b
yi-1.5-9b
qwen-1.5-72b
qwen-1.5-32b
qwen-2-72b
gemma-7b
gemma-2b
mistral-7b-v0.3
glm-4-9b
llama-3.1-70b
llama-3.1-8b
qwen-2.5-72b
)
SELECTED_CONFIGS=(
protocol-consistency
)
for config in "${SELECTED_CONFIGS[@]}"; do
for j in "${!CONFIGS[@]}"; do
if [[ "${CONFIGS[j]}" == "${config}" ]]; then
for model in "${SELECTED_MODELS[@]}"; do
for i in "${!NAMES[@]}"; do
if [[ "${NAMES[i]}" == "$model" ]]; then
# run the forward pass
forward_config=${CONFIG_DIRS[$j]}.yaml
echo ${config} $forward_config ${NAMES[$i]} ${CKPTS[$i]} ${CLSS[$i]}
RAY_memory_monitor_refresh_ms=0 CUDA_VISIBLE_DEVICES=${GPU_IDS} python run.py \
--model_pt ${CKPTS[$i]} \
--model_name ${NAMES[$i]} \
--model_cls ${CLSS[$i]} \
--tensor_parallel_size $NUM_GPUS \
--gpu_memory_utilization 0.9 \
--batch_size 8 \
--swap_space 8 \
--download_dir $HOME/.cache/huggingface/hub \
--verbose \
--resume \
--config_dir $forward_config \
--use_cache \
--datasets llmbar_natural llmbar_adversarial mtbench instrusum \
--no_model
# run the swap pass
backward_config=${CONFIG_DIRS[$j]}_swap.yaml
echo ${config}_swap $backward_config ${NAMES[$i]} ${CKPTS[$i]} ${CLSS[$i]}
RAY_memory_monitor_refresh_ms=0 CUDA_VISIBLE_DEVICES=${GPU_IDS} python run.py \
--model_pt ${CKPTS[$i]} \
--model_name ${NAMES[$i]} \
--model_cls ${CLSS[$i]} \
--tensor_parallel_size $NUM_GPUS \
--gpu_memory_utilization 0.9 \
--batch_size 8 \
--swap_space 8 \
--download_dir $HOME/.cache/huggingface/hub \
--verbose \
--resume \
--config_dir $backward_config \
--use_cache \
--datasets llmbar_natural llmbar_adversarial mtbench instrusum \
--no_model
break
fi
done
done
break
fi
done
done