Spaces:
Runtime error
Runtime error
Add files
Browse files- requirements.txt +12 -0
- templates/goat.json +502 -0
- utils/README.md +13 -0
- utils/__init__.py +0 -0
- utils/callbacks.py +75 -0
- utils/prompter.py +94 -0
requirements.txt
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
accelerate
|
2 |
+
appdirs
|
3 |
+
loralib
|
4 |
+
bitsandbytes
|
5 |
+
black
|
6 |
+
black[jupyter]
|
7 |
+
datasets
|
8 |
+
fire
|
9 |
+
git+https://github.com/huggingface/peft.git
|
10 |
+
transformers>=4.28.0
|
11 |
+
sentencepiece
|
12 |
+
gradio
|
templates/goat.json
ADDED
@@ -0,0 +1,502 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"1": "{instruction}",
|
3 |
+
"2": "{instruction}",
|
4 |
+
"3": "{instruction}",
|
5 |
+
"4": "{instruction}",
|
6 |
+
"5": "{instruction}",
|
7 |
+
"6": "{instruction}",
|
8 |
+
"7": "{instruction}",
|
9 |
+
"8": "{instruction}",
|
10 |
+
"9": "{instruction}",
|
11 |
+
"10": "{instruction}",
|
12 |
+
"11": "{instruction}",
|
13 |
+
"12": "{instruction}",
|
14 |
+
"13": "{instruction}",
|
15 |
+
"14": "{instruction}",
|
16 |
+
"15": "{instruction}",
|
17 |
+
"16": "{instruction}",
|
18 |
+
"17": "{instruction}",
|
19 |
+
"18": "{instruction}",
|
20 |
+
"19": "{instruction}",
|
21 |
+
"20": "{instruction}",
|
22 |
+
"21": "{instruction}",
|
23 |
+
"22": "{instruction}",
|
24 |
+
"23": "{instruction}",
|
25 |
+
"24": "{instruction}",
|
26 |
+
"25": "{instruction}",
|
27 |
+
"26": "{instruction}",
|
28 |
+
"27": "{instruction}",
|
29 |
+
"28": "{instruction}",
|
30 |
+
"29": "{instruction}",
|
31 |
+
"30": "{instruction}",
|
32 |
+
"31": "{instruction}",
|
33 |
+
"32": "{instruction}",
|
34 |
+
"33": "{instruction}",
|
35 |
+
"34": "{instruction}",
|
36 |
+
"35": "{instruction}",
|
37 |
+
"36": "{instruction}",
|
38 |
+
"37": "{instruction}",
|
39 |
+
"38": "{instruction}",
|
40 |
+
"39": "{instruction}",
|
41 |
+
"40": "{instruction}",
|
42 |
+
"41": "{instruction}",
|
43 |
+
"42": "{instruction}",
|
44 |
+
"43": "{instruction}",
|
45 |
+
"44": "{instruction}",
|
46 |
+
"45": "{instruction}",
|
47 |
+
"46": "{instruction}",
|
48 |
+
"47": "{instruction}",
|
49 |
+
"48": "{instruction}",
|
50 |
+
"49": "{instruction}",
|
51 |
+
"50": "{instruction}",
|
52 |
+
"51": "{instruction}",
|
53 |
+
"52": "{instruction}",
|
54 |
+
"53": "{instruction}",
|
55 |
+
"54": "{instruction}",
|
56 |
+
"55": "{instruction}",
|
57 |
+
"56": "{instruction}",
|
58 |
+
"57": "{instruction}",
|
59 |
+
"58": "{instruction}",
|
60 |
+
"59": "{instruction}",
|
61 |
+
"60": "{instruction}",
|
62 |
+
"61": "{instruction}",
|
63 |
+
"62": "{instruction}",
|
64 |
+
"63": "{instruction}",
|
65 |
+
"64": "{instruction}",
|
66 |
+
"65": "{instruction}",
|
67 |
+
"66": "{instruction}",
|
68 |
+
"67": "{instruction}",
|
69 |
+
"68": "{instruction}",
|
70 |
+
"69": "{instruction}",
|
71 |
+
"70": "{instruction}",
|
72 |
+
"71": "{instruction}",
|
73 |
+
"72": "{instruction}",
|
74 |
+
"73": "{instruction}",
|
75 |
+
"74": "{instruction}",
|
76 |
+
"75": "{instruction}",
|
77 |
+
"76": "{instruction}",
|
78 |
+
"77": "{instruction}",
|
79 |
+
"78": "{instruction}",
|
80 |
+
"79": "{instruction}",
|
81 |
+
"80": "{instruction}",
|
82 |
+
"81": "{instruction}",
|
83 |
+
"82": "{instruction}",
|
84 |
+
"83": "{instruction}",
|
85 |
+
"84": "{instruction}",
|
86 |
+
"85": "{instruction}",
|
87 |
+
"86": "{instruction}",
|
88 |
+
"87": "{instruction}",
|
89 |
+
"88": "{instruction}",
|
90 |
+
"89": "{instruction}",
|
91 |
+
"90": "{instruction}",
|
92 |
+
"91": "{instruction}",
|
93 |
+
"92": "{instruction}",
|
94 |
+
"93": "{instruction}",
|
95 |
+
"94": "{instruction}",
|
96 |
+
"95": "{instruction}",
|
97 |
+
"96": "{instruction}",
|
98 |
+
"97": "{instruction}",
|
99 |
+
"98": "{instruction}",
|
100 |
+
"99": "{instruction}",
|
101 |
+
"100": "{instruction}",
|
102 |
+
"101": "{instruction} =",
|
103 |
+
"102": "{instruction} =",
|
104 |
+
"103": "{instruction} =",
|
105 |
+
"104": "{instruction} =",
|
106 |
+
"105": "{instruction} =",
|
107 |
+
"106": "{instruction} =",
|
108 |
+
"107": "{instruction} =",
|
109 |
+
"108": "{instruction} =",
|
110 |
+
"109": "{instruction} =",
|
111 |
+
"110": "{instruction} =",
|
112 |
+
"111": "{instruction} =",
|
113 |
+
"112": "{instruction} =",
|
114 |
+
"113": "{instruction} =",
|
115 |
+
"114": "{instruction} =",
|
116 |
+
"115": "{instruction} =",
|
117 |
+
"116": "{instruction} =",
|
118 |
+
"117": "{instruction} =",
|
119 |
+
"118": "{instruction} =",
|
120 |
+
"119": "{instruction} =",
|
121 |
+
"120": "{instruction} =",
|
122 |
+
"121": "{instruction} =",
|
123 |
+
"122": "{instruction} =",
|
124 |
+
"123": "{instruction} =",
|
125 |
+
"124": "{instruction} =",
|
126 |
+
"125": "{instruction} =",
|
127 |
+
"126": "{instruction} =",
|
128 |
+
"127": "{instruction} =",
|
129 |
+
"128": "{instruction} =",
|
130 |
+
"129": "{instruction} =",
|
131 |
+
"130": "{instruction} =",
|
132 |
+
"131": "{instruction} is",
|
133 |
+
"132": "{instruction} is",
|
134 |
+
"133": "{instruction} is",
|
135 |
+
"134": "{instruction} is",
|
136 |
+
"135": "{instruction} is",
|
137 |
+
"136": "{instruction}=",
|
138 |
+
"137": "{instruction}=",
|
139 |
+
"138": "{instruction}=",
|
140 |
+
"139": "{instruction}=",
|
141 |
+
"140": "{instruction}=",
|
142 |
+
"141": "{instruction}=",
|
143 |
+
"142": "{instruction}=",
|
144 |
+
"143": "{instruction}=",
|
145 |
+
"144": "{instruction}=",
|
146 |
+
"145": "{instruction}=",
|
147 |
+
"146": "{instruction}=",
|
148 |
+
"147": "{instruction}=",
|
149 |
+
"148": "{instruction}=",
|
150 |
+
"149": "{instruction}=",
|
151 |
+
"150": "{instruction}=",
|
152 |
+
"151": "{instruction}=?",
|
153 |
+
"152": "{instruction}=?",
|
154 |
+
"153": "{instruction}=?",
|
155 |
+
"154": "{instruction}=?",
|
156 |
+
"155": "{instruction}=?",
|
157 |
+
"156": "{instruction}=?",
|
158 |
+
"157": "{instruction}=?",
|
159 |
+
"158": "{instruction}=?",
|
160 |
+
"159": "{instruction}=?",
|
161 |
+
"160": "{instruction}=?",
|
162 |
+
"161": "what is {instruction}",
|
163 |
+
"162": "what is {instruction}",
|
164 |
+
"163": "what is {instruction}",
|
165 |
+
"164": "what is {instruction}",
|
166 |
+
"165": "what is {instruction}",
|
167 |
+
"166": "What is {instruction}",
|
168 |
+
"167": "What is {instruction}",
|
169 |
+
"168": "What is {instruction}",
|
170 |
+
"169": "What is {instruction}",
|
171 |
+
"170": "What is {instruction}",
|
172 |
+
"171": "What is {instruction}?",
|
173 |
+
"172": "What is {instruction}?",
|
174 |
+
"173": "What is {instruction}?",
|
175 |
+
"174": "What is {instruction}?",
|
176 |
+
"175": "What is {instruction}?",
|
177 |
+
"176": "What is {instruction}?",
|
178 |
+
"177": "What is {instruction}?",
|
179 |
+
"178": "What is {instruction}?",
|
180 |
+
"179": "What is {instruction}?",
|
181 |
+
"180": "What is {instruction}?",
|
182 |
+
"181": "compute {instruction}",
|
183 |
+
"182": "compute {instruction}",
|
184 |
+
"183": "compute {instruction}",
|
185 |
+
"184": "compute {instruction}",
|
186 |
+
"185": "compute {instruction}",
|
187 |
+
"186": "Compute {instruction}",
|
188 |
+
"187": "Compute {instruction}.",
|
189 |
+
"188": "Compute {instruction}.",
|
190 |
+
"189": "Compute {instruction}.",
|
191 |
+
"190": "Compute {instruction}.",
|
192 |
+
"191": "calculate {instruction}",
|
193 |
+
"192": "calculate {instruction}",
|
194 |
+
"193": "calculate {instruction}",
|
195 |
+
"194": "Calculate {instruction}",
|
196 |
+
"195": "Calculate {instruction}",
|
197 |
+
"196": "calculate {instruction}",
|
198 |
+
"197": "calculate {instruction}.",
|
199 |
+
"198": "calculate {instruction}.",
|
200 |
+
"199": "Calculate {instruction}.",
|
201 |
+
"200": "Calculate {instruction}.",
|
202 |
+
"201": "solve {instruction}",
|
203 |
+
"202": "solve {instruction}",
|
204 |
+
"203": "solve {instruction}",
|
205 |
+
"204": "Solve {instruction}",
|
206 |
+
"205": "Solve {instruction}.",
|
207 |
+
"206": "Solve {instruction}.",
|
208 |
+
"207": "Solve the following problem: {instruction}",
|
209 |
+
"208": "Solve the following problem: {instruction}",
|
210 |
+
"209": "Solve the following question: {instruction}",
|
211 |
+
"210": "Solve the following question: {instruction}",
|
212 |
+
"211": "Q: {instruction}",
|
213 |
+
"212": "Q: {instruction}",
|
214 |
+
"213": "Q: {instruction}",
|
215 |
+
"214": "Q: {instruction}",
|
216 |
+
"215": "Q: {instruction}",
|
217 |
+
"216": "Determine {instruction}",
|
218 |
+
"217": "Determine {instruction}",
|
219 |
+
"218": "Determine {instruction}",
|
220 |
+
"219": "Determine {instruction}.",
|
221 |
+
"220": "Determine {instruction}.",
|
222 |
+
"221": "find {instruction}",
|
223 |
+
"222": "find {instruction}",
|
224 |
+
"223": "Find {instruction}",
|
225 |
+
"224": "Find {instruction}.",
|
226 |
+
"225": "Find {instruction}.",
|
227 |
+
"226": "answer {instruction}",
|
228 |
+
"227": "answer {instruction}",
|
229 |
+
"228": "Answer {instruction}",
|
230 |
+
"229": "Answer {instruction}.",
|
231 |
+
"230": "Answer {instruction}.",
|
232 |
+
"231": "Answer the following question: {instruction}",
|
233 |
+
"232": "Answer the following question: {instruction}",
|
234 |
+
"233": "Answer the following question: {instruction}",
|
235 |
+
"234": "Answer the following question: {instruction}.",
|
236 |
+
"235": "Answer the following question: {instruction}.",
|
237 |
+
"236": "What is the value of {instruction}?",
|
238 |
+
"237": "What is the value of {instruction}?",
|
239 |
+
"238": "What is the value of {instruction}?",
|
240 |
+
"239": "What is the value of {instruction}",
|
241 |
+
"240": "What is the value of {instruction}",
|
242 |
+
"241": "What is the result of {instruction}?",
|
243 |
+
"242": "What is the result of {instruction}?",
|
244 |
+
"243": "What is the result of {instruction}?",
|
245 |
+
"244": "What is the result of {instruction}",
|
246 |
+
"245": "what is the result of {instruction}",
|
247 |
+
"246": "Can you tell me the result of {instruction}? Thank you!",
|
248 |
+
"247": "Show me the result of the following arithmetic expression: {instruction}",
|
249 |
+
"248": "What is the value of {instruction}? Show your working steps.",
|
250 |
+
"249": "Evaluate the value of {instruction}",
|
251 |
+
"250": "Determine the value of {instruction}.",
|
252 |
+
"251": "Find the result for {instruction}.",
|
253 |
+
"252": "Solve the expression {instruction}.",
|
254 |
+
"253": "Please work out {instruction}.",
|
255 |
+
"254": "Can you help me work out {instruction}? Thanks!",
|
256 |
+
"255": "Calculate the outcome of {instruction}.",
|
257 |
+
"256": "What is the answer to {instruction}?",
|
258 |
+
"257": "Provide the result for {instruction}.",
|
259 |
+
"258": "Can you compute the value of {instruction}?",
|
260 |
+
"259": "Figure out the value of {instruction}.",
|
261 |
+
"260": "What is the solution for {instruction}?",
|
262 |
+
"261": "Kindly determine the result of {instruction}.",
|
263 |
+
"262": "Assess the value of {instruction}.",
|
264 |
+
"263": "Compute the answer for {instruction}.",
|
265 |
+
"264": "Obtain the value for {instruction}.",
|
266 |
+
"265": "Reveal the result of {instruction}.",
|
267 |
+
"266": "What does {instruction} evaluate to?",
|
268 |
+
"267": "Please provide the calculation for {instruction}.",
|
269 |
+
"268": "Help me find the value of {instruction}.",
|
270 |
+
"269": "Please help me find the value of {instruction}.",
|
271 |
+
"270": "Uncover the result of the expression {instruction}.",
|
272 |
+
"271": "What is the solution for {instruction}?",
|
273 |
+
"272": "What is the value of {instruction}?",
|
274 |
+
"273": "Compute the result of {instruction}.",
|
275 |
+
"274": "Determine the outcome of {instruction}.",
|
276 |
+
"275": "Can you solve for {instruction}?",
|
277 |
+
"276": "Kindly calculate {instruction} for me.",
|
278 |
+
"277": "Please calculate {instruction}",
|
279 |
+
"278": "Please figure out the value of {instruction}.",
|
280 |
+
"279": "Find the value of {instruction}.",
|
281 |
+
"280": "What is the numerical value of {instruction}?",
|
282 |
+
"281": "Reveal the solution to {instruction}.",
|
283 |
+
"282": "Could you work out {instruction} for me?",
|
284 |
+
"283": "Please estimate the value of {instruction}.",
|
285 |
+
"284": "What should {instruction} amount to?",
|
286 |
+
"285": "Can you help me with calculating {instruction}?",
|
287 |
+
"286": "What is the result of the expression {instruction}?",
|
288 |
+
"287": "Obtain the answer for {instruction}.",
|
289 |
+
"288": "Evaluate the expression {instruction}.",
|
290 |
+
"289": "Help me determine the value of {instruction}.",
|
291 |
+
"290": "Calculate the answer to {instruction}.",
|
292 |
+
"291": "Can you calculate the outcome of {instruction}?",
|
293 |
+
"292": "What is the value obtained from {instruction}?",
|
294 |
+
"293": "Find the result of the computation for {instruction}.",
|
295 |
+
"294": "Can you determine the value of {instruction}?",
|
296 |
+
"295": "Help me solve the problem {instruction}.",
|
297 |
+
"296": "What is the result of {instruction}?",
|
298 |
+
"297": "Please assess the value of {instruction}.",
|
299 |
+
"298": "Could you calculate {instruction} for me?",
|
300 |
+
"299": "What is the outcome of the calculation {instruction}?",
|
301 |
+
"300": "Find the solution for {instruction}.",
|
302 |
+
"301": "Can you provide the answer to {instruction}?",
|
303 |
+
"302": "What does {instruction} yield?",
|
304 |
+
"303": "Please help me evaluate {instruction}.",
|
305 |
+
"304": "What is the numerical outcome of {instruction}?",
|
306 |
+
"305": "Assist me in calculating {instruction}.",
|
307 |
+
"306": "Can you figure out the value of {instruction}?",
|
308 |
+
"307": "What is the answer for the expression {instruction}?",
|
309 |
+
"308": "Help me uncover the result of {instruction}.",
|
310 |
+
"309": "Please compute and provide the result of {instruction}.",
|
311 |
+
"310": "What is the solution to the problem {instruction}?",
|
312 |
+
"311": "Determine the answer to {instruction} for me.",
|
313 |
+
"312": "Can you solve and provide the value of {instruction}?",
|
314 |
+
"313": "Solve the following problem: {instruction}.",
|
315 |
+
"314": "Please solve the following problem: {instruction}.",
|
316 |
+
"315": "Could you please solve the following problem: {instruction}.",
|
317 |
+
"316": "Solve the following task: {instruction}.",
|
318 |
+
"317": "Compute the value of {instruction}.",
|
319 |
+
"318": "Evaluate the expression {instruction}.",
|
320 |
+
"319": "Please solve for {instruction}.",
|
321 |
+
"320": "Find the result of {instruction}.",
|
322 |
+
"321": "What is the outcome of evaluating {instruction}?",
|
323 |
+
"322": "I need the solution to the expression {instruction}.",
|
324 |
+
"323": "Help me calculate the value of {instruction}.",
|
325 |
+
"324": "Please provide the answer for {instruction}.",
|
326 |
+
"325": "Compute {instruction} and give me the answer.",
|
327 |
+
"326": "I am looking for the value of {instruction}. Can you help?",
|
328 |
+
"327": "Evaluate {instruction} and let me know the result.",
|
329 |
+
"328": "What is the value of the expression {instruction}?",
|
330 |
+
"329": "Calculate {instruction} and tell me the solution.",
|
331 |
+
"330": "Find the value of {instruction} for me, please.",
|
332 |
+
"331": "Solve the arithmetic task {instruction} and tell me the answer.",
|
333 |
+
"332": "Can you help me find the result of {instruction}?",
|
334 |
+
"333": "Please give me the calculation for {instruction}.",
|
335 |
+
"334": "What is the numerical value of {instruction}?",
|
336 |
+
"335": "Determine the value of {instruction}.",
|
337 |
+
"336": "Compute the solution for {instruction}.",
|
338 |
+
"337": "What is the numerical outcome of {instruction}?",
|
339 |
+
"338": "Please give me the computation for {instruction}.",
|
340 |
+
"339": "Find the answer to the expression {instruction}.",
|
341 |
+
"340": "Evaluate {instruction} and provide the result.",
|
342 |
+
"341": "I need to know the result of {instruction}. Can you calculate it?",
|
343 |
+
"342": "What is the computed value of {instruction}?",
|
344 |
+
"343": "Help me calculate the value of {instruction}.",
|
345 |
+
"344": "Please show me the working for computing {instruction}.",
|
346 |
+
"345": "Compute {instruction} and tell me the numerical result.",
|
347 |
+
"346": "I am looking for the value of {instruction}. Can you help?",
|
348 |
+
"347": "Evaluate {instruction} and give me the answer.",
|
349 |
+
"348": "What is the output of evaluating {instruction}?",
|
350 |
+
"349": "Calculate {instruction} and provide the result.",
|
351 |
+
"350": "Can you compute the value of {instruction}?",
|
352 |
+
"351": "I need to know the numerical value of {instruction}.",
|
353 |
+
"352": "Find the value of {instruction} and provide the solution.",
|
354 |
+
"353": "Evaluate the expression {instruction} and let me know the computed value.",
|
355 |
+
"354": "What is the solution to the calculation of {instruction}?",
|
356 |
+
"355": "Can you show me how to compute the value of {instruction}?",
|
357 |
+
"356": "Please calculate {instruction} and tell me the numerical outcome.",
|
358 |
+
"357": "Compute {instruction} and provide the solution.",
|
359 |
+
"358": "Tell me the value of {instruction}.",
|
360 |
+
"359": "I need to calculate the value of {instruction}. Can you help?",
|
361 |
+
"360": "Evaluate {instruction} and let me know the numerical solution.",
|
362 |
+
"361": "Find the numerical value of {instruction}.",
|
363 |
+
"362": "Please give me the computation for {instruction}.",
|
364 |
+
"363": "Compute the value of {instruction}.",
|
365 |
+
"364": "Answer the problem below: {instruction}",
|
366 |
+
"365": "Please solve the following problem: {instruction}",
|
367 |
+
"366": "{instruction} is what",
|
368 |
+
"367": "Solve the arithmetic expression: {instruction}",
|
369 |
+
"368": "Evaluate the expression {instruction} and let me know the computed value.",
|
370 |
+
"369": "What is the solution to the calculation of {instruction}?",
|
371 |
+
"370": "Can you show me how to compute the value of {instruction}?",
|
372 |
+
"371": "Please calculate {instruction} and tell me the numerical outcome.",
|
373 |
+
"372": "Compute {instruction} and provide the solution.",
|
374 |
+
"373": "Determine the result of {instruction}.",
|
375 |
+
"374": "Find the value of {instruction}.",
|
376 |
+
"375": "Solve the expression {instruction} and give me the answer.",
|
377 |
+
"376": "Perform the calculation {instruction} and provide the result.",
|
378 |
+
"377": "What is the computed value of {instruction}?",
|
379 |
+
"378": "Show me the solution to {instruction}.",
|
380 |
+
"379": "Calculate the outcome of {instruction}.",
|
381 |
+
"380": "Evaluate the mathematical expression {instruction} and tell me the answer.",
|
382 |
+
"381": "Determine the value when evaluating {instruction}.",
|
383 |
+
"382": "Compute the result of {instruction}.",
|
384 |
+
"383": "Solve for the value of {instruction}.",
|
385 |
+
"384": "What is the numerical value of {instruction}?",
|
386 |
+
"385": "Provide the computed outcome for {instruction}.",
|
387 |
+
"386": "Find the solution for {instruction}.",
|
388 |
+
"387": "Calculate the value of {instruction} and give me the result.",
|
389 |
+
"388": "Can you calculate the expression {instruction} step by step and show the process?",
|
390 |
+
"389": "Provide a step-by-step calculation for the expression {instruction}.",
|
391 |
+
"390": "Walk me through the process of calculating {instruction} in a step-by-step manner.",
|
392 |
+
"391": "Break down the calculation of {instruction} and show each step.",
|
393 |
+
"392": "Can you demonstrate the step-by-step evaluation of {instruction}?",
|
394 |
+
"393": "Show me the step-by-step solution for the expression {instruction}.",
|
395 |
+
"394": "Perform a detailed step-by-step calculation for {instruction}.",
|
396 |
+
"395": "Explain each step involved in evaluating {instruction}.",
|
397 |
+
"396": "Guide me through the step-by-step computation of {instruction}.",
|
398 |
+
"397": "Decompose the expression {instruction} into individual calculation steps.",
|
399 |
+
"398": "Show the sequential steps for calculating {instruction}.",
|
400 |
+
"399": "Can you provide a stepwise solution for evaluating {instruction}?",
|
401 |
+
"400": "Demonstrate the step-by-step process for computing {instruction}.",
|
402 |
+
"401": "Explain the calculations involved in {instruction} in a step-by-step manner.",
|
403 |
+
"402": "Break down the expression {instruction} into its consecutive calculation steps.",
|
404 |
+
"403": "Guide me through the sequential steps of evaluating {instruction}.",
|
405 |
+
"404": "Provide a detailed step-by-step breakdown for calculating {instruction}.",
|
406 |
+
"405": "Show the step-by-step method for evaluating {instruction}.",
|
407 |
+
"406": "Explain each computation step in the evaluation of {instruction}.",
|
408 |
+
"407": "Walk me through the stepwise calculation of {instruction}.",
|
409 |
+
"408": "Compute the value of {instruction}.",
|
410 |
+
"409": "Determine the result of evaluating the expression {instruction}.",
|
411 |
+
"410": "Find the numerical outcome of {instruction}.",
|
412 |
+
"411": "Perform the calculation for {instruction}.",
|
413 |
+
"412": "Solve the mathematical expression {instruction}.",
|
414 |
+
"413": "Evaluate the equation {instruction} and provide the answer.",
|
415 |
+
"414": "Work out the value of {instruction} by performing the necessary calculations.",
|
416 |
+
"415": "Determine the numeric value resulting from {instruction}.",
|
417 |
+
"416": "Compute the outcome of the given expression {instruction}.",
|
418 |
+
"417": "Find the solution by calculating {instruction}.",
|
419 |
+
"418": "Perform the necessary arithmetic operations to determine the value of {instruction}.",
|
420 |
+
"419": "Derive the result of the expression {instruction} through computation.",
|
421 |
+
"420": "Carry out the calculations for {instruction} and provide the answer.",
|
422 |
+
"421": "Determine the numerical value resulting from the evaluation of {instruction}.",
|
423 |
+
"422": "Solve for the value of {instruction} by performing the necessary computations.",
|
424 |
+
"423": "Compute the value obtained by evaluating the expression {instruction}.",
|
425 |
+
"424": "Perform the required mathematical operations to find the result of {instruction}.",
|
426 |
+
"425": "Determine the outcome of {instruction} by performing the calculation.",
|
427 |
+
"426": "Find the numerical solution for {instruction} through computation.",
|
428 |
+
"427": "Work through the expression {instruction} to find its value.",
|
429 |
+
"428": "Compute the value of the expression {instruction}.",
|
430 |
+
"429": "Determine the result of the expression {instruction}.",
|
431 |
+
"430": "Find the numerical outcome of {instruction}.",
|
432 |
+
"431": "Evaluate {instruction} and provide the solution.",
|
433 |
+
"432": "Solve the equation represented by {instruction}.",
|
434 |
+
"433": "Perform calculations for {instruction} and give the answer.",
|
435 |
+
"434": "Determine the value when {instruction} is calculated.",
|
436 |
+
"435": "Compute the {instruction} and obtain the result.",
|
437 |
+
"436": "Derive the solution for {instruction}.",
|
438 |
+
"437": "Determine the numeric value of {instruction}.",
|
439 |
+
"438": "Solve the mathematical expression {instruction}.",
|
440 |
+
"439": "Calculate the outcome of {instruction}.",
|
441 |
+
"440": "Find the solution by evaluating {instruction}.",
|
442 |
+
"441": "Determine the result obtained by evaluating {instruction}.",
|
443 |
+
"442": "Obtain the computed value of {instruction}.",
|
444 |
+
"443": "Perform mathematical calculations for {instruction}.",
|
445 |
+
"444": "Compute the numerical value for {instruction}.",
|
446 |
+
"445": "Evaluate the equation {instruction} and provide the result.",
|
447 |
+
"446": "Solve {instruction} and give the calculated value.",
|
448 |
+
"447": "Determine the outcome of {instruction} through computation.",
|
449 |
+
"448": "Compute the value of the expression {instruction}.",
|
450 |
+
"449": "Determine the result of evaluating the expression {instruction}.",
|
451 |
+
"450": "Find the numerical outcome of {instruction} through calculation.",
|
452 |
+
"451": "Solve the mathematical expression {instruction} and provide the answer.",
|
453 |
+
"452": "Perform the computation for the expression {instruction}.",
|
454 |
+
"453": "Find the solution by evaluating {instruction}.",
|
455 |
+
"454": "Derive the value of {instruction} through calculation.",
|
456 |
+
"455": "Obtain the result by calculating {instruction}.",
|
457 |
+
"456": "Determine the numerical value of {instruction} through mathematical computation.",
|
458 |
+
"457": "Evaluate the {instruction} and ascertain the outcome.",
|
459 |
+
"458": "Compute the mathematical expression {instruction} and yield the result.",
|
460 |
+
"459": "Solve the equation {instruction} and provide the computed value.",
|
461 |
+
"460": "Find the outcome by performing the calculation for {instruction}.",
|
462 |
+
"461": "Calculate the value of the expression {instruction} and provide the answer.",
|
463 |
+
"462": "Determine the numerical result of {instruction} through computation.",
|
464 |
+
"463": "Perform the necessary calculation to obtain the value of {instruction}.",
|
465 |
+
"464": "Evaluate {instruction} mathematically and obtain the solution.",
|
466 |
+
"465": "Compute {instruction} to find the numerical value.",
|
467 |
+
"466": "Solve the given expression {instruction} and derive the outcome.",
|
468 |
+
"467": "Determine the result by carrying out the calculation for {instruction}.",
|
469 |
+
"468": "Find the numerical outcome of the expression {instruction}.",
|
470 |
+
"469": "Work out {instruction} and provide the result.",
|
471 |
+
"470": "Calculate the value of the given expression {instruction}.",
|
472 |
+
"471": "Could you assist me in computing {instruction}?",
|
473 |
+
"472": "Would you be able to aid me in evaluating {instruction}?",
|
474 |
+
"473": "Can you provide guidance on calculating the expression {instruction}?",
|
475 |
+
"474": "I'm seeking your assistance to calculate {instruction}, could you please help?",
|
476 |
+
"475": "Are you able to lend a hand in computing {instruction}?",
|
477 |
+
"476": "May I ask for your support in determining the value of {instruction}?",
|
478 |
+
"477": "Could you please guide me through the process of calculating {instruction}?",
|
479 |
+
"478": "I'm looking for assistance in evaluating {instruction}, can you help me with that?",
|
480 |
+
"479": "Can you provide step-by-step assistance in calculating {instruction}?",
|
481 |
+
"480": "I would greatly appreciate your help in determining the result of the expression {instruction}.",
|
482 |
+
"481": "Could you please lend me a hand in computing the value of {instruction}?",
|
483 |
+
"482": "Can you assist me in evaluating {instruction}? I would really appreciate it.",
|
484 |
+
"483": "Would you mind helping me calculate {instruction}? I'm a bit stuck.",
|
485 |
+
"484": "Can you guide me through the process of calculating {instruction}? I could use some help.",
|
486 |
+
"485": "I'm struggling to calculate the expression {instruction}, could you please offer your assistance?",
|
487 |
+
"486": "May I request your support in determining the value of {instruction}?",
|
488 |
+
"487": "Could you please provide your expertise in evaluating {instruction}?",
|
489 |
+
"488": "I'm looking for someone to help me compute {instruction}. Can you assist?",
|
490 |
+
"489": "Would it be possible for you to guide me through calculating the expression {instruction}?",
|
491 |
+
"490": "Can you please assist me in evaluating the expression {instruction}? Your help would be greatly appreciated.",
|
492 |
+
"491": "Could you assist me in computing {instruction}?",
|
493 |
+
"492": "I need your assistance in evaluating {instruction}. Can you help me?",
|
494 |
+
"493": "Would you mind guiding me through the calculation of the expression {instruction}?",
|
495 |
+
"494": "Can I rely on your help to compute {instruction}?",
|
496 |
+
"495": "I'm seeking your support in calculating {instruction}. Can you provide assistance?",
|
497 |
+
"496": "I could use some help with evaluating {instruction}. Can you lend a hand?",
|
498 |
+
"497": "Are you able to provide guidance in computing {instruction}?",
|
499 |
+
"498": "I would appreciate it if you could assist me in calculating {instruction}.",
|
500 |
+
"499": "Can you please lend your expertise to help me calculate {instruction}?",
|
501 |
+
"500": "Would you be willing to help me determine the value of {instruction}?"
|
502 |
+
}
|
utils/README.md
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Directory for helpers modules
|
2 |
+
|
3 |
+
## prompter.py
|
4 |
+
|
5 |
+
Prompter class, a template manager.
|
6 |
+
|
7 |
+
`from utils.prompter import Prompter`
|
8 |
+
|
9 |
+
## callbacks.py
|
10 |
+
|
11 |
+
Helpers to support streaming generate output.
|
12 |
+
|
13 |
+
`from utils.callbacks import Iteratorize, Stream`
|
utils/__init__.py
ADDED
File without changes
|
utils/callbacks.py
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
Helpers to support streaming generate output.
|
3 |
+
Borrowed from https://github.com/oobabooga/text-generation-webui/blob/ad37f396fc8bcbab90e11ecf17c56c97bfbd4a9c/modules/callbacks.py
|
4 |
+
"""
|
5 |
+
|
6 |
+
import gc
|
7 |
+
import traceback
|
8 |
+
from queue import Queue
|
9 |
+
from threading import Thread
|
10 |
+
|
11 |
+
import torch
|
12 |
+
import transformers
|
13 |
+
|
14 |
+
|
15 |
+
class Stream(transformers.StoppingCriteria):
|
16 |
+
def __init__(self, callback_func=None):
|
17 |
+
self.callback_func = callback_func
|
18 |
+
|
19 |
+
def __call__(self, input_ids, scores) -> bool:
|
20 |
+
if self.callback_func is not None:
|
21 |
+
self.callback_func(input_ids[0])
|
22 |
+
return False
|
23 |
+
|
24 |
+
|
25 |
+
class Iteratorize:
|
26 |
+
|
27 |
+
"""
|
28 |
+
Transforms a function that takes a callback
|
29 |
+
into a lazy iterator (generator).
|
30 |
+
"""
|
31 |
+
|
32 |
+
def __init__(self, func, kwargs={}, callback=None):
|
33 |
+
self.mfunc = func
|
34 |
+
self.c_callback = callback
|
35 |
+
self.q = Queue()
|
36 |
+
self.sentinel = object()
|
37 |
+
self.kwargs = kwargs
|
38 |
+
self.stop_now = False
|
39 |
+
|
40 |
+
def _callback(val):
|
41 |
+
if self.stop_now:
|
42 |
+
raise ValueError
|
43 |
+
self.q.put(val)
|
44 |
+
|
45 |
+
def gentask():
|
46 |
+
try:
|
47 |
+
ret = self.mfunc(callback=_callback, **self.kwargs)
|
48 |
+
except ValueError:
|
49 |
+
pass
|
50 |
+
except:
|
51 |
+
traceback.print_exc()
|
52 |
+
pass
|
53 |
+
|
54 |
+
self.q.put(self.sentinel)
|
55 |
+
if self.c_callback:
|
56 |
+
self.c_callback(ret)
|
57 |
+
|
58 |
+
self.thread = Thread(target=gentask)
|
59 |
+
self.thread.start()
|
60 |
+
|
61 |
+
def __iter__(self):
|
62 |
+
return self
|
63 |
+
|
64 |
+
def __next__(self):
|
65 |
+
obj = self.q.get(True, None)
|
66 |
+
if obj is self.sentinel:
|
67 |
+
raise StopIteration
|
68 |
+
else:
|
69 |
+
return obj
|
70 |
+
|
71 |
+
def __enter__(self):
|
72 |
+
return self
|
73 |
+
|
74 |
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
75 |
+
self.stop_now = True
|
utils/prompter.py
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
A dedicated helper to manage templates and prompt building.
|
3 |
+
"""
|
4 |
+
|
5 |
+
import json
|
6 |
+
import os.path as osp
|
7 |
+
import random
|
8 |
+
from typing import Union
|
9 |
+
|
10 |
+
|
11 |
+
class Prompter(object):
|
12 |
+
__slots__ = ("template", "_verbose")
|
13 |
+
|
14 |
+
def __init__(self, template_name: str = "", verbose: bool = False):
|
15 |
+
self._verbose = verbose
|
16 |
+
if not template_name:
|
17 |
+
# Enforce the default here, so the constructor can be called with '' and will not break.
|
18 |
+
template_name = "goat"
|
19 |
+
file_name = osp.join("templates", f"{template_name}.json")
|
20 |
+
if not osp.exists(file_name):
|
21 |
+
raise ValueError(f"Can't read {file_name}")
|
22 |
+
with open(file_name) as fp:
|
23 |
+
self.template = json.load(fp)
|
24 |
+
if self._verbose:
|
25 |
+
print(
|
26 |
+
f"Using prompt template {template_name}: {self.template['description']}"
|
27 |
+
)
|
28 |
+
|
29 |
+
def generate_prompt_simplified(
|
30 |
+
self,
|
31 |
+
instruction: str,
|
32 |
+
label: Union[None, str] = None,
|
33 |
+
) -> str:
|
34 |
+
|
35 |
+
res = f"{instruction}"
|
36 |
+
if label:
|
37 |
+
res = f"{res}{label}"
|
38 |
+
if self._verbose:
|
39 |
+
print(res)
|
40 |
+
return res
|
41 |
+
|
42 |
+
|
43 |
+
def generate_prompt(
|
44 |
+
self,
|
45 |
+
instruction: str,
|
46 |
+
label: Union[None, str] = None,
|
47 |
+
) -> str:
|
48 |
+
|
49 |
+
if random.random()<0.5:
|
50 |
+
instruction = instruction.replace("*", "x")
|
51 |
+
|
52 |
+
if random.random()<0.1:
|
53 |
+
instruction=instruction.replace("+", "plus").replace("-", "minus").replace("x", "times").replace("*", "multiplied by").replace("/", "divided by")
|
54 |
+
|
55 |
+
num = random.randint(1,500)
|
56 |
+
if random.random()<0.6:
|
57 |
+
res = self.template[str(num)].format(
|
58 |
+
arithmetic=instruction.replace(" = ", "")
|
59 |
+
)
|
60 |
+
else:
|
61 |
+
res = self.template[str(num)].format(
|
62 |
+
arithmetic=instruction.replace("=", "").replace(" ", "")
|
63 |
+
)
|
64 |
+
|
65 |
+
|
66 |
+
prompt = f"{res}\nAnswer: "
|
67 |
+
|
68 |
+
|
69 |
+
if label:
|
70 |
+
# res = f"{res}{instruction}{label}"
|
71 |
+
prompt = f"{prompt}{label}"
|
72 |
+
if self._verbose:
|
73 |
+
print(prompt)
|
74 |
+
return prompt
|
75 |
+
|
76 |
+
def generate_prompt_inference(
|
77 |
+
self,
|
78 |
+
instruction: str,
|
79 |
+
label: Union[None, str] = None,
|
80 |
+
) -> str:
|
81 |
+
|
82 |
+
res = f"{instruction}\nAnswer: "
|
83 |
+
|
84 |
+
|
85 |
+
if label:
|
86 |
+
# res = f"{res}{instruction}{label}"
|
87 |
+
res = f"{res}{label}"
|
88 |
+
if self._verbose:
|
89 |
+
print(res)
|
90 |
+
return res
|
91 |
+
|
92 |
+
def get_response(self, output: str) -> str:
|
93 |
+
# return output.split("Answer:")[1].strip()
|
94 |
+
return output
|