-
Notifications
You must be signed in to change notification settings - Fork 3
/
add_reward.sh
68 lines (45 loc) · 1.69 KB
/
add_reward.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
#!/bin/bash
set -e
set -x
reward_dirs=(
"evluatation_results"
)
reward_mode=$1
force_replace=${2:-false}
if [ "$reward_mode" = "beaver" ]; then
for top_dir in "${reward_dirs[@]}"
do
find $top_dir -type f -name "*.jsonl" | while IFS= read -r file; do
python add_reward.py "path='$file'" reward_lm=beaver-7b only_prev_harms=[] "force_replace=$force_replace"
echo $file
done
done
elif [ "$reward_mode" = "harmbench" ]; then
for top_dir in "${reward_dirs[@]}"
do
find $top_dir -type f -name "*.jsonl" | while IFS= read -r file; do
python add_reward.py "path='$file'" reward_lm=harmbench-13b only_prev_harms=["beaver"] "force_replace=$force_replace" batch_size=64
echo $file
done
done
elif [ "$reward_mode" = "gpt4" ]; then
for top_dir in "${reward_dirs[@]}"
do
find $top_dir -type f -name "*.jsonl" | while IFS= read -r file; do
python add_reward.py "path='$file'" reward_lm=gpt4-0613 only_prev_harms=["beaver","harmbench"] "force_replace=$force_replace"
echo $file
done
done
elif [ "$reward_mode" = "sequence" ]; then
for top_dir in "${reward_dirs[@]}"
do
find $top_dir -type f -name "*.jsonl" | while IFS= read -r file; do
python add_reward.py "path='$file'" reward_lm=beaver-7b only_prev_harms=[] "force_replace=$force_replace"
python add_reward.py "path='$file'" reward_lm=harmbench-13b only_prev_harms=["beaver"] "force_replace=$force_replace" batch_size=64
# python add_reward.py "path='$file'" reward_lm=gpt4-0613 only_prev_harms=["beaver","harmbench"] "force_replace=$force_replace"
echo $file
done
done
else
echo "input is not beaver, harmbench, gpt4 or sequence"
fi