-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate_configs.py
196 lines (181 loc) · 8.03 KB
/
generate_configs.py
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
import json
import os.path
# ['biology','earth_science','economics','psychology','robotics','stackoverflow','sustainable_living','leetcode','pony','aops','theoremqa']
for model in ['sf','qwen','e5']:
if not os.path.isdir(f"configs/{model}"):
os.makedirs(f"configs/{model}")
for task in ['biology','earth_science','economics','psychology','robotics','stackoverflow','sustainable_living']:
instructions = {
'instructions': {
'query': 'Instruct: Given a {task} post, retrieve relevant passages that help answer the post\nQuery: '
},
'instructions_long': {
'query': 'Instruct: Given a {task} post, retrieve relevant documents that help answer the post\nQuery: '
},
}
with open(f"configs/{model}/{task}.json",'w') as f:
json.dump(instructions,f,indent=2)
instructions = {
'instructions': {
'query': 'Instruct: Given a {task} question, retrieve relevant passages that help answer the question\nQuery: '
},
'instructions_long': {
'query': 'Instruct: Given a {task} question, retrieve relevant documents that help answer the question\nQuery: '
},
}
with open(f"configs/{model}/pony.json", 'w') as f:
json.dump(instructions, f, indent=2)
instructions = {
'instructions': {
'query': 'Instruct: Given a coding problem, retrieve relevant examples that help answer the problem\nQuery: '
},
}
with open(f"configs/{model}/leetcode.json", 'w') as f:
json.dump(instructions, f, indent=2)
for task in ['aops','theoremqa']:
instructions = {
'instructions': {
'query': 'Instruct: Given a Math problem, retrieve relevant examples that help answer the problem\nQuery: '
},
}
with open(f"configs/{model}/{task}.json",'w') as f:
json.dump(instructions,f,indent=2)
for model in ['grit']:
if not os.path.isdir(f"configs/{model}"):
os.makedirs(f"configs/{model}")
for task in ['biology','earth_science','economics','psychology','robotics','stackoverflow','sustainable_living']:
instructions = {
'instructions': {
'query': '<|user|>\nGiven a {task} post, retrieve relevant passages that help answer the post\n<|embed|>\n',
'document': "<|embed|>\n"
},
'instructions_long': {
'query': '<|user|>\nGiven a {task} post, retrieve relevant documents that help answer the post\n<|embed|>\n',
'document': "<|embed|>\n"
},
}
with open(f"configs/{model}/{task}.json",'w') as f:
json.dump(instructions,f,indent=2)
instructions = {
'instructions': {
'query': '<|user|>\nGiven a {task} question, retrieve relevant passages that help answer the question\n<|embed|>\n',
'document': "<|embed|>\n"
},
'instructions_long': {
'query': '<|user|>\nGiven a {task} question, retrieve relevant documents that help answer the question\n<|embed|>\n',
'document': "<|embed|>\n"
},
}
with open(f"configs/{model}/pony.json", 'w') as f:
json.dump(instructions, f, indent=2)
instructions = {
'instructions': {
'query': '<|user|>\nGiven a coding problem, retrieve relevant examples that help answer the problem\n<|embed|>\n',
'document': "<|embed|>\n"
},
}
with open(f"configs/{model}/leetcode.json", 'w') as f:
json.dump(instructions, f, indent=2)
for task in ['aops','theoremqa']:
instructions = {
'instructions': {
'query': '<|user|>\nGiven a Math problem, retrieve relevant examples that help answer the problem\n<|embed|>\n',
'document': "<|embed|>\n"
},
}
with open(f"configs/{model}/{task}.json",'w') as f:
json.dump(instructions,f,indent=2)
for model in ['inst-l','inst-xl']:
if not os.path.isdir(f"configs/{model}"):
os.makedirs(f"configs/{model}")
for task in ['biology','earth_science','economics','psychology','robotics','stackoverflow','sustainable_living']:
instructions = {
'instructions': {
'query': "Represent the {task} post for retrieving relevant paragraphs: ",
'document': "Represent the {task} paragraph for retrieval: "
},
'instructions_long': {
'query': "Represent the {task} post for retrieving relevant documents: ",
'document': "Represent the {task} document for retrieval: "
},
}
with open(f"configs/{model}/{task}.json",'w') as f:
json.dump(instructions,f,indent=2)
instructions = {
'instructions': {
'query': "Represent the Pony question for retrieving relevant paragraphs: ",
'document': "Represent the Pony paragraph for retrieval: "
},
'instructions_long': {
'query': "Represent the Pony question for retrieving relevant documents: ",
'document': "Represent the Pony document for retrieval: "
},
}
with open(f"configs/{model}/pony.json", 'w') as f:
json.dump(instructions, f, indent=2)
instructions = {
'instructions': {
'query': "Represent the Coding problem for retrieving relevant examples: ",
'document': "Represent the Coding example for retrieval: "
},
}
with open(f"configs/{model}/leetcode.json", 'w') as f:
json.dump(instructions, f, indent=2)
for task in ['aops','theoremqa']:
instructions = {
'instructions': {
'query': "Represent the Math problem for retrieving relevant examples: ",
'document': "Represent the Math example for retrieval: "
},
}
with open(f"configs/{model}/{task}.json",'w') as f:
json.dump(instructions,f,indent=2)
for model in ['bge']:
if not os.path.isdir(f"configs/{model}"):
os.makedirs(f"configs/{model}")
for task in ['biology','earth_science','economics','psychology','robotics','stackoverflow','sustainable_living']:
instructions = {
'instructions': {
'query': "Represent this {task} post for searching relevant passages: ",
},
'instructions_long': {
'query': "Represent this {task} post for searching relevant documents: ",
},
}
with open(f"configs/{model}/{task}.json",'w') as f:
json.dump(instructions,f,indent=2)
instructions = {
'instructions': {
'query': "Represent this Pony question for searching relevant passages: ",
},
'instructions_long': {
'query': "Represent this Pony question for searching relevant documents: ",
},
}
with open(f"configs/{model}/pony.json", 'w') as f:
json.dump(instructions, f, indent=2)
instructions = {
'instructions': {
'query': "Represent this Coding problem for searching relevant examples: ",
},
}
with open(f"configs/{model}/leetcode.json", 'w') as f:
json.dump(instructions, f, indent=2)
for task in ['aops','theoremqa']:
instructions = {
'instructions': {
'query': "Represent this Math problem for searching relevant examples: ",
},
}
with open(f"configs/{model}/{task}.json",'w') as f:
json.dump(instructions,f,indent=2)
for model in ['bm25','sbert','openai','cohere','voyage','google']:
if not os.path.isdir(f"configs/{model}"):
os.makedirs(f"configs/{model}")
for task in ['biology','earth_science','economics','psychology','robotics','stackoverflow','sustainable_living','leetcode','pony','aops','theoremqa']:
instructions = {
'instructions': {},
'instructions_long': {},
}
with open(f"configs/{model}/{task}.json",'w') as f:
json.dump(instructions,f,indent=2)