-
Notifications
You must be signed in to change notification settings - Fork 0
/
pipeline_api.sh
executable file
·119 lines (77 loc) · 3.23 KB
/
pipeline_api.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
#!/bin/bash
pip install openai
# paths/Freshbench_release/
# base_path="./"
base_path=$(pwd)"/"
echo $base_path
current_gjo_file_path="${base_path}test/raw_question/gjo_transformed_questions_no_output.jsonl"
gjo_raw_crawl_file_path="${base_path}GoodJudgeOpen_crawler/gjo.json"
# python update_from_crawl.py \
# --gjo_raw_crawl_file_path "$gjo_raw_crawl_file_path" \
# --current_gjo_file_path "$current_gjo_file_path"
today=$(date +%Y%m%d)
today="20241011"
declare -A model_to_log=(
# openrouter api
# ["deepseek/deepseek-chat"]="DeepSeek-V2-Chat"
# ["mistralai/mixtral-8x22b-instruct"]="Mixtral-8x22B-Instruct-v0.1"
# ["qwen/qwen-110b-chat"]="Qwen1.5-110b-chat"
# ["cohere/command-r-plus"]="command-r-plus"
["qwen/qwen-2-72b-instruct"]="Qwen2-72b-Instruct"
# ['01-ai/yi-large']="Yi-large"
['meta-llama/llama-3.1-405b-instruct']="llama-3.1-405b-instruct"
['google/gemini-pro']='Gemini'
# ["gpt-3.5-turbo-0613"]="gpt_3.5_turbo_0613"
# ["gpt-4-0613"]="gpt4_0613"
# ["gpt-4-1106-preview"]="gpt4_1106"
# ['gemini-1.5-pro']="Gemini-1.5-Pro"
# ['gemini-1.5-pro-flash']="Gemini-1.5-Pro-flash"
# ['claude-3-5-sonnet-20240620']="Claude-3.5-Sonnet-20240620"
# ['gpt-4o']="GPT-4o"
# ['gpt-4o-mini-2024-07-18']="GPT-4o-mini-2024-07-18"
# ['gemini-1.5-flash']='Gemini-1.5-flash'
# ['claclaude-3-haiku-20240307']="Claude-3-haiku-20240307"
# ['claude-3-opus-20240229']='Claude-3-opus-20240229'
# ['claude-3-sonnet-20240229']='Claude-3-sonnet-20240229'
)
cd $base_path/script
for model in "${!model_to_log[@]}"; do
log_file=${model_to_log[$model]}
echo "
Running model: $model
"
csv_lines=$(cat "${base_path}/answer_csv/gjo_${log_file}.csv" | wc -l)
current_gjo_lines=$(cat "$current_gjo_file_path" | wc -l)
echo "csv_lines: $csv_lines, current_gjo_lines: $current_gjo_lines"
if [ "$csv_lines" -eq "$((current_gjo_lines + 1))" ]; then
echo "Already finished $model"
continue
fi
delta_lines=$((current_gjo_lines - csv_lines+1))
echo "delta_lines: $delta_lines"
# Execute the command, append output to a log file
echo "time python gjo_gpt.py \
--input_path $current_gjo_file_path \
--output_path ${base_path}test/${today}/gjo_gpt_answer \
--model $model \
--time_out 300 \
--processes_num 3 \
--test_num $delta_lines \
--input_is_folder 0 >> ${base_path}logs/${log_file}.log"
echo "calling model api..."
time python gjo_gpt.py \
--input_path "$current_gjo_file_path" \
--output_path "${base_path}test/${today}/gjo_gpt_answer" \
--model "${model}" \
--time_out 300 \
--processes_num 3 \
--test_num "$delta_lines" \
--input_is_folder 0 >> "${base_path}logs/${log_file}.log"
# delta_lines=2535
echo "python gjo_judge.py --ModelName ${log_file} \
--json_path ${base_path}test/${today}/gjo_gpt_answer/${model}/response/gjo_with_output.json \
--output_path ${base_path}answer_csv"
python gjo_judge.py --ModelName ${log_file} \
--json_path ${base_path}test/${today}/gjo_gpt_answer/${model}/response/gjo_with_output.json \
--output_path ${base_path}answer_csv
done