-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.sh
91 lines (78 loc) · 2.54 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
#!/bin/bash
echo "Starting script"
# Array of prompting methods
variants=(
# 'linda_original'
# 'linda_variant_one_because'
# 'linda_variant_one_sothat'
# 'linda_variant_one_to'
# 'linda_variant_two_because'
# 'linda_variant_two_sothat'
# 'linda_variant_two_to'
# 'linda_variant_three'
# 'linda_variant_four'
'sets_original'
# 'sets_original_framing'
)
llms=(
# 'gpt-3.5-turbo'
# 'gpt-4-turbo'
# 'gpt-4o'
# 'gemini-1.0-pro-002'
# 'gemini-1.5-pro-preview-0409'
# 'llama3-70b'
'llama3-8b'
# 'llama-2-70b-chat'
# 'claude-3-opus-20240229'
# 'claude-3-sonnet-20240229'
# 'mistral-large-latest'
)
prompt=(
# 'baseline'
# 'zs_cot'
# 'os'
# 'os_cot'
# 'os_bob'
# 'os_bob_cot'
# 'os_incorrect'
# 'os_incorrect_cot'
# 'fs'
# 'fs_cot'
# 'fs_no_linda'
# 'fs_no_linda_cot'
# 'weak_control_zs_cot'
'weak_control_os_cot'
# 'control_zs_cot'
'control_os_cot'
)
group=(
'gold'
# 'random'
)
gpus=(5, 6)
# Setup a trap to handle SIGINT and SIGTERM
trap 'echo "Terminating all processes..."; kill $(jobs -p); exit' SIGINT SIGTERM
# Loop through the array and run each configuration on a different GPU in the background
for l in "${!llms[@]}"; do
for i in "${!variants[@]}"; do
for j in "${!prompt[@]}"; do
# Check if it's one of the last two variants and if the prompt is one of the four to skip
# if [[ $i -ge $((${#variants[@]} - 2)) ]] && [[ "${prompt[$j]}" == "os_bob" || "${prompt[$j]}" == "os_bob_cot" || "${prompt[$j]}" == "fs_no_linda" || "${prompt[$j]}" == "fs_no_linda_cot" ]]; then
# continue # Skip the unwanted prompts for the last two variants
# fi
for k in "${!group[@]}"; do
gpu_id=${gpus[$((j % 4))]} # Calculate GPU ID based on prompt index
fallacy="sets" # Default fallacy setting
# if [[ $i -ge $((${#variants[@]} - 2)) ]]; then
# fallacy="sets"
# fi
# Execute the task on the chosen GPU
CUDA_VISIBLE_DEVICES="$gpu_id" python3 main.py --model "${llms[$l]}" --fallacy "$fallacy" --task inference --eval_mode "${prompt[$j]}" --data_file synthetic_dataset_"${variants[$i]}"_"${group[$k]}".json &
done
done
# wait # Wait for all background jobs to finish before moving on to the next variant
done
wait # Wait for all llm jobs to finish
done
wait # Ensure all background jobs have finished before the script exits
echo "Finishing script"