ThinkTim21 commited on
Commit
feb5be5
·
verified ·
1 Parent(s): d8378e1

Upload 4 files

Browse files
Dataset_Generation_Script.ipynb ADDED
@@ -0,0 +1,563 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 2,
6
+ "id": "16fd83c7-9f91-40ab-ac15-57b02a63b7f4",
7
+ "metadata": {
8
+ "tags": []
9
+ },
10
+ "outputs": [],
11
+ "source": [
12
+ "import os\n",
13
+ "os.environ['HF_HOME'] = \"/scratch/tar3kh/models/cache\"\n",
14
+ "import torch \n",
15
+ "\n",
16
+ "from datasets import load_dataset #datasets is huggingface's dataset package\n",
17
+ "import matplotlib.pyplot as plt\n",
18
+ "import numpy as np\n",
19
+ "import pandas as pd\n",
20
+ "import PIL"
21
+ ]
22
+ },
23
+ {
24
+ "cell_type": "markdown",
25
+ "id": "f748fb12-da99-4702-bfb2-263e091fee14",
26
+ "metadata": {},
27
+ "source": [
28
+ "## Synthetic Dataset (generating budgets)"
29
+ ]
30
+ },
31
+ {
32
+ "cell_type": "code",
33
+ "execution_count": 14,
34
+ "id": "61502633-b04c-44fd-b39f-7803ef778205",
35
+ "metadata": {
36
+ "tags": []
37
+ },
38
+ "outputs": [],
39
+ "source": [
40
+ "size = 3000\n",
41
+ "\n",
42
+ "np.random.seed(60)\n",
43
+ "Income_Randomizer = np.random.randint(29000,251000, size=size).astype(int)\n",
44
+ "#print(Income_Randomizer)\n",
45
+ "np.random.seed(60)\n",
46
+ "\n",
47
+ "Rent_Randomizer = np.random.randint(500,2500, size=size).astype(int)\n",
48
+ "#print(Rent_Randomizer)\n",
49
+ "np.random.seed(60)\n",
50
+ "\n",
51
+ "Car_Randomizer = np.random.randint(200,1000, size=size).astype(int)\n",
52
+ "#print(Car_Randomizer)\n",
53
+ "np.random.seed(60)\n",
54
+ "\n",
55
+ "Other_Randomizer = np.random.randint(200,600, size=size).astype(int)\n",
56
+ "#print(Other_Randomizer)\n",
57
+ "\n",
58
+ "Example_promtps = []\n",
59
+ "\n",
60
+ "for x in range(len(Income_Randomizer)):\n",
61
+ " Example_promtps.append('I have an income of about ' +\n",
62
+ " str(Income_Randomizer[x]) +\n",
63
+ " ' a year and my monthly expenses include ' +\n",
64
+ " str(Rent_Randomizer[x]) +\n",
65
+ " ' a month in rent and utilities, a ' +\n",
66
+ " str(Car_Randomizer[x]) +\n",
67
+ " ' car payment, $300 in food, and about ' +\n",
68
+ " str(Other_Randomizer[x]) +\n",
69
+ " ' a month in other expenses. Using python, can you create for me a budget spreadsheet and export it to excel?')\n",
70
+ "\n",
71
+ "#Example_promtps = ['I have an income of about ' + str(Income_Randomizer[0]) + ' a year and my monthly expenses include ' + str(Rent_Randomizer[0]) + ' a month in rent and utilities, a ' + str(Car_Randomizer[0]) + ' car payment, $300 in food, and about ' + str(Other_Randomizer[0]) + ' a month in other expenses. Using python, can you create for me a budget spreadsheet and export it to excel?',]\n",
72
+ "Example_outputs = []\n",
73
+ "\n",
74
+ "for x in range(len(Income_Randomizer)):\n",
75
+ " Example_outputs.append(''' import pandas as pd\n",
76
+ "import openpyxl\n",
77
+ "\n",
78
+ "# Define income and expenses\n",
79
+ "annual_income = '''+ str(Income_Randomizer[x])+'''\n",
80
+ "monthly_income = annual_income / 12\n",
81
+ "\n",
82
+ "expenses = {\n",
83
+ " \"Rent & Utilities\": '''+ str(Rent_Randomizer[x] )+''',\n",
84
+ " \"Car Payment\": '''+ str(Car_Randomizer[x]) +''',\n",
85
+ " \"Food\": 300,\n",
86
+ " \"Other Expenses\": '''+ str(Other_Randomizer[x]) +'''\n",
87
+ "}\n",
88
+ "\n",
89
+ "total_expenses = sum(expenses.values())\n",
90
+ "net_savings = monthly_income - total_expenses\n",
91
+ "\n",
92
+ "# Create DataFrame\n",
93
+ "budget_data = {\n",
94
+ " \"Category\": [\"Monthly Income\"] + list(expenses.keys()) + [\"Total Expenses\", \"Net Savings\"],\n",
95
+ " \"Amount ($)\": [monthly_income] + list(expenses.values()) + [total_expenses, net_savings]\n",
96
+ "}\n",
97
+ "\n",
98
+ "df = pd.DataFrame(budget_data)\n",
99
+ "\n",
100
+ "# Save to Excel\n",
101
+ "file_name = \"budget.xlsx\"\n",
102
+ "df.to_excel(file_name, index=False, engine='openpyxl')\n",
103
+ "\n",
104
+ "print(f\"Budget spreadsheet saved as {file_name}\")''')\n",
105
+ "\n",
106
+ "df2 = pd.DataFrame({'question':Example_promtps,\n",
107
+ " 'response': Example_outputs})\n",
108
+ "\n"
109
+ ]
110
+ },
111
+ {
112
+ "cell_type": "code",
113
+ "execution_count": 15,
114
+ "id": "79e98786-47d7-4a83-943a-7d5484bd4c2c",
115
+ "metadata": {
116
+ "tags": []
117
+ },
118
+ "outputs": [],
119
+ "source": [
120
+ "df2['instruct'] = \"Q: \" + df2['question'] + \"\\n\\nA: \" + \"Lets think step by step.\" + df2['response']\n",
121
+ "df2['question_1'] = \"Q: \" + df2['question'] + \"\\n\\nA: \" + \"Lets think step by step.\" "
122
+ ]
123
+ },
124
+ {
125
+ "cell_type": "code",
126
+ "execution_count": 16,
127
+ "id": "1199470a-790e-4c60-8bb5-15d7b64aa43a",
128
+ "metadata": {
129
+ "tags": []
130
+ },
131
+ "outputs": [
132
+ {
133
+ "data": {
134
+ "text/html": [
135
+ "<div>\n",
136
+ "<style scoped>\n",
137
+ " .dataframe tbody tr th:only-of-type {\n",
138
+ " vertical-align: middle;\n",
139
+ " }\n",
140
+ "\n",
141
+ " .dataframe tbody tr th {\n",
142
+ " vertical-align: top;\n",
143
+ " }\n",
144
+ "\n",
145
+ " .dataframe thead th {\n",
146
+ " text-align: right;\n",
147
+ " }\n",
148
+ "</style>\n",
149
+ "<table border=\"1\" class=\"dataframe\">\n",
150
+ " <thead>\n",
151
+ " <tr style=\"text-align: right;\">\n",
152
+ " <th></th>\n",
153
+ " <th>question</th>\n",
154
+ " <th>response</th>\n",
155
+ " <th>instruct</th>\n",
156
+ " <th>question_1</th>\n",
157
+ " </tr>\n",
158
+ " </thead>\n",
159
+ " <tbody>\n",
160
+ " <tr>\n",
161
+ " <th>0</th>\n",
162
+ " <td>I have an income of about 162325 a year and m...</td>\n",
163
+ " <td>import pandas as pd\\nimport openpyxl\\n\\n# Def...</td>\n",
164
+ " <td>Q: I have an income of about 162325 a year an...</td>\n",
165
+ " <td>Q: I have an income of about 162325 a year an...</td>\n",
166
+ " </tr>\n",
167
+ " <tr>\n",
168
+ " <th>1</th>\n",
169
+ " <td>I have an income of about 35543 a year and my...</td>\n",
170
+ " <td>import pandas as pd\\nimport openpyxl\\n\\n# Def...</td>\n",
171
+ " <td>Q: I have an income of about 35543 a year and...</td>\n",
172
+ " <td>Q: I have an income of about 35543 a year and...</td>\n",
173
+ " </tr>\n",
174
+ " <tr>\n",
175
+ " <th>2</th>\n",
176
+ " <td>I have an income of about 203179 a year and m...</td>\n",
177
+ " <td>import pandas as pd\\nimport openpyxl\\n\\n# Def...</td>\n",
178
+ " <td>Q: I have an income of about 203179 a year an...</td>\n",
179
+ " <td>Q: I have an income of about 203179 a year an...</td>\n",
180
+ " </tr>\n",
181
+ " <tr>\n",
182
+ " <th>3</th>\n",
183
+ " <td>I have an income of about 197008 a year and m...</td>\n",
184
+ " <td>import pandas as pd\\nimport openpyxl\\n\\n# Def...</td>\n",
185
+ " <td>Q: I have an income of about 197008 a year an...</td>\n",
186
+ " <td>Q: I have an income of about 197008 a year an...</td>\n",
187
+ " </tr>\n",
188
+ " <tr>\n",
189
+ " <th>4</th>\n",
190
+ " <td>I have an income of about 223681 a year and m...</td>\n",
191
+ " <td>import pandas as pd\\nimport openpyxl\\n\\n# Def...</td>\n",
192
+ " <td>Q: I have an income of about 223681 a year an...</td>\n",
193
+ " <td>Q: I have an income of about 223681 a year an...</td>\n",
194
+ " </tr>\n",
195
+ " </tbody>\n",
196
+ "</table>\n",
197
+ "</div>"
198
+ ],
199
+ "text/plain": [
200
+ " question \\\n",
201
+ "0 I have an income of about 162325 a year and m... \n",
202
+ "1 I have an income of about 35543 a year and my... \n",
203
+ "2 I have an income of about 203179 a year and m... \n",
204
+ "3 I have an income of about 197008 a year and m... \n",
205
+ "4 I have an income of about 223681 a year and m... \n",
206
+ "\n",
207
+ " response \\\n",
208
+ "0 import pandas as pd\\nimport openpyxl\\n\\n# Def... \n",
209
+ "1 import pandas as pd\\nimport openpyxl\\n\\n# Def... \n",
210
+ "2 import pandas as pd\\nimport openpyxl\\n\\n# Def... \n",
211
+ "3 import pandas as pd\\nimport openpyxl\\n\\n# Def... \n",
212
+ "4 import pandas as pd\\nimport openpyxl\\n\\n# Def... \n",
213
+ "\n",
214
+ " instruct \\\n",
215
+ "0 Q: I have an income of about 162325 a year an... \n",
216
+ "1 Q: I have an income of about 35543 a year and... \n",
217
+ "2 Q: I have an income of about 203179 a year an... \n",
218
+ "3 Q: I have an income of about 197008 a year an... \n",
219
+ "4 Q: I have an income of about 223681 a year an... \n",
220
+ "\n",
221
+ " question_1 \n",
222
+ "0 Q: I have an income of about 162325 a year an... \n",
223
+ "1 Q: I have an income of about 35543 a year and... \n",
224
+ "2 Q: I have an income of about 203179 a year an... \n",
225
+ "3 Q: I have an income of about 197008 a year an... \n",
226
+ "4 Q: I have an income of about 223681 a year an... "
227
+ ]
228
+ },
229
+ "execution_count": 16,
230
+ "metadata": {},
231
+ "output_type": "execute_result"
232
+ }
233
+ ],
234
+ "source": [
235
+ "df2.head()"
236
+ ]
237
+ },
238
+ {
239
+ "cell_type": "code",
240
+ "execution_count": 17,
241
+ "id": "1b66310d-41e4-4592-8516-b35b635baead",
242
+ "metadata": {
243
+ "tags": []
244
+ },
245
+ "outputs": [],
246
+ "source": [
247
+ "df2.to_csv('budget_dataset.csv', index=False)"
248
+ ]
249
+ },
250
+ {
251
+ "cell_type": "markdown",
252
+ "id": "2fac1974-19a0-4853-bbe5-9867b57819ce",
253
+ "metadata": {},
254
+ "source": [
255
+ "## Synthetic Dataset (Financial Goals)"
256
+ ]
257
+ },
258
+ {
259
+ "cell_type": "code",
260
+ "execution_count": 18,
261
+ "id": "e4d8b755-25ec-472f-a8e4-52d153ff2f46",
262
+ "metadata": {
263
+ "tags": []
264
+ },
265
+ "outputs": [],
266
+ "source": [
267
+ "# datset set up\n",
268
+ "\n",
269
+ "size = 3000\n",
270
+ "\n",
271
+ "\n",
272
+ "np.random.seed(60)\n",
273
+ "short_term_goals = np.random.randint(1000,5000, size=size).astype(int)\n",
274
+ "\n",
275
+ "np.random.seed(60)\n",
276
+ "medium_term_goals = np.random.randint(5000,10000, size=size).astype(int)\n",
277
+ "\n",
278
+ "np.random.seed(60)\n",
279
+ "long_term_goals = np.random.randint(75000,200000, size=size).astype(int)\n",
280
+ "\n",
281
+ "# print(short_term_goals)\n",
282
+ "# print(medium_term_goals)\n",
283
+ "# print(long_term_goals)\n",
284
+ "\n",
285
+ "prompts = []\n",
286
+ "\n",
287
+ "for x in range(len(short_term_goals)):\n",
288
+ " prompts.append('My short term goal is to save for a $' +\n",
289
+ " str(short_term_goals[x]) +\n",
290
+ " ' vacation in the next year, my medium term goal is to save for down payment for a new car, around ' +\n",
291
+ " str(medium_term_goals[x]) +\n",
292
+ " ' in the next 2 or 3 years, and my long term goal is to save for a down payment for a house around ' +\n",
293
+ " str(long_term_goals[x]) +\n",
294
+ " ' in the next ten years, can you help me integrate these goals into my budget as well as where I should store these savings?')\n",
295
+ "\n",
296
+ "outputs = []\n",
297
+ "for x in range(len(short_term_goals)):\n",
298
+ " outputs.append(''' 1. Short-Term Goal: $'''+ str(short_term_goals[x]) +''' Vacation (1 Year)\n",
299
+ "Timeline: 12 months\n",
300
+ "Monthly Savings Needed: '''+ str(short_term_goals[x]) + ''' / 12 = '''+ str((short_term_goals[x]/12).round()) +'''\n",
301
+ "\n",
302
+ "Best Storage Option: High-yield savings account (HYSA)\n",
303
+ "Easy access\n",
304
+ "Earns some interest\n",
305
+ "Safe from market fluctuations,\n",
306
+ "\n",
307
+ "2. Medium-Term Goal: $'''+ str(medium_term_goals[x]) +''' Car Down Payment (2–3 Years)\n",
308
+ "Timeline Options:\n",
309
+ "2 years (24 months) → $''' + str((medium_term_goals[x]/24).round()) + '''/month\n",
310
+ "3 years (36 months) → $''' + str((medium_term_goals[x]/36).round()) + '''/month\n",
311
+ "Best Storage Option: HYSA or conservative investment\n",
312
+ "If comfortable with some risk, a mix of HYSA + conservative investments (e.g., CDs, bond ETFs)\n",
313
+ "If risk-averse, keep it in an HYSA,\n",
314
+ "\n",
315
+ "3. Long-Term Goal: $'''+ str(long_term_goals[x]) +''' House Down Payment (10 Years)\n",
316
+ "Timeline: 120 months\n",
317
+ "Monthly Savings Needed: '''+ str(long_term_goals[x]) + ''' / 120 = '''+ str((long_term_goals[x]/120).round()) +''' \n",
318
+ "\n",
319
+ "Best Storage Option: Investment account\n",
320
+ "Given the long time horizon, investing in a mix of index funds (S&P 500, total stock market) + bonds could provide higher returns.\n",
321
+ "Consider Roth IRA (if eligible) or brokerage account to allow tax-efficient growth.\n",
322
+ "\n",
323
+ "Summary of Total Savings Targets:\n",
324
+ "Total Monthly Savings goal = $''' +str(((short_term_goals[x]/12)+(medium_term_goals[x]/36)+(long_term_goals[x]/120)).round()) +''' - $''' +str(((short_term_goals[x]/12)+(medium_term_goals[x]/24)+(long_term_goals[x]/120)).round()) +'''/month'''\n",
325
+ " )\n",
326
+ " \n",
327
+ "df3 = pd.DataFrame({'question':prompts,\n",
328
+ " 'response':outputs})"
329
+ ]
330
+ },
331
+ {
332
+ "cell_type": "code",
333
+ "execution_count": 19,
334
+ "id": "f7f484a6-5cc5-4a77-a474-1fc921095dc2",
335
+ "metadata": {
336
+ "tags": []
337
+ },
338
+ "outputs": [],
339
+ "source": [
340
+ "df3['instruct'] = \"Q: \" + df3['question'] + \"\\n\\nA: \" + \"Lets think step by step.\" + df3['response']\n",
341
+ "df3['question_1'] = \"Q: \" + df3['question'] + \"\\n\\nA: \" + \"Lets think step by step.\" "
342
+ ]
343
+ },
344
+ {
345
+ "cell_type": "code",
346
+ "execution_count": 20,
347
+ "id": "63d3c1cd-943b-41b3-ab4f-85f11510eeca",
348
+ "metadata": {
349
+ "tags": []
350
+ },
351
+ "outputs": [
352
+ {
353
+ "data": {
354
+ "text/html": [
355
+ "<div>\n",
356
+ "<style scoped>\n",
357
+ " .dataframe tbody tr th:only-of-type {\n",
358
+ " vertical-align: middle;\n",
359
+ " }\n",
360
+ "\n",
361
+ " .dataframe tbody tr th {\n",
362
+ " vertical-align: top;\n",
363
+ " }\n",
364
+ "\n",
365
+ " .dataframe thead th {\n",
366
+ " text-align: right;\n",
367
+ " }\n",
368
+ "</style>\n",
369
+ "<table border=\"1\" class=\"dataframe\">\n",
370
+ " <thead>\n",
371
+ " <tr style=\"text-align: right;\">\n",
372
+ " <th></th>\n",
373
+ " <th>question</th>\n",
374
+ " <th>response</th>\n",
375
+ " <th>instruct</th>\n",
376
+ " <th>question_1</th>\n",
377
+ " </tr>\n",
378
+ " </thead>\n",
379
+ " <tbody>\n",
380
+ " <tr>\n",
381
+ " <th>0</th>\n",
382
+ " <td>My short term goal is to save for a $3253 vaca...</td>\n",
383
+ " <td>1. Short-Term Goal: $3253 Vacation (1 Year)\\n...</td>\n",
384
+ " <td>Q: My short term goal is to save for a $3253 v...</td>\n",
385
+ " <td>Q: My short term goal is to save for a $3253 v...</td>\n",
386
+ " </tr>\n",
387
+ " <tr>\n",
388
+ " <th>1</th>\n",
389
+ " <td>My short term goal is to save for a $4137 vaca...</td>\n",
390
+ " <td>1. Short-Term Goal: $4137 Vacation (1 Year)\\n...</td>\n",
391
+ " <td>Q: My short term goal is to save for a $4137 v...</td>\n",
392
+ " <td>Q: My short term goal is to save for a $4137 v...</td>\n",
393
+ " </tr>\n",
394
+ " <tr>\n",
395
+ " <th>2</th>\n",
396
+ " <td>My short term goal is to save for a $4654 vaca...</td>\n",
397
+ " <td>1. Short-Term Goal: $4654 Vacation (1 Year)\\n...</td>\n",
398
+ " <td>Q: My short term goal is to save for a $4654 v...</td>\n",
399
+ " <td>Q: My short term goal is to save for a $4654 v...</td>\n",
400
+ " </tr>\n",
401
+ " <tr>\n",
402
+ " <th>3</th>\n",
403
+ " <td>My short term goal is to save for a $2418 vaca...</td>\n",
404
+ " <td>1. Short-Term Goal: $2418 Vacation (1 Year)\\n...</td>\n",
405
+ " <td>Q: My short term goal is to save for a $2418 v...</td>\n",
406
+ " <td>Q: My short term goal is to save for a $2418 v...</td>\n",
407
+ " </tr>\n",
408
+ " <tr>\n",
409
+ " <th>4</th>\n",
410
+ " <td>My short term goal is to save for a $3447 vaca...</td>\n",
411
+ " <td>1. Short-Term Goal: $3447 Vacation (1 Year)\\n...</td>\n",
412
+ " <td>Q: My short term goal is to save for a $3447 v...</td>\n",
413
+ " <td>Q: My short term goal is to save for a $3447 v...</td>\n",
414
+ " </tr>\n",
415
+ " <tr>\n",
416
+ " <th>5</th>\n",
417
+ " <td>My short term goal is to save for a $3147 vaca...</td>\n",
418
+ " <td>1. Short-Term Goal: $3147 Vacation (1 Year)\\n...</td>\n",
419
+ " <td>Q: My short term goal is to save for a $3147 v...</td>\n",
420
+ " <td>Q: My short term goal is to save for a $3147 v...</td>\n",
421
+ " </tr>\n",
422
+ " <tr>\n",
423
+ " <th>6</th>\n",
424
+ " <td>My short term goal is to save for a $1072 vaca...</td>\n",
425
+ " <td>1. Short-Term Goal: $1072 Vacation (1 Year)\\n...</td>\n",
426
+ " <td>Q: My short term goal is to save for a $1072 v...</td>\n",
427
+ " <td>Q: My short term goal is to save for a $1072 v...</td>\n",
428
+ " </tr>\n",
429
+ " <tr>\n",
430
+ " <th>7</th>\n",
431
+ " <td>My short term goal is to save for a $3169 vaca...</td>\n",
432
+ " <td>1. Short-Term Goal: $3169 Vacation (1 Year)\\n...</td>\n",
433
+ " <td>Q: My short term goal is to save for a $3169 v...</td>\n",
434
+ " <td>Q: My short term goal is to save for a $3169 v...</td>\n",
435
+ " </tr>\n",
436
+ " <tr>\n",
437
+ " <th>8</th>\n",
438
+ " <td>My short term goal is to save for a $4985 vaca...</td>\n",
439
+ " <td>1. Short-Term Goal: $4985 Vacation (1 Year)\\n...</td>\n",
440
+ " <td>Q: My short term goal is to save for a $4985 v...</td>\n",
441
+ " <td>Q: My short term goal is to save for a $4985 v...</td>\n",
442
+ " </tr>\n",
443
+ " <tr>\n",
444
+ " <th>9</th>\n",
445
+ " <td>My short term goal is to save for a $3722 vaca...</td>\n",
446
+ " <td>1. Short-Term Goal: $3722 Vacation (1 Year)\\n...</td>\n",
447
+ " <td>Q: My short term goal is to save for a $3722 v...</td>\n",
448
+ " <td>Q: My short term goal is to save for a $3722 v...</td>\n",
449
+ " </tr>\n",
450
+ " </tbody>\n",
451
+ "</table>\n",
452
+ "</div>"
453
+ ],
454
+ "text/plain": [
455
+ " question \\\n",
456
+ "0 My short term goal is to save for a $3253 vaca... \n",
457
+ "1 My short term goal is to save for a $4137 vaca... \n",
458
+ "2 My short term goal is to save for a $4654 vaca... \n",
459
+ "3 My short term goal is to save for a $2418 vaca... \n",
460
+ "4 My short term goal is to save for a $3447 vaca... \n",
461
+ "5 My short term goal is to save for a $3147 vaca... \n",
462
+ "6 My short term goal is to save for a $1072 vaca... \n",
463
+ "7 My short term goal is to save for a $3169 vaca... \n",
464
+ "8 My short term goal is to save for a $4985 vaca... \n",
465
+ "9 My short term goal is to save for a $3722 vaca... \n",
466
+ "\n",
467
+ " response \\\n",
468
+ "0 1. Short-Term Goal: $3253 Vacation (1 Year)\\n... \n",
469
+ "1 1. Short-Term Goal: $4137 Vacation (1 Year)\\n... \n",
470
+ "2 1. Short-Term Goal: $4654 Vacation (1 Year)\\n... \n",
471
+ "3 1. Short-Term Goal: $2418 Vacation (1 Year)\\n... \n",
472
+ "4 1. Short-Term Goal: $3447 Vacation (1 Year)\\n... \n",
473
+ "5 1. Short-Term Goal: $3147 Vacation (1 Year)\\n... \n",
474
+ "6 1. Short-Term Goal: $1072 Vacation (1 Year)\\n... \n",
475
+ "7 1. Short-Term Goal: $3169 Vacation (1 Year)\\n... \n",
476
+ "8 1. Short-Term Goal: $4985 Vacation (1 Year)\\n... \n",
477
+ "9 1. Short-Term Goal: $3722 Vacation (1 Year)\\n... \n",
478
+ "\n",
479
+ " instruct \\\n",
480
+ "0 Q: My short term goal is to save for a $3253 v... \n",
481
+ "1 Q: My short term goal is to save for a $4137 v... \n",
482
+ "2 Q: My short term goal is to save for a $4654 v... \n",
483
+ "3 Q: My short term goal is to save for a $2418 v... \n",
484
+ "4 Q: My short term goal is to save for a $3447 v... \n",
485
+ "5 Q: My short term goal is to save for a $3147 v... \n",
486
+ "6 Q: My short term goal is to save for a $1072 v... \n",
487
+ "7 Q: My short term goal is to save for a $3169 v... \n",
488
+ "8 Q: My short term goal is to save for a $4985 v... \n",
489
+ "9 Q: My short term goal is to save for a $3722 v... \n",
490
+ "\n",
491
+ " question_1 \n",
492
+ "0 Q: My short term goal is to save for a $3253 v... \n",
493
+ "1 Q: My short term goal is to save for a $4137 v... \n",
494
+ "2 Q: My short term goal is to save for a $4654 v... \n",
495
+ "3 Q: My short term goal is to save for a $2418 v... \n",
496
+ "4 Q: My short term goal is to save for a $3447 v... \n",
497
+ "5 Q: My short term goal is to save for a $3147 v... \n",
498
+ "6 Q: My short term goal is to save for a $1072 v... \n",
499
+ "7 Q: My short term goal is to save for a $3169 v... \n",
500
+ "8 Q: My short term goal is to save for a $4985 v... \n",
501
+ "9 Q: My short term goal is to save for a $3722 v... "
502
+ ]
503
+ },
504
+ "execution_count": 20,
505
+ "metadata": {},
506
+ "output_type": "execute_result"
507
+ }
508
+ ],
509
+ "source": [
510
+ "df3.head(10)"
511
+ ]
512
+ },
513
+ {
514
+ "cell_type": "code",
515
+ "execution_count": 21,
516
+ "id": "2a4deb48-724f-46a4-8e55-4e41f648af6e",
517
+ "metadata": {
518
+ "tags": []
519
+ },
520
+ "outputs": [],
521
+ "source": [
522
+ "df3.to_csv('goals_dataset.csv', index=False)\n"
523
+ ]
524
+ },
525
+ {
526
+ "cell_type": "code",
527
+ "execution_count": null,
528
+ "id": "313cd80a-c7be-489c-9c70-30885c7e614a",
529
+ "metadata": {},
530
+ "outputs": [],
531
+ "source": []
532
+ },
533
+ {
534
+ "cell_type": "code",
535
+ "execution_count": null,
536
+ "id": "20de1e90-1c13-486a-b5db-09c957622a69",
537
+ "metadata": {},
538
+ "outputs": [],
539
+ "source": []
540
+ }
541
+ ],
542
+ "metadata": {
543
+ "kernelspec": {
544
+ "display_name": "llm_course_2",
545
+ "language": "python",
546
+ "name": "llm_course_2"
547
+ },
548
+ "language_info": {
549
+ "codemirror_mode": {
550
+ "name": "ipython",
551
+ "version": 3
552
+ },
553
+ "file_extension": ".py",
554
+ "mimetype": "text/x-python",
555
+ "name": "python",
556
+ "nbconvert_exporter": "python",
557
+ "pygments_lexer": "ipython3",
558
+ "version": "3.11.11"
559
+ }
560
+ },
561
+ "nbformat": 4,
562
+ "nbformat_minor": 5
563
+ }
Project_benchmarking.ipynb ADDED
@@ -0,0 +1,1773 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "ed4a9148-55d8-483f-888d-9939a06873f9",
7
+ "metadata": {
8
+ "tags": []
9
+ },
10
+ "outputs": [],
11
+ "source": [
12
+ "import os\n",
13
+ "os.environ['HF_HOME'] = \"/scratch/tar3kh/models/cache\"\n",
14
+ "import torch \n",
15
+ "from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline\n",
16
+ "from datasets import load_dataset #datasets is huggingface's dataset package\n",
17
+ "from peft import get_peft_model, LoraConfig, TaskType\n",
18
+ "import matplotlib.pyplot as plt\n",
19
+ "import numpy as np\n",
20
+ "import pandas as pd\n",
21
+ "import PIL\n",
22
+ "\n",
23
+ "import lm_eval"
24
+ ]
25
+ },
26
+ {
27
+ "cell_type": "code",
28
+ "execution_count": 2,
29
+ "id": "74f6aba0-fb07-4ba6-b3d5-f63900b3e4f5",
30
+ "metadata": {
31
+ "tags": []
32
+ },
33
+ "outputs": [
34
+ {
35
+ "data": {
36
+ "application/vnd.jupyter.widget-view+json": {
37
+ "model_id": "1731e4705d734f3b9f1cab292fcbc9fd",
38
+ "version_major": 2,
39
+ "version_minor": 0
40
+ },
41
+ "text/plain": [
42
+ "Loading checkpoint shards: 0%| | 0/2 [00:00<?, ?it/s]"
43
+ ]
44
+ },
45
+ "metadata": {},
46
+ "output_type": "display_data"
47
+ }
48
+ ],
49
+ "source": [
50
+ "tokenizer = AutoTokenizer.from_pretrained(\"meta-llama/Llama-3.2-3B-Instruct\")\n",
51
+ "model = AutoModelForCausalLM.from_pretrained(\"meta-llama/Llama-3.2-3B-Instruct\", device_map = \"auto\", torch_dtype = torch.bfloat16)"
52
+ ]
53
+ },
54
+ {
55
+ "cell_type": "code",
56
+ "execution_count": 3,
57
+ "id": "0cb7397c-bcbe-4637-b973-1d98873d0f8a",
58
+ "metadata": {
59
+ "tags": []
60
+ },
61
+ "outputs": [],
62
+ "source": [
63
+ "task_manager = lm_eval.tasks.TaskManager()"
64
+ ]
65
+ },
66
+ {
67
+ "cell_type": "code",
68
+ "execution_count": 4,
69
+ "id": "9ae14b7a-81bb-494c-856c-fa3f3ff0b1f0",
70
+ "metadata": {
71
+ "tags": []
72
+ },
73
+ "outputs": [
74
+ {
75
+ "name": "stderr",
76
+ "output_type": "stream",
77
+ "text": [
78
+ "`pretrained` model kwarg is not of type `str`. Many other model arguments may be ignored. Please do not launch via accelerate or use `parallelize=True` if passing an existing model this way.\n",
79
+ "Passed an already-initialized model through `pretrained`, assuming single-process call to evaluate() or custom distributed integration\n",
80
+ "100%|██████████| 30/30 [00:00<00:00, 629.43it/s]\n",
81
+ "100%|██████████| 30/30 [00:00<00:00, 633.84it/s]\n",
82
+ "100%|██████████| 30/30 [00:00<00:00, 633.37it/s]\n",
83
+ "100%|██████████| 30/30 [00:00<00:00, 623.71it/s]\n",
84
+ "100%|██████████| 30/30 [00:00<00:00, 630.66it/s]\n",
85
+ "100%|██████████| 30/30 [00:00<00:00, 638.69it/s]\n",
86
+ "100%|██████████| 30/30 [00:00<00:00, 624.79it/s]\n",
87
+ "100%|██████████| 30/30 [00:00<00:00, 641.17it/s]\n",
88
+ "100%|██████████| 30/30 [00:00<00:00, 642.51it/s]\n",
89
+ "100%|██████████| 30/30 [00:00<00:00, 642.24it/s]\n",
90
+ "100%|██████████| 30/30 [00:00<00:00, 640.21it/s]\n",
91
+ "100%|██████████| 30/30 [00:00<00:00, 639.55it/s]\n",
92
+ "100%|██████████| 30/30 [00:00<00:00, 639.32it/s]\n",
93
+ "100%|██████████| 30/30 [00:00<00:00, 646.81it/s]\n",
94
+ "100%|██████████| 30/30 [00:00<00:00, 626.84it/s]\n",
95
+ "100%|██████████| 30/30 [00:00<00:00, 308.57it/s]\n",
96
+ "100%|██████████| 30/30 [00:00<00:00, 379.50it/s]\n",
97
+ "100%|██████████| 30/30 [00:00<00:00, 631.24it/s]\n",
98
+ "100%|██████████| 30/30 [00:00<00:00, 635.51it/s]\n",
99
+ "100%|██████████| 30/30 [00:00<00:00, 644.93it/s]\n",
100
+ "100%|██████████| 30/30 [00:00<00:00, 639.68it/s]\n",
101
+ "100%|██████████| 30/30 [00:00<00:00, 644.05it/s]\n",
102
+ "100%|██████████| 30/30 [00:00<00:00, 102.55it/s]\n",
103
+ "100%|██████████| 30/30 [00:00<00:00, 624.02it/s]\n",
104
+ "100%|██████████| 30/30 [00:00<00:00, 628.20it/s]\n",
105
+ "100%|██████████| 30/30 [00:00<00:00, 627.93it/s]\n",
106
+ "100%|██████████| 30/30 [00:00<00:00, 627.78it/s]\n",
107
+ "100%|██████████| 30/30 [00:00<00:00, 491.80it/s]\n",
108
+ "100%|██████████| 30/30 [00:00<00:00, 619.18it/s]\n",
109
+ "100%|██████████| 30/30 [00:00<00:00, 637.35it/s]\n",
110
+ "100%|██████████| 30/30 [00:00<00:00, 632.35it/s]\n",
111
+ "100%|██████████| 30/30 [00:00<00:00, 633.64it/s]\n",
112
+ "100%|██████████| 30/30 [00:00<00:00, 642.34it/s]\n",
113
+ "100%|██████████| 30/30 [00:00<00:00, 640.85it/s]\n",
114
+ "100%|██████████| 30/30 [00:00<00:00, 615.70it/s]\n",
115
+ "100%|██████████| 30/30 [00:00<00:00, 636.56it/s]\n",
116
+ "100%|██████████| 30/30 [00:00<00:00, 629.97it/s]\n",
117
+ "100%|██████████| 30/30 [00:00<00:00, 626.97it/s]\n",
118
+ "100%|██████████| 30/30 [00:00<00:00, 633.91it/s]\n",
119
+ "100%|██████████| 30/30 [00:00<00:00, 643.70it/s]\n",
120
+ "100%|██████████| 30/30 [00:00<00:00, 629.93it/s]\n",
121
+ "100%|██████████| 30/30 [00:00<00:00, 635.28it/s]\n",
122
+ "100%|██████████| 30/30 [00:00<00:00, 634.87it/s]\n",
123
+ "100%|██████████| 30/30 [00:00<00:00, 645.25it/s]\n",
124
+ "100%|██████████| 30/30 [00:00<00:00, 638.43it/s]\n",
125
+ "100%|██████████| 30/30 [00:00<00:00, 645.74it/s]\n",
126
+ "100%|██████████| 30/30 [00:00<00:00, 624.12it/s]\n",
127
+ "100%|██████████| 30/30 [00:00<00:00, 642.42it/s]\n",
128
+ "100%|██████████| 30/30 [00:00<00:00, 636.23it/s]\n",
129
+ "100%|██████████| 30/30 [00:00<00:00, 627.26it/s]\n",
130
+ "100%|██████████| 30/30 [00:00<00:00, 643.17it/s]\n",
131
+ "100%|██████████| 30/30 [00:00<00:00, 636.89it/s]\n",
132
+ "100%|██████████| 30/30 [00:00<00:00, 641.15it/s]\n",
133
+ "100%|██████████| 30/30 [00:00<00:00, 639.27it/s]\n",
134
+ "100%|██████████| 30/30 [00:00<00:00, 637.52it/s]\n",
135
+ "100%|██████████| 30/30 [00:00<00:00, 634.23it/s]\n",
136
+ "100%|██████████| 30/30 [00:00<00:00, 639.96it/s]\n",
137
+ "100%|██████████| 30/30 [00:00<00:00, 69.18it/s]\n",
138
+ "Running loglikelihood requests: 100%|██████████| 6840/6840 [01:08<00:00, 99.56it/s] \n",
139
+ "Running generate_until requests: 0%| | 0/30 [00:00<?, ?it/s]/scratch/tar3kh/llm_course_2/lib/python3.11/site-packages/transformers/generation/configuration_utils.py:631: UserWarning: `do_sample` is set to `False`. However, `temperature` is set to `0.6` -- this flag is only used in sample-based generation modes. You should set `do_sample=True` or unset `temperature`.\n",
140
+ " warnings.warn(\n",
141
+ "/scratch/tar3kh/llm_course_2/lib/python3.11/site-packages/transformers/generation/configuration_utils.py:636: UserWarning: `do_sample` is set to `False`. However, `top_p` is set to `0.9` -- this flag is only used in sample-based generation modes. You should set `do_sample=True` or unset `top_p`.\n",
142
+ " warnings.warn(\n",
143
+ "Running generate_until requests: 100%|██████████| 30/30 [01:49<00:00, 3.66s/it]\n",
144
+ "fatal: not a git repository (or any parent up to mount point /sfs/gpfs)\n",
145
+ "Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).\n"
146
+ ]
147
+ }
148
+ ],
149
+ "source": [
150
+ "\n",
151
+ "results = lm_eval.simple_evaluate(\n",
152
+ " model = 'hf',\n",
153
+ " model_args = {\"pretrained\": model, \"dtype\": \"bfloat16\", \"toeknzier\": tokenizer},\n",
154
+ " tasks = ['gsm8k_cot', 'mmlu'],\n",
155
+ " task_manager = task_manager,\n",
156
+ " log_samples = True, \n",
157
+ " batch_size = \"1\", \n",
158
+ " limit = 30, \n",
159
+ " random_seed = 42)"
160
+ ]
161
+ },
162
+ {
163
+ "cell_type": "code",
164
+ "execution_count": 5,
165
+ "id": "f753cc30-d67e-4185-9d41-e56eaafa5dc8",
166
+ "metadata": {
167
+ "tags": []
168
+ },
169
+ "outputs": [
170
+ {
171
+ "data": {
172
+ "text/plain": [
173
+ "{'gsm8k_cot': {'alias': 'gsm8k_cot',\n",
174
+ " 'exact_match,strict-match': np.float64(0.5),\n",
175
+ " 'exact_match_stderr,strict-match': 0.09284766908852593,\n",
176
+ " 'exact_match,flexible-extract': np.float64(0.5),\n",
177
+ " 'exact_match_stderr,flexible-extract': 0.09284766908852593},\n",
178
+ " 'mmlu': {'acc,none': 0.6111111111111112,\n",
179
+ " 'acc_stderr,none': np.float64(0.011219896029746483),\n",
180
+ " 'alias': 'mmlu'},\n",
181
+ " 'mmlu_humanities': {'acc,none': 0.6435897435897436,\n",
182
+ " 'acc_stderr,none': np.float64(0.02350521124512561),\n",
183
+ " 'alias': ' - humanities'},\n",
184
+ " 'mmlu_formal_logic': {'alias': ' - formal_logic',\n",
185
+ " 'acc,none': 0.3,\n",
186
+ " 'acc_stderr,none': 0.0850962943396763},\n",
187
+ " 'mmlu_high_school_european_history': {'alias': ' - high_school_european_history',\n",
188
+ " 'acc,none': 0.6666666666666666,\n",
189
+ " 'acc_stderr,none': 0.08753762190648169},\n",
190
+ " 'mmlu_high_school_us_history': {'alias': ' - high_school_us_history',\n",
191
+ " 'acc,none': 0.6333333333333333,\n",
192
+ " 'acc_stderr,none': 0.08948554539839962},\n",
193
+ " 'mmlu_high_school_world_history': {'alias': ' - high_school_world_history',\n",
194
+ " 'acc,none': 0.8,\n",
195
+ " 'acc_stderr,none': 0.07427813527082075},\n",
196
+ " 'mmlu_international_law': {'alias': ' - international_law',\n",
197
+ " 'acc,none': 0.8333333333333334,\n",
198
+ " 'acc_stderr,none': 0.06920456654478331},\n",
199
+ " 'mmlu_jurisprudence': {'alias': ' - jurisprudence',\n",
200
+ " 'acc,none': 0.7,\n",
201
+ " 'acc_stderr,none': 0.0850962943396763},\n",
202
+ " 'mmlu_logical_fallacies': {'alias': ' - logical_fallacies',\n",
203
+ " 'acc,none': 0.6666666666666666,\n",
204
+ " 'acc_stderr,none': 0.08753762190648169},\n",
205
+ " 'mmlu_moral_disputes': {'alias': ' - moral_disputes',\n",
206
+ " 'acc,none': 0.5666666666666667,\n",
207
+ " 'acc_stderr,none': 0.0920186554465537},\n",
208
+ " 'mmlu_moral_scenarios': {'alias': ' - moral_scenarios',\n",
209
+ " 'acc,none': 0.6333333333333333,\n",
210
+ " 'acc_stderr,none': 0.08948554539839962},\n",
211
+ " 'mmlu_philosophy': {'alias': ' - philosophy',\n",
212
+ " 'acc,none': 0.7,\n",
213
+ " 'acc_stderr,none': 0.08509629433967632},\n",
214
+ " 'mmlu_prehistory': {'alias': ' - prehistory',\n",
215
+ " 'acc,none': 0.6,\n",
216
+ " 'acc_stderr,none': 0.09097176522946843},\n",
217
+ " 'mmlu_professional_law': {'alias': ' - professional_law',\n",
218
+ " 'acc,none': 0.43333333333333335,\n",
219
+ " 'acc_stderr,none': 0.0920186554465537},\n",
220
+ " 'mmlu_world_religions': {'alias': ' - world_religions',\n",
221
+ " 'acc,none': 0.8333333333333334,\n",
222
+ " 'acc_stderr,none': 0.06920456654478328},\n",
223
+ " 'mmlu_other': {'acc,none': 0.6538461538461539,\n",
224
+ " 'acc_stderr,none': np.float64(0.02283992657168969),\n",
225
+ " 'alias': ' - other'},\n",
226
+ " 'mmlu_business_ethics': {'alias': ' - business_ethics',\n",
227
+ " 'acc,none': 0.7333333333333333,\n",
228
+ " 'acc_stderr,none': 0.08211756827352532},\n",
229
+ " 'mmlu_clinical_knowledge': {'alias': ' - clinical_knowledge',\n",
230
+ " 'acc,none': 0.6,\n",
231
+ " 'acc_stderr,none': 0.09097176522946843},\n",
232
+ " 'mmlu_college_medicine': {'alias': ' - college_medicine',\n",
233
+ " 'acc,none': 0.6666666666666666,\n",
234
+ " 'acc_stderr,none': 0.08753762190648168},\n",
235
+ " 'mmlu_global_facts': {'alias': ' - global_facts',\n",
236
+ " 'acc,none': 0.3333333333333333,\n",
237
+ " 'acc_stderr,none': 0.08753762190648168},\n",
238
+ " 'mmlu_human_aging': {'alias': ' - human_aging',\n",
239
+ " 'acc,none': 0.4666666666666667,\n",
240
+ " 'acc_stderr,none': 0.09264111117062017},\n",
241
+ " 'mmlu_management': {'alias': ' - management',\n",
242
+ " 'acc,none': 0.8,\n",
243
+ " 'acc_stderr,none': 0.07427813527082075},\n",
244
+ " 'mmlu_marketing': {'alias': ' - marketing',\n",
245
+ " 'acc,none': 0.9333333333333333,\n",
246
+ " 'acc_stderr,none': 0.046320555585310084},\n",
247
+ " 'mmlu_medical_genetics': {'alias': ' - medical_genetics',\n",
248
+ " 'acc,none': 0.7666666666666667,\n",
249
+ " 'acc_stderr,none': 0.0785403232453173},\n",
250
+ " 'mmlu_miscellaneous': {'alias': ' - miscellaneous',\n",
251
+ " 'acc,none': 0.8333333333333334,\n",
252
+ " 'acc_stderr,none': 0.06920456654478328},\n",
253
+ " 'mmlu_nutrition': {'alias': ' - nutrition',\n",
254
+ " 'acc,none': 0.8333333333333334,\n",
255
+ " 'acc_stderr,none': 0.06920456654478331},\n",
256
+ " 'mmlu_professional_accounting': {'alias': ' - professional_accounting',\n",
257
+ " 'acc,none': 0.5,\n",
258
+ " 'acc_stderr,none': 0.09284766908852593},\n",
259
+ " 'mmlu_professional_medicine': {'alias': ' - professional_medicine',\n",
260
+ " 'acc,none': 0.5333333333333333,\n",
261
+ " 'acc_stderr,none': 0.09264111117062017},\n",
262
+ " 'mmlu_virology': {'alias': ' - virology',\n",
263
+ " 'acc,none': 0.5,\n",
264
+ " 'acc_stderr,none': 0.09284766908852593},\n",
265
+ " 'mmlu_social_sciences': {'acc,none': 0.6805555555555556,\n",
266
+ " 'acc_stderr,none': np.float64(0.024243558039781773),\n",
267
+ " 'alias': ' - social sciences'},\n",
268
+ " 'mmlu_econometrics': {'alias': ' - econometrics',\n",
269
+ " 'acc,none': 0.4,\n",
270
+ " 'acc_stderr,none': 0.09097176522946843},\n",
271
+ " 'mmlu_high_school_geography': {'alias': ' - high_school_geography',\n",
272
+ " 'acc,none': 0.7333333333333333,\n",
273
+ " 'acc_stderr,none': 0.08211756827352532},\n",
274
+ " 'mmlu_high_school_government_and_politics': {'alias': ' - high_school_government_and_politics',\n",
275
+ " 'acc,none': 0.8,\n",
276
+ " 'acc_stderr,none': 0.07427813527082075},\n",
277
+ " 'mmlu_high_school_macroeconomics': {'alias': ' - high_school_macroeconomics',\n",
278
+ " 'acc,none': 0.6,\n",
279
+ " 'acc_stderr,none': 0.09097176522946843},\n",
280
+ " 'mmlu_high_school_microeconomics': {'alias': ' - high_school_microeconomics',\n",
281
+ " 'acc,none': 0.6666666666666666,\n",
282
+ " 'acc_stderr,none': 0.08753762190648169},\n",
283
+ " 'mmlu_high_school_psychology': {'alias': ' - high_school_psychology',\n",
284
+ " 'acc,none': 0.8,\n",
285
+ " 'acc_stderr,none': 0.07427813527082075},\n",
286
+ " 'mmlu_human_sexuality': {'alias': ' - human_sexuality',\n",
287
+ " 'acc,none': 0.6666666666666666,\n",
288
+ " 'acc_stderr,none': 0.08753762190648169},\n",
289
+ " 'mmlu_professional_psychology': {'alias': ' - professional_psychology',\n",
290
+ " 'acc,none': 0.7333333333333333,\n",
291
+ " 'acc_stderr,none': 0.08211756827352529},\n",
292
+ " 'mmlu_public_relations': {'alias': ' - public_relations',\n",
293
+ " 'acc,none': 0.6,\n",
294
+ " 'acc_stderr,none': 0.09097176522946843},\n",
295
+ " 'mmlu_security_studies': {'alias': ' - security_studies',\n",
296
+ " 'acc,none': 0.7666666666666667,\n",
297
+ " 'acc_stderr,none': 0.07854032324531726},\n",
298
+ " 'mmlu_sociology': {'alias': ' - sociology',\n",
299
+ " 'acc,none': 0.6,\n",
300
+ " 'acc_stderr,none': 0.09097176522946843},\n",
301
+ " 'mmlu_us_foreign_policy': {'alias': ' - us_foreign_policy',\n",
302
+ " 'acc,none': 0.8,\n",
303
+ " 'acc_stderr,none': 0.07427813527082075},\n",
304
+ " 'mmlu_stem': {'acc,none': 0.5157894736842106,\n",
305
+ " 'acc_stderr,none': np.float64(0.019891342584452104),\n",
306
+ " 'alias': ' - stem'},\n",
307
+ " 'mmlu_abstract_algebra': {'alias': ' - abstract_algebra',\n",
308
+ " 'acc,none': 0.3333333333333333,\n",
309
+ " 'acc_stderr,none': 0.0875376219064817},\n",
310
+ " 'mmlu_anatomy': {'alias': ' - anatomy',\n",
311
+ " 'acc,none': 0.6333333333333333,\n",
312
+ " 'acc_stderr,none': 0.0894855453983996},\n",
313
+ " 'mmlu_astronomy': {'alias': ' - astronomy',\n",
314
+ " 'acc,none': 0.7666666666666667,\n",
315
+ " 'acc_stderr,none': 0.0785403232453173},\n",
316
+ " 'mmlu_college_biology': {'alias': ' - college_biology',\n",
317
+ " 'acc,none': 0.8,\n",
318
+ " 'acc_stderr,none': 0.07427813527082075},\n",
319
+ " 'mmlu_college_chemistry': {'alias': ' - college_chemistry',\n",
320
+ " 'acc,none': 0.4,\n",
321
+ " 'acc_stderr,none': 0.09097176522946843},\n",
322
+ " 'mmlu_college_computer_science': {'alias': ' - college_computer_science',\n",
323
+ " 'acc,none': 0.43333333333333335,\n",
324
+ " 'acc_stderr,none': 0.0920186554465537},\n",
325
+ " 'mmlu_college_mathematics': {'alias': ' - college_mathematics',\n",
326
+ " 'acc,none': 0.43333333333333335,\n",
327
+ " 'acc_stderr,none': 0.0920186554465537},\n",
328
+ " 'mmlu_college_physics': {'alias': ' - college_physics',\n",
329
+ " 'acc,none': 0.36666666666666664,\n",
330
+ " 'acc_stderr,none': 0.0894855453983996},\n",
331
+ " 'mmlu_computer_security': {'alias': ' - computer_security',\n",
332
+ " 'acc,none': 0.6666666666666666,\n",
333
+ " 'acc_stderr,none': 0.08753762190648168},\n",
334
+ " 'mmlu_conceptual_physics': {'alias': ' - conceptual_physics',\n",
335
+ " 'acc,none': 0.6333333333333333,\n",
336
+ " 'acc_stderr,none': 0.08948554539839962},\n",
337
+ " 'mmlu_electrical_engineering': {'alias': ' - electrical_engineering',\n",
338
+ " 'acc,none': 0.5333333333333333,\n",
339
+ " 'acc_stderr,none': 0.09264111117062017},\n",
340
+ " 'mmlu_elementary_mathematics': {'alias': ' - elementary_mathematics',\n",
341
+ " 'acc,none': 0.3333333333333333,\n",
342
+ " 'acc_stderr,none': 0.0875376219064817},\n",
343
+ " 'mmlu_high_school_biology': {'alias': ' - high_school_biology',\n",
344
+ " 'acc,none': 0.7666666666666667,\n",
345
+ " 'acc_stderr,none': 0.07854032324531729},\n",
346
+ " 'mmlu_high_school_chemistry': {'alias': ' - high_school_chemistry',\n",
347
+ " 'acc,none': 0.5666666666666667,\n",
348
+ " 'acc_stderr,none': 0.0920186554465537},\n",
349
+ " 'mmlu_high_school_computer_science': {'alias': ' - high_school_computer_science',\n",
350
+ " 'acc,none': 0.7666666666666667,\n",
351
+ " 'acc_stderr,none': 0.0785403232453173},\n",
352
+ " 'mmlu_high_school_mathematics': {'alias': ' - high_school_mathematics',\n",
353
+ " 'acc,none': 0.26666666666666666,\n",
354
+ " 'acc_stderr,none': 0.08211756827352526},\n",
355
+ " 'mmlu_high_school_physics': {'alias': ' - high_school_physics',\n",
356
+ " 'acc,none': 0.36666666666666664,\n",
357
+ " 'acc_stderr,none': 0.0894855453983996},\n",
358
+ " 'mmlu_high_school_statistics': {'alias': ' - high_school_statistics',\n",
359
+ " 'acc,none': 0.23333333333333334,\n",
360
+ " 'acc_stderr,none': 0.07854032324531728},\n",
361
+ " 'mmlu_machine_learning': {'alias': ' - machine_learning',\n",
362
+ " 'acc,none': 0.5,\n",
363
+ " 'acc_stderr,none': 0.09284766908852593}}"
364
+ ]
365
+ },
366
+ "execution_count": 5,
367
+ "metadata": {},
368
+ "output_type": "execute_result"
369
+ }
370
+ ],
371
+ "source": [
372
+ "results['results']"
373
+ ]
374
+ },
375
+ {
376
+ "cell_type": "code",
377
+ "execution_count": 6,
378
+ "id": "408c9b77-ddc7-4100-8af3-205da92b8981",
379
+ "metadata": {
380
+ "tags": []
381
+ },
382
+ "outputs": [],
383
+ "source": [
384
+ "# pull in the datasets and prepare them for training\n",
385
+ "\n",
386
+ "budget = pd.read_csv(\"budget_dataset.csv\")\n",
387
+ "goals = pd.read_csv(\"goals_dataset.csv\")\n"
388
+ ]
389
+ },
390
+ {
391
+ "cell_type": "code",
392
+ "execution_count": 7,
393
+ "id": "4d2aac10-2e16-45e5-9c28-ecee34823332",
394
+ "metadata": {
395
+ "tags": []
396
+ },
397
+ "outputs": [],
398
+ "source": [
399
+ "budget['instruct_lora'] = budget.apply(\n",
400
+ " lambda row: f\"Q: {row['question']}\\n\\nA: \",\n",
401
+ " axis=1\n",
402
+ ")\n",
403
+ "\n",
404
+ "goals['instruct_lora'] = goals.apply(\n",
405
+ " lambda row: f\"Q: {row['question']}\\n\\nA: \",\n",
406
+ " axis=1\n",
407
+ ")"
408
+ ]
409
+ },
410
+ {
411
+ "cell_type": "code",
412
+ "execution_count": 8,
413
+ "id": "699a1799-2eb1-4e3d-92fd-d95e608d0a46",
414
+ "metadata": {
415
+ "tags": []
416
+ },
417
+ "outputs": [
418
+ {
419
+ "data": {
420
+ "application/vnd.jupyter.widget-view+json": {
421
+ "model_id": "8228990282024cdcbda7f17c4d8791aa",
422
+ "version_major": 2,
423
+ "version_minor": 0
424
+ },
425
+ "text/plain": [
426
+ "Map: 0%| | 0/2500 [00:00<?, ? examples/s]"
427
+ ]
428
+ },
429
+ "metadata": {},
430
+ "output_type": "display_data"
431
+ },
432
+ {
433
+ "data": {
434
+ "application/vnd.jupyter.widget-view+json": {
435
+ "model_id": "981eeb5a57cb43d4a957db0cec7255fb",
436
+ "version_major": 2,
437
+ "version_minor": 0
438
+ },
439
+ "text/plain": [
440
+ "Map: 0%| | 0/500 [00:00<?, ? examples/s]"
441
+ ]
442
+ },
443
+ "metadata": {},
444
+ "output_type": "display_data"
445
+ }
446
+ ],
447
+ "source": [
448
+ "from datasets import load_dataset, Dataset #datasets is huggingface's dataset package\n",
449
+ "budget = budget.sample(frac = 1, random_state = 42) # randomly shuffle DF\n",
450
+ "train_budget = budget[:2500]\n",
451
+ "val_budget = budget[2500:]\n",
452
+ "train_budget = Dataset.from_pandas(train_budget)\n",
453
+ "val_budget = Dataset.from_pandas(val_budget)\n",
454
+ "train_budget = train_budget.map(lambda samples: tokenizer(samples['instruct']), batched = True)\n",
455
+ "val_budget = val_budget.map(lambda samples: tokenizer(samples['instruct']), batched = True)"
456
+ ]
457
+ },
458
+ {
459
+ "cell_type": "code",
460
+ "execution_count": 9,
461
+ "id": "5771055b-6fd1-4116-8f31-e96bdf6b3f69",
462
+ "metadata": {
463
+ "tags": []
464
+ },
465
+ "outputs": [
466
+ {
467
+ "data": {
468
+ "application/vnd.jupyter.widget-view+json": {
469
+ "model_id": "b17dc4834f3541d2b2a23de0fe014e28",
470
+ "version_major": 2,
471
+ "version_minor": 0
472
+ },
473
+ "text/plain": [
474
+ "Map: 0%| | 0/2500 [00:00<?, ? examples/s]"
475
+ ]
476
+ },
477
+ "metadata": {},
478
+ "output_type": "display_data"
479
+ },
480
+ {
481
+ "data": {
482
+ "application/vnd.jupyter.widget-view+json": {
483
+ "model_id": "6cc811fbe0a94abaab671c32f0078bb6",
484
+ "version_major": 2,
485
+ "version_minor": 0
486
+ },
487
+ "text/plain": [
488
+ "Map: 0%| | 0/500 [00:00<?, ? examples/s]"
489
+ ]
490
+ },
491
+ "metadata": {},
492
+ "output_type": "display_data"
493
+ }
494
+ ],
495
+ "source": [
496
+ "goals = goals.sample(frac = 1, random_state = 42) # randomly shuffle DF\n",
497
+ "train_goals = goals[:2500]\n",
498
+ "val_goals = goals[2500:]\n",
499
+ "train_goals = Dataset.from_pandas(train_goals)\n",
500
+ "val_goals = Dataset.from_pandas(val_goals)\n",
501
+ "train_goals = train_goals.map(lambda samples: tokenizer(samples['instruct']), batched = True)\n",
502
+ "val_goals = val_goals.map(lambda samples: tokenizer(samples['instruct']), batched = True)"
503
+ ]
504
+ },
505
+ {
506
+ "cell_type": "code",
507
+ "execution_count": 10,
508
+ "id": "a36d39f3-6937-47df-b3da-091dbf8df46e",
509
+ "metadata": {},
510
+ "outputs": [],
511
+ "source": [
512
+ "# Prepare the model and tokenizer \n",
513
+ "tokenizer.pad_token = tokenizer.eos_token # set padding token to EOS token\n",
514
+ "model.config.poad_token_id = tokenizer.pad_token_id # set the padding token for model"
515
+ ]
516
+ },
517
+ {
518
+ "cell_type": "code",
519
+ "execution_count": 11,
520
+ "id": "3c846699-fdb9-4c49-aef3-7860cfe80712",
521
+ "metadata": {
522
+ "tags": []
523
+ },
524
+ "outputs": [
525
+ {
526
+ "name": "stderr",
527
+ "output_type": "stream",
528
+ "text": [
529
+ "/scratch/tar3kh/llm_course_2/lib/python3.11/site-packages/transformers/generation/configuration_utils.py:631: UserWarning: `do_sample` is set to `False`. However, `temperature` is set to `0.6` -- this flag is only used in sample-based generation modes. You should set `do_sample=True` or unset `temperature`.\n",
530
+ " warnings.warn(\n",
531
+ "/scratch/tar3kh/llm_course_2/lib/python3.11/site-packages/transformers/generation/configuration_utils.py:636: UserWarning: `do_sample` is set to `False`. However, `top_p` is set to `0.9` -- this flag is only used in sample-based generation modes. You should set `do_sample=True` or unset `top_p`.\n",
532
+ " warnings.warn(\n",
533
+ "The attention mask is not set and cannot be inferred from input because pad token is same as eos token. As a consequence, you may observe unexpected behavior. Please pass your input's `attention_mask` to obtain reliable results.\n"
534
+ ]
535
+ },
536
+ {
537
+ "name": "stdout",
538
+ "output_type": "stream",
539
+ "text": [
540
+ "Q: My short term goal is to save for a $1774 vacation in the next year, my medium term goal is to save for down payment for a new car, around 5227 in the next 2 or 3 years, and my long term goal is to save for a down payment for a house around 151861 in the next ten years, can you help me integrate these goals into my budget as well as where I should store these savings?\n",
541
+ "\n",
542
+ "A: 1. Short-term goal: Saving for a vacation in the next year. Allocate a specific amount each month towards this goal. For example, you can set aside $147 per month for 12 months to reach your goal of $1774. You can use a separate savings account specifically for this goal. Consider opening a high-yield savings account or a money market fund to earn interest on your savings.\n",
543
+ "\n",
544
+ "2. Medium-term goal: Saving for a down payment on a new car in 2-3 years. Allocate a specific amount each month towards this goal. For example, you can set aside $174 per month for 24-36 months to reach your goal of $5227. You can use a separate savings account specifically for this goal. Consider opening a high-yield savings account or a money market fund to earn interest on your savings.\n",
545
+ "\n",
546
+ "3. Long-term goal: Saving for a down payment on a house in 10 years. Allocate a specific amount each month towards this goal. For example, you can set aside $1549 per month for 120 months to reach your goal of $151861. You can use a separate savings account specifically for this goal. Consider opening a high-yield savings account or a money market fund to earn interest on your savings.\n",
547
+ "\n",
548
+ "To integrate these goals into your budget, consider the 50/30/20 rule: Allocate 50% of your income towards necessary expenses (housing, utilities, food, transportation, and minimum payments on debts), 30% towards discretionary spending (entertainment, hobbies, travel), and 20% towards saving and debt repayment. You can adjust this ratio based on your individual circumstances.\n",
549
+ "\n",
550
+ "To store these savings, consider the following options:\n",
551
+ "\n",
552
+ "* High-yield savings account: Earns interest on your savings and is FDIC-insured, making it a low-risk option.\n",
553
+ "* Money market fund: Earns interest on your savings and provides liquidity, making it a good option for short-term goals.\n",
554
+ "* Certificates of Deposit (CDs): Earns interest on your savings and provides a fixed return, but you'll need to keep your money locked in the CD for a specified period.\n",
555
+ "* Individual Retirement Account (IRA): A tax-advantaged account that can be used for long-term savings, but may have penalties for early withdrawal.\n",
556
+ "\n",
557
+ "It's essential to review and adjust your budget regularly to ensure you're on track to meet your goals. Consider consulting with a financial advisor to create a personalized plan tailored to your needs and goals.\n"
558
+ ]
559
+ }
560
+ ],
561
+ "source": [
562
+ "formatted_prompt = f\"Q: {val_goals[0]['question']}\\n\\nA: \"\n",
563
+ "inputs = tokenizer.encode(formatted_prompt, return_tensors = \"pt\").to(model.device)\n",
564
+ "output = model.generate(inputs, max_new_tokens = 800, pad_token_id = tokenizer.pad_token_id, do_sample = False)\n",
565
+ "generated_text = tokenizer.decode(output[0], skip_special_tokens = True)\n",
566
+ "print(generated_text)"
567
+ ]
568
+ },
569
+ {
570
+ "cell_type": "code",
571
+ "execution_count": 12,
572
+ "id": "6e1bd005-9f89-4a0b-ac57-cd8f521037e8",
573
+ "metadata": {
574
+ "tags": []
575
+ },
576
+ "outputs": [
577
+ {
578
+ "name": "stdout",
579
+ "output_type": "stream",
580
+ "text": [
581
+ "Q: I have an income of about 53255 a year and my monthly expenses include 2208 a month in rent and utilities, a 700 car payment, $300 in food, and about 205 a month in other expenses. Using python, can you create for me a budget spreadsheet and export it to excel?\n",
582
+ "\n",
583
+ "A: Here's a Python script that creates a budget spreadsheet and exports it to Excel:\n",
584
+ "\n",
585
+ "```python\n",
586
+ "import pandas as pd\n",
587
+ "\n",
588
+ "# Define your income and expenses\n",
589
+ "income = 53255\n",
590
+ "rent_and_utilities = 2208\n",
591
+ "car_payment = 700\n",
592
+ "food = 300\n",
593
+ "other_expenses = 205\n",
594
+ "\n",
595
+ "# Calculate your total monthly expenses\n",
596
+ "total_expenses = rent_and_utilities + car_payment + food + other_expenses\n",
597
+ "\n",
598
+ "# Create a dictionary to store your income and expenses\n",
599
+ "budget = {\n",
600
+ " 'Income': [income],\n",
601
+ " 'Fixed Expenses': [rent_and_utilities, car_payment, other_expenses],\n",
602
+ " 'Variable Expenses': [food],\n",
603
+ " 'Total Expenses': [total_expenses]\n",
604
+ "}\n",
605
+ "\n",
606
+ "# Create a DataFrame from the dictionary\n",
607
+ "df = pd.DataFrame(budget)\n",
608
+ "\n",
609
+ "# Print the DataFrame\n",
610
+ "print(df)\n",
611
+ "\n",
612
+ "# Export the DataFrame to an Excel file\n",
613
+ "df.to_excel('budget.xlsx', index=False)\n",
614
+ "```\n",
615
+ "\n",
616
+ "This script will create a budget spreadsheet with the following columns:\n",
617
+ "\n",
618
+ "* Income\n",
619
+ "* Fixed Expenses (including rent and utilities, car payment, and other expenses)\n",
620
+ "* Variable Expenses (including food)\n",
621
+ "* Total Expenses\n",
622
+ "\n",
623
+ "The script will also export the DataFrame to an Excel file named `budget.xlsx`.\n",
624
+ "\n",
625
+ "**Example Output:**\n",
626
+ "\n",
627
+ "| Income | Fixed Expenses | Variable Expenses | Total Expenses |\n",
628
+ "| --- | --- | --- | --- |\n",
629
+ "| 53255 | 3208 | 300 | 3508 |\n",
630
+ "\n",
631
+ "**Tips and Variations:**\n",
632
+ "\n",
633
+ "* You can customize the script to include additional income and expenses by adding more columns to the `budget` dictionary and the `df` DataFrame.\n",
634
+ "* You can also use this script as a starting point to create a more detailed budget spreadsheet by adding more columns and rows to the `df` DataFrame.\n",
635
+ "* To make the script more user-friendly, you can add a prompt to ask the user to input their income and expenses, and then use those values to populate the `budget` dictionary and the `df` DataFrame.\n",
636
+ "* To make the script more automated, you can use a scheduling tool like `schedule` to run the script at regular intervals and update the budget spreadsheet accordingly.\n"
637
+ ]
638
+ }
639
+ ],
640
+ "source": [
641
+ "formatted_prompt = f\"Q: {val_budget[0]['question']}\\n\\nA: \"\n",
642
+ "inputs = tokenizer.encode(formatted_prompt, return_tensors = \"pt\").to(model.device)\n",
643
+ "output = model.generate(inputs, max_new_tokens = 800, pad_token_id = tokenizer.pad_token_id, do_sample = False)\n",
644
+ "generated_text = tokenizer.decode(output[0], skip_special_tokens = True)\n",
645
+ "print(generated_text)"
646
+ ]
647
+ },
648
+ {
649
+ "cell_type": "code",
650
+ "execution_count": 13,
651
+ "id": "0ac9a8ce-4fa0-4630-b4d5-2a1fe19029ad",
652
+ "metadata": {
653
+ "tags": []
654
+ },
655
+ "outputs": [],
656
+ "source": [
657
+ "del model\n",
658
+ "torch.cuda.empty_cache()"
659
+ ]
660
+ },
661
+ {
662
+ "cell_type": "code",
663
+ "execution_count": 14,
664
+ "id": "b637a1dc-5de4-434f-a199-488121e4fc92",
665
+ "metadata": {
666
+ "tags": []
667
+ },
668
+ "outputs": [
669
+ {
670
+ "name": "stderr",
671
+ "output_type": "stream",
672
+ "text": [
673
+ "You are using the default legacy behaviour of the <class 'transformers.models.llama.tokenization_llama_fast.LlamaTokenizerFast'>. This is expected, and simply means that the `legacy` (previous) behavior will be used so nothing changes for you. If you want to use the new behaviour, set `legacy=False`. This should only be set if you understand what it means, and thoroughly read the reason why this was added as explained in https://github.com/huggingface/transformers/pull/24565 - if you loaded a llama tokenizer from a GGUF file you can ignore this message.\n"
674
+ ]
675
+ },
676
+ {
677
+ "data": {
678
+ "application/vnd.jupyter.widget-view+json": {
679
+ "model_id": "e7367950b76e48d78fe4ea8adcc11321",
680
+ "version_major": 2,
681
+ "version_minor": 0
682
+ },
683
+ "text/plain": [
684
+ "Loading checkpoint shards: 0%| | 0/4 [00:00<?, ?it/s]"
685
+ ]
686
+ },
687
+ "metadata": {},
688
+ "output_type": "display_data"
689
+ }
690
+ ],
691
+ "source": [
692
+ "tokenizer = AutoTokenizer.from_pretrained(\"mistralai/Ministral-8B-Instruct-2410\")\n",
693
+ "model = AutoModelForCausalLM.from_pretrained(\"mistralai/Ministral-8B-Instruct-2410\", device_map = \"auto\", torch_dtype = torch.bfloat16)"
694
+ ]
695
+ },
696
+ {
697
+ "cell_type": "code",
698
+ "execution_count": 15,
699
+ "id": "ad7349d5-e70d-4684-a85b-9bd937161805",
700
+ "metadata": {},
701
+ "outputs": [],
702
+ "source": [
703
+ "# Prepare the model and tokenizer \n",
704
+ "tokenizer.pad_token = tokenizer.eos_token # set padding token to EOS token\n",
705
+ "model.config.poad_token_id = tokenizer.pad_token_id # set the padding token for model"
706
+ ]
707
+ },
708
+ {
709
+ "cell_type": "code",
710
+ "execution_count": 16,
711
+ "id": "aea53718-1062-41c7-87a9-d96ac3fc13e3",
712
+ "metadata": {
713
+ "tags": []
714
+ },
715
+ "outputs": [
716
+ {
717
+ "name": "stderr",
718
+ "output_type": "stream",
719
+ "text": [
720
+ "`pretrained` model kwarg is not of type `str`. Many other model arguments may be ignored. Please do not launch via accelerate or use `parallelize=True` if passing an existing model this way.\n",
721
+ "Passed an already-initialized model through `pretrained`, assuming single-process call to evaluate() or custom distributed integration\n",
722
+ "100%|██████████| 30/30 [00:00<00:00, 597.42it/s]\n",
723
+ "100%|██████████| 30/30 [00:00<00:00, 624.61it/s]\n",
724
+ "100%|██████████| 30/30 [00:00<00:00, 629.97it/s]\n",
725
+ "100%|██████████| 30/30 [00:00<00:00, 628.70it/s]\n",
726
+ "100%|██████████| 30/30 [00:00<00:00, 632.95it/s]\n",
727
+ "100%|██████████| 30/30 [00:00<00:00, 625.95it/s]\n",
728
+ "100%|██████████| 30/30 [00:00<00:00, 639.59it/s]\n",
729
+ "100%|████���█████| 30/30 [00:00<00:00, 639.62it/s]\n",
730
+ "100%|██████████| 30/30 [00:00<00:00, 632.55it/s]\n",
731
+ "100%|██████████| 30/30 [00:00<00:00, 638.64it/s]\n",
732
+ "100%|██████████| 30/30 [00:00<00:00, 618.78it/s]\n",
733
+ "100%|██████████| 30/30 [00:00<00:00, 633.69it/s]\n",
734
+ "100%|██████████| 30/30 [00:00<00:00, 622.05it/s]\n",
735
+ "100%|██████████| 30/30 [00:00<00:00, 627.75it/s]\n",
736
+ "100%|██████████| 30/30 [00:00<00:00, 446.39it/s]\n",
737
+ "100%|██████████| 30/30 [00:00<00:00, 610.02it/s]\n",
738
+ "100%|██████████| 30/30 [00:00<00:00, 617.17it/s]\n",
739
+ "100%|██████████| 30/30 [00:00<00:00, 622.85it/s]\n",
740
+ "100%|██████████| 30/30 [00:00<00:00, 612.45it/s]\n",
741
+ "100%|██████████| 30/30 [00:00<00:00, 612.01it/s]\n",
742
+ "100%|██████████| 30/30 [00:00<00:00, 621.72it/s]\n",
743
+ "100%|██████████| 30/30 [00:00<00:00, 621.97it/s]\n",
744
+ "100%|██████████| 30/30 [00:00<00:00, 624.63it/s]\n",
745
+ "100%|██████████| 30/30 [00:00<00:00, 626.03it/s]\n",
746
+ "100%|██████████| 30/30 [00:00<00:00, 636.17it/s]\n",
747
+ "100%|██████████| 30/30 [00:00<00:00, 626.13it/s]\n",
748
+ "100%|██████████| 30/30 [00:00<00:00, 626.59it/s]\n",
749
+ "100%|██████████| 30/30 [00:00<00:00, 640.30it/s]\n",
750
+ "100%|██████████| 30/30 [00:00<00:00, 637.37it/s]\n",
751
+ "100%|██████████| 30/30 [00:00<00:00, 639.40it/s]\n",
752
+ "100%|██████████| 30/30 [00:00<00:00, 629.62it/s]\n",
753
+ "100%|██████████| 30/30 [00:00<00:00, 632.29it/s]\n",
754
+ "100%|██████████| 30/30 [00:00<00:00, 452.92it/s]\n",
755
+ "100%|██████████| 30/30 [00:00<00:00, 622.28it/s]\n",
756
+ "100%|██████████| 30/30 [00:00<00:00, 639.87it/s]\n",
757
+ "100%|██████████| 30/30 [00:00<00:00, 624.62it/s]\n",
758
+ "100%|██████████| 30/30 [00:00<00:00, 631.57it/s]\n",
759
+ "100%|██████████| 30/30 [00:00<00:00, 639.24it/s]\n",
760
+ "100%|██████████| 30/30 [00:00<00:00, 637.52it/s]\n",
761
+ "100%|██████████| 30/30 [00:00<00:00, 639.20it/s]\n",
762
+ "100%|██████████| 30/30 [00:00<00:00, 640.64it/s]\n",
763
+ "100%|██████████| 30/30 [00:00<00:00, 629.27it/s]\n",
764
+ "100%|██████████| 30/30 [00:00<00:00, 628.75it/s]\n",
765
+ "100%|██████████| 30/30 [00:00<00:00, 619.60it/s]\n",
766
+ "100%|██████████| 30/30 [00:00<00:00, 638.59it/s]\n",
767
+ "100%|██████████| 30/30 [00:00<00:00, 629.08it/s]\n",
768
+ "100%|██████████| 30/30 [00:00<00:00, 331.37it/s]\n",
769
+ "100%|██████████| 30/30 [00:00<00:00, 287.76it/s]\n",
770
+ "100%|██████████| 30/30 [00:00<00:00, 427.76it/s]\n",
771
+ "100%|██████████| 30/30 [00:00<00:00, 634.93it/s]\n",
772
+ "100%|██████████| 30/30 [00:00<00:00, 621.34it/s]\n",
773
+ "100%|██████████| 30/30 [00:00<00:00, 626.57it/s]\n",
774
+ "100%|██████████| 30/30 [00:00<00:00, 627.44it/s]\n",
775
+ "100%|██████████| 30/30 [00:00<00:00, 619.38it/s]\n",
776
+ "100%|██████████| 30/30 [00:00<00:00, 621.84it/s]\n",
777
+ "100%|██████████| 30/30 [00:00<00:00, 629.56it/s]\n",
778
+ "100%|██████████| 30/30 [00:00<00:00, 623.88it/s]\n",
779
+ "100%|██████████| 30/30 [00:00<00:00, 71.09it/s]\n",
780
+ "Running loglikelihood requests: 100%|██████████| 6840/6840 [01:30<00:00, 75.91it/s]\n",
781
+ "Running generate_until requests: 100%|██████████| 30/30 [02:34<00:00, 5.15s/it]\n",
782
+ "fatal: not a git repository (or any parent up to mount point /sfs/gpfs)\n",
783
+ "Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).\n"
784
+ ]
785
+ }
786
+ ],
787
+ "source": [
788
+ "\n",
789
+ "results2 = lm_eval.simple_evaluate(\n",
790
+ " model = 'hf',\n",
791
+ " model_args = {\"pretrained\": model, \"dtype\": \"bfloat16\", \"toeknzier\": tokenizer},\n",
792
+ " tasks = ['gsm8k_cot', 'mmlu'],\n",
793
+ " task_manager = task_manager,\n",
794
+ " log_samples = True, \n",
795
+ " batch_size = \"1\", \n",
796
+ " limit = 30, \n",
797
+ " random_seed = 42)"
798
+ ]
799
+ },
800
+ {
801
+ "cell_type": "code",
802
+ "execution_count": 17,
803
+ "id": "dd0bd94d-5195-4203-a868-558ea77dfb32",
804
+ "metadata": {
805
+ "tags": []
806
+ },
807
+ "outputs": [
808
+ {
809
+ "data": {
810
+ "text/plain": [
811
+ "{'gsm8k_cot': {'alias': 'gsm8k_cot',\n",
812
+ " 'exact_match,strict-match': np.float64(0.6666666666666666),\n",
813
+ " 'exact_match_stderr,strict-match': 0.08753762190648169,\n",
814
+ " 'exact_match,flexible-extract': np.float64(0.7),\n",
815
+ " 'exact_match_stderr,flexible-extract': 0.0850962943396763},\n",
816
+ " 'mmlu': {'acc,none': 0.6450292397660818,\n",
817
+ " 'acc_stderr,none': np.float64(0.011026946921383438),\n",
818
+ " 'alias': 'mmlu'},\n",
819
+ " 'mmlu_humanities': {'acc,none': 0.6666666666666666,\n",
820
+ " 'acc_stderr,none': np.float64(0.022655549762135505),\n",
821
+ " 'alias': ' - humanities'},\n",
822
+ " 'mmlu_formal_logic': {'alias': ' - formal_logic',\n",
823
+ " 'acc,none': 0.5,\n",
824
+ " 'acc_stderr,none': 0.09284766908852593},\n",
825
+ " 'mmlu_high_school_european_history': {'alias': ' - high_school_european_history',\n",
826
+ " 'acc,none': 0.6333333333333333,\n",
827
+ " 'acc_stderr,none': 0.08948554539839962},\n",
828
+ " 'mmlu_high_school_us_history': {'alias': ' - high_school_us_history',\n",
829
+ " 'acc,none': 0.8,\n",
830
+ " 'acc_stderr,none': 0.07427813527082075},\n",
831
+ " 'mmlu_high_school_world_history': {'alias': ' - high_school_world_history',\n",
832
+ " 'acc,none': 0.8,\n",
833
+ " 'acc_stderr,none': 0.07427813527082075},\n",
834
+ " 'mmlu_international_law': {'alias': ' - international_law',\n",
835
+ " 'acc,none': 0.8666666666666667,\n",
836
+ " 'acc_stderr,none': 0.06312427686319994},\n",
837
+ " 'mmlu_jurisprudence': {'alias': ' - jurisprudence',\n",
838
+ " 'acc,none': 0.7666666666666667,\n",
839
+ " 'acc_stderr,none': 0.07854032324531729},\n",
840
+ " 'mmlu_logical_fallacies': {'alias': ' - logical_fallacies',\n",
841
+ " 'acc,none': 0.8,\n",
842
+ " 'acc_stderr,none': 0.07427813527082075},\n",
843
+ " 'mmlu_moral_disputes': {'alias': ' - moral_disputes',\n",
844
+ " 'acc,none': 0.6,\n",
845
+ " 'acc_stderr,none': 0.09097176522946843},\n",
846
+ " 'mmlu_moral_scenarios': {'alias': ' - moral_scenarios',\n",
847
+ " 'acc,none': 0.26666666666666666,\n",
848
+ " 'acc_stderr,none': 0.0821175682735253},\n",
849
+ " 'mmlu_philosophy': {'alias': ' - philosophy',\n",
850
+ " 'acc,none': 0.7,\n",
851
+ " 'acc_stderr,none': 0.08509629433967632},\n",
852
+ " 'mmlu_prehistory': {'alias': ' - prehistory',\n",
853
+ " 'acc,none': 0.5333333333333333,\n",
854
+ " 'acc_stderr,none': 0.09264111117062017},\n",
855
+ " 'mmlu_professional_law': {'alias': ' - professional_law',\n",
856
+ " 'acc,none': 0.5333333333333333,\n",
857
+ " 'acc_stderr,none': 0.09264111117062017},\n",
858
+ " 'mmlu_world_religions': {'alias': ' - world_religions',\n",
859
+ " 'acc,none': 0.8666666666666667,\n",
860
+ " 'acc_stderr,none': 0.06312427686319991},\n",
861
+ " 'mmlu_other': {'acc,none': 0.6820512820512821,\n",
862
+ " 'acc_stderr,none': np.float64(0.02296366746299997),\n",
863
+ " 'alias': ' - other'},\n",
864
+ " 'mmlu_business_ethics': {'alias': ' - business_ethics',\n",
865
+ " 'acc,none': 0.8,\n",
866
+ " 'acc_stderr,none': 0.07427813527082075},\n",
867
+ " 'mmlu_clinical_knowledge': {'alias': ' - clinical_knowledge',\n",
868
+ " 'acc,none': 0.6,\n",
869
+ " 'acc_stderr,none': 0.09097176522946843},\n",
870
+ " 'mmlu_college_medicine': {'alias': ' - college_medicine',\n",
871
+ " 'acc,none': 0.6,\n",
872
+ " 'acc_stderr,none': 0.09097176522946843},\n",
873
+ " 'mmlu_global_facts': {'alias': ' - global_facts',\n",
874
+ " 'acc,none': 0.43333333333333335,\n",
875
+ " 'acc_stderr,none': 0.0920186554465537},\n",
876
+ " 'mmlu_human_aging': {'alias': ' - human_aging',\n",
877
+ " 'acc,none': 0.6333333333333333,\n",
878
+ " 'acc_stderr,none': 0.08948554539839962},\n",
879
+ " 'mmlu_management': {'alias': ' - management',\n",
880
+ " 'acc,none': 0.7333333333333333,\n",
881
+ " 'acc_stderr,none': 0.0821175682735253},\n",
882
+ " 'mmlu_marketing': {'alias': ' - marketing',\n",
883
+ " 'acc,none': 0.8666666666666667,\n",
884
+ " 'acc_stderr,none': 0.06312427686319994},\n",
885
+ " 'mmlu_medical_genetics': {'alias': ' - medical_genetics',\n",
886
+ " 'acc,none': 0.7666666666666667,\n",
887
+ " 'acc_stderr,none': 0.0785403232453173},\n",
888
+ " 'mmlu_miscellaneous': {'alias': ' - miscellaneous',\n",
889
+ " 'acc,none': 0.8,\n",
890
+ " 'acc_stderr,none': 0.07427813527082075},\n",
891
+ " 'mmlu_nutrition': {'alias': ' - nutrition',\n",
892
+ " 'acc,none': 0.9,\n",
893
+ " 'acc_stderr,none': 0.055708601453115535},\n",
894
+ " 'mmlu_professional_accounting': {'alias': ' - professional_accounting',\n",
895
+ " 'acc,none': 0.5666666666666667,\n",
896
+ " 'acc_stderr,none': 0.0920186554465537},\n",
897
+ " 'mmlu_professional_medicine': {'alias': ' - professional_medicine',\n",
898
+ " 'acc,none': 0.6333333333333333,\n",
899
+ " 'acc_stderr,none': 0.08948554539839962},\n",
900
+ " 'mmlu_virology': {'alias': ' - virology',\n",
901
+ " 'acc,none': 0.5333333333333333,\n",
902
+ " 'acc_stderr,none': 0.09264111117062017},\n",
903
+ " 'mmlu_social_sciences': {'acc,none': 0.7166666666666667,\n",
904
+ " 'acc_stderr,none': np.float64(0.023102765218675773),\n",
905
+ " 'alias': ' - social sciences'},\n",
906
+ " 'mmlu_econometrics': {'alias': ' - econometrics',\n",
907
+ " 'acc,none': 0.43333333333333335,\n",
908
+ " 'acc_stderr,none': 0.0920186554465537},\n",
909
+ " 'mmlu_high_school_geography': {'alias': ' - high_school_geography',\n",
910
+ " 'acc,none': 0.7666666666666667,\n",
911
+ " 'acc_stderr,none': 0.07854032324531726},\n",
912
+ " 'mmlu_high_school_government_and_politics': {'alias': ' - high_school_government_and_politics',\n",
913
+ " 'acc,none': 0.8666666666666667,\n",
914
+ " 'acc_stderr,none': 0.06312427686319991},\n",
915
+ " 'mmlu_high_school_macroeconomics': {'alias': ' - high_school_macroeconomics',\n",
916
+ " 'acc,none': 0.5333333333333333,\n",
917
+ " 'acc_stderr,none': 0.09264111117062017},\n",
918
+ " 'mmlu_high_school_microeconomics': {'alias': ' - high_school_microeconomics',\n",
919
+ " 'acc,none': 0.7333333333333333,\n",
920
+ " 'acc_stderr,none': 0.08211756827352532},\n",
921
+ " 'mmlu_high_school_psychology': {'alias': ' - high_school_psychology',\n",
922
+ " 'acc,none': 0.7333333333333333,\n",
923
+ " 'acc_stderr,none': 0.0821175682735253},\n",
924
+ " 'mmlu_human_sexuality': {'alias': ' - human_sexuality',\n",
925
+ " 'acc,none': 0.8333333333333334,\n",
926
+ " 'acc_stderr,none': 0.06920456654478331},\n",
927
+ " 'mmlu_professional_psychology': {'alias': ' - professional_psychology',\n",
928
+ " 'acc,none': 0.7,\n",
929
+ " 'acc_stderr,none': 0.08509629433967632},\n",
930
+ " 'mmlu_public_relations': {'alias': ' - public_relations',\n",
931
+ " 'acc,none': 0.6,\n",
932
+ " 'acc_stderr,none': 0.09097176522946843},\n",
933
+ " 'mmlu_security_studies': {'alias': ' - security_studies',\n",
934
+ " 'acc,none': 0.8,\n",
935
+ " 'acc_stderr,none': 0.07427813527082075},\n",
936
+ " 'mmlu_sociology': {'alias': ' - sociology',\n",
937
+ " 'acc,none': 0.7,\n",
938
+ " 'acc_stderr,none': 0.0850962943396763},\n",
939
+ " 'mmlu_us_foreign_policy': {'alias': ' - us_foreign_policy',\n",
940
+ " 'acc,none': 0.9,\n",
941
+ " 'acc_stderr,none': 0.055708601453115555},\n",
942
+ " 'mmlu_stem': {'acc,none': 0.5596491228070175,\n",
943
+ " 'acc_stderr,none': np.float64(0.019856630503018412),\n",
944
+ " 'alias': ' - stem'},\n",
945
+ " 'mmlu_abstract_algebra': {'alias': ' - abstract_algebra',\n",
946
+ " 'acc,none': 0.4,\n",
947
+ " 'acc_stderr,none': 0.09097176522946843},\n",
948
+ " 'mmlu_anatomy': {'alias': ' - anatomy',\n",
949
+ " 'acc,none': 0.5666666666666667,\n",
950
+ " 'acc_stderr,none': 0.0920186554465537},\n",
951
+ " 'mmlu_astronomy': {'alias': ' - astronomy',\n",
952
+ " 'acc,none': 0.7666666666666667,\n",
953
+ " 'acc_stderr,none': 0.0785403232453173},\n",
954
+ " 'mmlu_college_biology': {'alias': ' - college_biology',\n",
955
+ " 'acc,none': 0.9,\n",
956
+ " 'acc_stderr,none': 0.055708601453115555},\n",
957
+ " 'mmlu_college_chemistry': {'alias': ' - college_chemistry',\n",
958
+ " 'acc,none': 0.4,\n",
959
+ " 'acc_stderr,none': 0.09097176522946843},\n",
960
+ " 'mmlu_college_computer_science': {'alias': ' - college_computer_science',\n",
961
+ " 'acc,none': 0.5666666666666667,\n",
962
+ " 'acc_stderr,none': 0.0920186554465537},\n",
963
+ " 'mmlu_college_mathematics': {'alias': ' - college_mathematics',\n",
964
+ " 'acc,none': 0.4,\n",
965
+ " 'acc_stderr,none': 0.09097176522946843},\n",
966
+ " 'mmlu_college_physics': {'alias': ' - college_physics',\n",
967
+ " 'acc,none': 0.36666666666666664,\n",
968
+ " 'acc_stderr,none': 0.0894855453983996},\n",
969
+ " 'mmlu_computer_security': {'alias': ' - computer_security',\n",
970
+ " 'acc,none': 0.7,\n",
971
+ " 'acc_stderr,none': 0.0850962943396763},\n",
972
+ " 'mmlu_conceptual_physics': {'alias': ' - conceptual_physics',\n",
973
+ " 'acc,none': 0.5333333333333333,\n",
974
+ " 'acc_stderr,none': 0.09264111117062017},\n",
975
+ " 'mmlu_electrical_engineering': {'alias': ' - electrical_engineering',\n",
976
+ " 'acc,none': 0.6,\n",
977
+ " 'acc_stderr,none': 0.09097176522946843},\n",
978
+ " 'mmlu_elementary_mathematics': {'alias': ' - elementary_mathematics',\n",
979
+ " 'acc,none': 0.5,\n",
980
+ " 'acc_stderr,none': 0.09284766908852593},\n",
981
+ " 'mmlu_high_school_biology': {'alias': ' - high_school_biology',\n",
982
+ " 'acc,none': 0.8,\n",
983
+ " 'acc_stderr,none': 0.07427813527082075},\n",
984
+ " 'mmlu_high_school_chemistry': {'alias': ' - high_school_chemistry',\n",
985
+ " 'acc,none': 0.5666666666666667,\n",
986
+ " 'acc_stderr,none': 0.0920186554465537},\n",
987
+ " 'mmlu_high_school_computer_science': {'alias': ' - high_school_computer_science',\n",
988
+ " 'acc,none': 0.8333333333333334,\n",
989
+ " 'acc_stderr,none': 0.06920456654478328},\n",
990
+ " 'mmlu_high_school_mathematics': {'alias': ' - high_school_mathematics',\n",
991
+ " 'acc,none': 0.3,\n",
992
+ " 'acc_stderr,none': 0.0850962943396763},\n",
993
+ " 'mmlu_high_school_physics': {'alias': ' - high_school_physics',\n",
994
+ " 'acc,none': 0.4,\n",
995
+ " 'acc_stderr,none': 0.09097176522946843},\n",
996
+ " 'mmlu_high_school_statistics': {'alias': ' - high_school_statistics',\n",
997
+ " 'acc,none': 0.6333333333333333,\n",
998
+ " 'acc_stderr,none': 0.08948554539839962},\n",
999
+ " 'mmlu_machine_learning': {'alias': ' - machine_learning',\n",
1000
+ " 'acc,none': 0.4,\n",
1001
+ " 'acc_stderr,none': 0.09097176522946843}}"
1002
+ ]
1003
+ },
1004
+ "execution_count": 17,
1005
+ "metadata": {},
1006
+ "output_type": "execute_result"
1007
+ }
1008
+ ],
1009
+ "source": [
1010
+ "results2['results']"
1011
+ ]
1012
+ },
1013
+ {
1014
+ "cell_type": "code",
1015
+ "execution_count": 18,
1016
+ "id": "3220c534-873e-485b-9ce7-6069d64c0510",
1017
+ "metadata": {
1018
+ "tags": []
1019
+ },
1020
+ "outputs": [
1021
+ {
1022
+ "name": "stdout",
1023
+ "output_type": "stream",
1024
+ "text": [
1025
+ "Q: My short term goal is to save for a $1774 vacation in the next year, my medium term goal is to save for down payment for a new car, around 5227 in the next 2 or 3 years, and my long term goal is to save for a down payment for a house around 151861 in the next ten years, can you help me integrate these goals into my budget as well as where I should store these savings?\n",
1026
+ "\n",
1027
+ "A: 1. **Budgeting for Savings:**\n",
1028
+ "\n",
1029
+ " - **Short Term (Vacation):**\n",
1030
+ " - Allocate a specific amount each month towards your vacation fund. For example, if you save $148 per month, you'll reach your goal in 12 months.\n",
1031
+ " - Consider setting up an automatic transfer from your checking account to your savings account each month.\n",
1032
+ "\n",
1033
+ " - **Medium Term (Car Down Payment):**\n",
1034
+ " - Allocate a specific amount each month towards your car down payment. For example, if you save $436 per month, you'll reach your goal in 2 years.\n",
1035
+ " - Consider setting up an automatic transfer from your checking account to your savings account each month.\n",
1036
+ "\n",
1037
+ " - **Long Term (House Down Payment):**\n",
1038
+ " - Allocate a specific amount each month towards your house down payment. For example, if you save $1265 per month, you'll reach your goal in 10 years.\n",
1039
+ " - Consider setting up an automatic transfer from your checking account to your savings account each month.\n",
1040
+ "\n",
1041
+ "2. **Where to Store Your Savings:**\n",
1042
+ "\n",
1043
+ " - **Short Term (Vacation):**\n",
1044
+ " - Consider a high-yield savings account or a money market account. These accounts offer easy access to your funds and typically have no or low fees.\n",
1045
+ "\n",
1046
+ " - **Medium Term (Car Down Payment):**\n",
1047
+ " - Consider a high-yield savings account or a certificate of deposit (CD). CDs offer a fixed interest rate and can be a good option if you don't need to access your funds for a few years.\n",
1048
+ "\n",
1049
+ " - **Long Term (House Down Payment):**\n",
1050
+ " - Consider a high-yield savings account, a CD, or a retirement account like a Roth IRA. If you're eligible, a Roth IRA offers tax-free growth and withdrawals, which can be beneficial for long-term savings.\n",
1051
+ "\n",
1052
+ "3. **Additional Tips:**\n",
1053
+ "\n",
1054
+ " - **Emergency Fund:** Before focusing on your savings goals, ensure you have an emergency fund set aside (ideally 3-6 months' worth of living expenses). This can help protect you from unexpected expenses or job loss.\n",
1055
+ "\n",
1056
+ " - **Review and Adjust:** Regularly review your budget and savings progress. Life changes and unexpected expenses can impact your savings goals, so it's important to stay flexible and adjust your plan as needed.\n",
1057
+ "\n",
1058
+ " - **Increase Your Income:** Consider ways to increase your income, such as taking on a side job, selling unwanted items, or negotiating a raise. This can help you reach your savings goals faster.\n",
1059
+ "\n",
1060
+ " - **Track Your Progress:** Use a budgeting app or spreadsheet to track your savings progress. Seeing your progress can motivate you to stay on track and reach your goals.\n"
1061
+ ]
1062
+ }
1063
+ ],
1064
+ "source": [
1065
+ "formatted_prompt = f\"Q: {val_goals[0]['question']}\\n\\nA: \"\n",
1066
+ "inputs = tokenizer.encode(formatted_prompt, return_tensors = \"pt\").to(model.device)\n",
1067
+ "output = model.generate(inputs, max_new_tokens = 800, pad_token_id = tokenizer.pad_token_id, do_sample = False)\n",
1068
+ "generated_text = tokenizer.decode(output[0], skip_special_tokens = True)\n",
1069
+ "print(generated_text)"
1070
+ ]
1071
+ },
1072
+ {
1073
+ "cell_type": "code",
1074
+ "execution_count": 19,
1075
+ "id": "d9d39064-fe27-40d8-a33a-1193eb145b2a",
1076
+ "metadata": {
1077
+ "tags": []
1078
+ },
1079
+ "outputs": [
1080
+ {
1081
+ "name": "stdout",
1082
+ "output_type": "stream",
1083
+ "text": [
1084
+ "Q: I have an income of about 53255 a year and my monthly expenses include 2208 a month in rent and utilities, a 700 car payment, $300 in food, and about 205 a month in other expenses. Using python, can you create for me a budget spreadsheet and export it to excel?\n",
1085
+ "\n",
1086
+ "A: To create a budget spreadsheet and export it to Excel using Python, you can use the `pandas` library to handle the data and `openpyxl` to write the data to an Excel file. Below is a step-by-step guide and the corresponding Python code to achieve this:\n",
1087
+ "\n",
1088
+ "1. **Install the necessary libraries**:\n",
1089
+ " You need to install `pandas` and `openpyxl` if you haven't already. You can install them using pip:\n",
1090
+ " ```sh\n",
1091
+ " pip install pandas openpyxl\n",
1092
+ " ```\n",
1093
+ "\n",
1094
+ "2. **Create the budget spreadsheet**:\n",
1095
+ " Here's a Python script that creates a budget spreadsheet and exports it to an Excel file:\n",
1096
+ "\n",
1097
+ " ```python\n",
1098
+ " import pandas as pd\n",
1099
+ "\n",
1100
+ " # Define your income and expenses\n",
1101
+ " income = 53255\n",
1102
+ " monthly_expenses = {\n",
1103
+ " 'Rent and Utilities': 2208,\n",
1104
+ " 'Car Payment': 700,\n",
1105
+ " 'Food': 300,\n",
1106
+ " 'Other Expenses': 205\n",
1107
+ " }\n",
1108
+ "\n",
1109
+ " # Calculate monthly income\n",
1110
+ " monthly_income = income / 12\n",
1111
+ "\n",
1112
+ " # Create a DataFrame for the budget\n",
1113
+ " budget_df = pd.DataFrame({\n",
1114
+ " 'Category': ['Income', 'Rent and Utilities', 'Car Payment', 'Food', 'Other Expenses'],\n",
1115
+ " 'Amount': [monthly_income, monthly_expenses['Rent and Utilities'], monthly_expenses['Car Payment'], monthly_expenses['Food'], monthly_expenses['Other Expenses']]\n",
1116
+ " })\n",
1117
+ "\n",
1118
+ " # Calculate total expenses and remaining income\n",
1119
+ " total_expenses = budget_df[budget_df['Category'] != 'Income']['Amount'].sum()\n",
1120
+ " remaining_income = monthly_income - total_expenses\n",
1121
+ "\n",
1122
+ " # Add the remaining income to the DataFrame\n",
1123
+ " budget_df = budget_df.append({'Category': 'Remaining Income', 'Amount': remaining_income}, ignore_index=True)\n",
1124
+ "\n",
1125
+ " # Save the DataFrame to an Excel file\n",
1126
+ " budget_df.to_excel('budget_spreadsheet.xlsx', index=False)\n",
1127
+ "\n",
1128
+ " print(\"Budget spreadsheet has been created and saved as 'budget_spreadsheet.xlsx'\")\n",
1129
+ " ```\n",
1130
+ "\n",
1131
+ "3. **Run the script**:\n",
1132
+ " Save the script to a file, for example, `create_budget.py`, and run it using Python:\n",
1133
+ " ```sh\n",
1134
+ " python create_budget.py\n",
1135
+ " ```\n",
1136
+ "\n",
1137
+ "This script will create a budget spreadsheet with your income and expenses, calculate the remaining income, and save it as `budget_spreadsheet.xlsx` in the same directory where you run the script.\n"
1138
+ ]
1139
+ }
1140
+ ],
1141
+ "source": [
1142
+ "formatted_prompt = f\"Q: {val_budget[0]['question']}\\n\\nA: \"\n",
1143
+ "inputs = tokenizer.encode(formatted_prompt, return_tensors = \"pt\").to(model.device)\n",
1144
+ "output = model.generate(inputs, max_new_tokens = 800, pad_token_id = tokenizer.pad_token_id, do_sample = False)\n",
1145
+ "generated_text = tokenizer.decode(output[0], skip_special_tokens = True)\n",
1146
+ "print(generated_text)"
1147
+ ]
1148
+ },
1149
+ {
1150
+ "cell_type": "markdown",
1151
+ "id": "90674e69-a32d-4e2c-b97c-fbae5f085c37",
1152
+ "metadata": {},
1153
+ "source": [
1154
+ "## Few Shot Prompting for Goals"
1155
+ ]
1156
+ },
1157
+ {
1158
+ "cell_type": "code",
1159
+ "execution_count": 24,
1160
+ "id": "8ab6ea2f-769c-4c65-8c29-4e1c8710090b",
1161
+ "metadata": {
1162
+ "tags": []
1163
+ },
1164
+ "outputs": [],
1165
+ "source": [
1166
+ "del model\n",
1167
+ "torch.cuda.empty_cache()"
1168
+ ]
1169
+ },
1170
+ {
1171
+ "cell_type": "code",
1172
+ "execution_count": 25,
1173
+ "id": "9a95c43c-7f28-4efa-a9a5-bc405659ccbb",
1174
+ "metadata": {
1175
+ "tags": []
1176
+ },
1177
+ "outputs": [],
1178
+ "source": [
1179
+ "os.environ['HF_HOME'] = \"Documents/MSDS/DS5002/trained_lora_model_project/best_model\""
1180
+ ]
1181
+ },
1182
+ {
1183
+ "cell_type": "code",
1184
+ "execution_count": 26,
1185
+ "id": "525f072b-05cf-4f2f-8e20-caddc0ee4485",
1186
+ "metadata": {
1187
+ "tags": []
1188
+ },
1189
+ "outputs": [
1190
+ {
1191
+ "data": {
1192
+ "application/vnd.jupyter.widget-view+json": {
1193
+ "model_id": "f3e71633bd6e416392e1cedf4df5fed8",
1194
+ "version_major": 2,
1195
+ "version_minor": 0
1196
+ },
1197
+ "text/plain": [
1198
+ "Loading checkpoint shards: 0%| | 0/4 [00:00<?, ?it/s]"
1199
+ ]
1200
+ },
1201
+ "metadata": {},
1202
+ "output_type": "display_data"
1203
+ }
1204
+ ],
1205
+ "source": [
1206
+ "tokenizer = AutoTokenizer.from_pretrained(\"TheFinAI/Fino1-8B\")\n",
1207
+ "model = AutoModelForCausalLM.from_pretrained(\"TheFinAI/Fino1-8B\", device_map = \"auto\", torch_dtype = torch.bfloat16)"
1208
+ ]
1209
+ },
1210
+ {
1211
+ "cell_type": "code",
1212
+ "execution_count": 27,
1213
+ "id": "595d19ee-64a4-4cc4-a541-247c3c0d9c98",
1214
+ "metadata": {
1215
+ "tags": []
1216
+ },
1217
+ "outputs": [],
1218
+ "source": [
1219
+ "test_goals = goals[2500:]"
1220
+ ]
1221
+ },
1222
+ {
1223
+ "cell_type": "code",
1224
+ "execution_count": 28,
1225
+ "id": "788dc05e-8c80-4a28-a9dc-276a4e2d0f1d",
1226
+ "metadata": {
1227
+ "tags": []
1228
+ },
1229
+ "outputs": [
1230
+ {
1231
+ "name": "stderr",
1232
+ "output_type": "stream",
1233
+ "text": [
1234
+ "Device set to use cuda:0\n"
1235
+ ]
1236
+ }
1237
+ ],
1238
+ "source": [
1239
+ "pipe = pipeline(\n",
1240
+ " \"text-generation\", \n",
1241
+ " model=model, \n",
1242
+ " torch_dtype=torch.bfloat16, \n",
1243
+ " device_map=\"auto\", \n",
1244
+ " tokenizer = tokenizer, \n",
1245
+ " max_new_tokens = 750,\n",
1246
+ " do_sample = False,\n",
1247
+ " temperature = 0\n",
1248
+ ")"
1249
+ ]
1250
+ },
1251
+ {
1252
+ "cell_type": "code",
1253
+ "execution_count": 29,
1254
+ "id": "d5aaac66-2704-4a5b-9370-96cc7be8b9da",
1255
+ "metadata": {
1256
+ "tags": []
1257
+ },
1258
+ "outputs": [],
1259
+ "source": [
1260
+ "def few_shot_goal(df3,pipe,n = 1,q = 10):\n",
1261
+ " examples = []\n",
1262
+ " for i in range(n):\n",
1263
+ " instruct = df3['instruct'].iloc[i]\n",
1264
+ " examples.append(instruct)\n",
1265
+ " examples.append(df3.iloc[q]['question_1'])\n",
1266
+ " examples = \"\\n\\n\".join(examples)\n",
1267
+ " text = pipe(examples)\n",
1268
+ " print(text[0]['generated_text'])"
1269
+ ]
1270
+ },
1271
+ {
1272
+ "cell_type": "code",
1273
+ "execution_count": 30,
1274
+ "id": "de1acda8-b16c-4d44-ac92-996a57138282",
1275
+ "metadata": {
1276
+ "tags": []
1277
+ },
1278
+ "outputs": [
1279
+ {
1280
+ "name": "stderr",
1281
+ "output_type": "stream",
1282
+ "text": [
1283
+ "/scratch/tar3kh/llm_course_2/lib/python3.11/site-packages/transformers/generation/configuration_utils.py:636: UserWarning: `do_sample` is set to `False`. However, `top_p` is set to `0.9` -- this flag is only used in sample-based generation modes. You should set `do_sample=True` or unset `top_p`.\n",
1284
+ " warnings.warn(\n"
1285
+ ]
1286
+ },
1287
+ {
1288
+ "name": "stdout",
1289
+ "output_type": "stream",
1290
+ "text": [
1291
+ "Q: My short term goal is to save for a $1774 vacation in the next year, my medium term goal is to save for down payment for a new car, around 5227 in the next 2 or 3 years, and my long term goal is to save for a down payment for a house around 151861 in the next ten years, can you help me integrate these goals into my budget as well as where I should store these savings?\n",
1292
+ "\n",
1293
+ "A: Lets think step by step. 1. Short-Term Goal: $1774 Vacation (1 Year)\n",
1294
+ "Timeline: 12 months\n",
1295
+ "Monthly Savings Needed: 1774 / 12 = 148.0\n",
1296
+ "\n",
1297
+ "Best Storage Option: High-yield savings account (HYSA)\n",
1298
+ "Easy access\n",
1299
+ "Earns some interest\n",
1300
+ "Safe from market fluctuations,\n",
1301
+ "\n",
1302
+ "2. Medium-Term Goal: $5227 Car Down Payment (2–3 Years)\n",
1303
+ "Timeline Options:\n",
1304
+ "2 years (24 months) → $218.0/month\n",
1305
+ "3 years (36 months) → $145.0/month\n",
1306
+ "Best Storage Option: HYSA or conservative investment\n",
1307
+ "If comfortable with some risk, a mix of HYSA + conservative investments (e.g., CDs, bond ETFs)\n",
1308
+ "If risk-averse, keep it in an HYSA,\n",
1309
+ "\n",
1310
+ "3. Long-Term Goal: $151861 House Down Payment (10 Years)\n",
1311
+ "Timeline: 120 months\n",
1312
+ "Monthly Savings Needed: 151861 / 120 = 1266.0 \n",
1313
+ "\n",
1314
+ "Best Storage Option: Investment account\n",
1315
+ "Given the long time horizon, investing in a mix of index funds (S&P 500, total stock market) + bonds could provide higher returns.\n",
1316
+ "Consider Roth IRA (if eligible) or brokerage account to allow tax-efficient growth.\n",
1317
+ "\n",
1318
+ "Summary of Total Savings Targets:\n",
1319
+ "Total Monthly Savings goal = $1559.0 - $1631.0/month\n",
1320
+ "\n",
1321
+ "Q: My short term goal is to save for a $2474 vacation in the next year, my medium term goal is to save for down payment for a new car, around 6601 in the next 2 or 3 years, and my long term goal is to save for a down payment for a house around 164733 in the next ten years, can you help me integrate these goals into my budget as well as where I should store these savings?\n",
1322
+ "\n",
1323
+ "A: Lets think step by step. 1. Short-Term Goal: $2474 Vacation (1 Year)\n",
1324
+ "Timeline: 12 months\n",
1325
+ "Monthly Savings Needed: 2474 / 12 = 206.0\n",
1326
+ "\n",
1327
+ "Best Storage Option: High-yield savings account (HYSA)\n",
1328
+ "Easy access\n",
1329
+ "Earns some interest\n",
1330
+ "Safe from market fluctuations,\n",
1331
+ "\n",
1332
+ "2. Medium-Term Goal: $6601 Car Down Payment (2–3 Years)\n",
1333
+ "Timeline Options:\n",
1334
+ "2 years (24 months) → $275.0/month\n",
1335
+ "3 years (36 months) → $183.0/month\n",
1336
+ "Best Storage Option: HYSA or conservative investment\n",
1337
+ "If comfortable with some risk, a mix of HYSA + conservative investments (e.g., CDs, bond ETFs)\n",
1338
+ "If risk-averse, keep it in an HYSA,\n",
1339
+ "\n",
1340
+ "3. Long-Term Goal: $164733 House Down Payment (10 Years)\n",
1341
+ "Timeline: 120 months\n",
1342
+ "Monthly Savings Needed: 164733 / 120 = 1373.0 \n",
1343
+ "\n",
1344
+ "Best Storage Option: Investment account\n",
1345
+ "Given the long time horizon, investing in a mix of index funds (S&P 500, total stock market) + bonds could provide higher returns.\n",
1346
+ "Consider Roth IRA (if eligible) or brokerage account to allow tax-efficient growth.\n",
1347
+ "\n",
1348
+ "Summary of Total Savings Targets:\n",
1349
+ "Total Monthly Savings goal = $1762.0 - $1854.0/month\n",
1350
+ "\n",
1351
+ "Q: My short term goal is to save for a $3357 vacation in the next year, my medium term goal is to save for down payment for a new car, around 6867 in the next 2 or 3 years, and my long term goal is to save for a down payment for a house around 115061 in the next ten years, can you help me integrate these goals into my budget as well as where I should store these savings?\n",
1352
+ "\n",
1353
+ "A: Lets think step by step. 1. Short-Term Goal: $3357 Vacation (1 Year)\n",
1354
+ "Timeline: 12 months\n",
1355
+ "Monthly Savings Needed: 3357 / 12 = 280.0\n",
1356
+ "\n",
1357
+ "Best Storage Option: High-yield savings account (HYSA)\n",
1358
+ "Easy access\n",
1359
+ "Earns some interest\n",
1360
+ "Safe from market fluctuations,\n",
1361
+ "\n",
1362
+ "2. Medium-Term Goal: $6867 Car Down Payment (2–3 Years)\n",
1363
+ "Timeline Options:\n",
1364
+ "2 years (24 months) → $286.0/month\n",
1365
+ "3 years (36 months) → $191.0/month\n",
1366
+ "Best Storage Option: HYSA or conservative investment\n",
1367
+ "If comfortable with some risk, a mix of HYSA + conservative investments (e.g., CDs, bond ETFs)\n",
1368
+ "If risk-averse, keep it in an HYSA,\n",
1369
+ "\n",
1370
+ "3. Long-Term Goal: $115061 House Down Payment (10 Years)\n",
1371
+ "Timeline: 120 months\n",
1372
+ "Monthly Savings Needed: 115061 / 120 = 959.0 \n",
1373
+ "\n",
1374
+ "Best Storage Option: Investment account\n",
1375
+ "Given the long time horizon, investing in a mix of index funds (S&P 500, total stock market) + bonds could provide higher returns.\n",
1376
+ "Consider Roth IRA (if eligible) or brokerage account to allow tax-efficient growth.\n",
1377
+ "\n",
1378
+ "Summary of Total Savings Targets:\n",
1379
+ "Total Monthly Savings goal = $1429.0 - $1525.0/month\n",
1380
+ "\n",
1381
+ "Q: My short term goal is to save for a $1843 vacation in the next year, my medium term goal is to save for down payment for a new car, around 7441 in the next 2 or 3 years, and my long term goal is to save for a down payment for a house around 187903 in the next ten years, can you help me integrate these goals into my budget as well as where I should store these savings?\n",
1382
+ "\n",
1383
+ "A: Lets think step by step. 1. Short-Term Goal: $1843 Vacation (1 Year)\n",
1384
+ "Timeline: 12 months\n",
1385
+ "Monthly Savings Needed: 1843 / 12 = 153.0\n",
1386
+ "\n",
1387
+ "Best Storage Option: High-yield savings account (HYSA)\n",
1388
+ "Easy access\n",
1389
+ "Earns some interest\n",
1390
+ "Safe from market fluctuations,\n",
1391
+ "\n",
1392
+ "2. Medium-Term Goal: $7441 Car Down Payment (2–3 Years)\n",
1393
+ "Timeline Options:\n",
1394
+ "2 years (24 months) → $310.0/month\n",
1395
+ "3 years (36 months) → $206.0/month\n",
1396
+ "Best Storage Option: HYSA or conservative investment\n",
1397
+ "If comfortable with some risk, a mix of HYSA + conservative investments (e.g., CDs, bond ETFs)\n",
1398
+ "If risk-averse, keep it in an HYSA,\n",
1399
+ "\n",
1400
+ "3. Long-Term Goal: $187903 House Down Payment (10 Years)\n",
1401
+ "Timeline: 120 months\n",
1402
+ "Monthly Savings Needed: 187903 / 120 = 1567.0 \n",
1403
+ "\n",
1404
+ "Best Storage Option: Investment account\n",
1405
+ "Given the long time horizon, investing in a mix of index funds (S&P 500, total stock market) + bonds could provide higher returns.\n",
1406
+ "Consider Roth IRA (if eligible) or brokerage account to allow tax-efficient growth.\n",
1407
+ "\n",
1408
+ "Summary of Total Savings Targets:\n",
1409
+ "Total Monthly Savings goal = $2030.0 - $2120.0/month\n",
1410
+ "\n",
1411
+ "## Thinking\n",
1412
+ "\n",
1413
+ "Alright, let's figure out how to save for these goals. First, I need to break down each goal into smaller, manageable chunks. For the vacation, I want to save $1843 in a year. So, I'll divide that by 12 months, which gives me $153.0 per month. Easy enough.\n",
1414
+ "\n",
1415
+ "Next up is the car down payment. I'm aiming for $7441 over 2 to 3 years. If I go with the 2-year timeline, that's $310.0 per month. If I stretch it to 3 years, it's $206.0 per month. I'll stick with the 2-year plan for now.\n",
1416
+ "\n",
1417
+ "Now, onto the big one: saving for a house down payment. I need $187903 in 10 years. Let me do the math: $187903 divided by 120 months equals $1567.0 per month. That's a bit more substantial, but doable.\n",
1418
+ "\n",
1419
+ "So, what's the total monthly savings I need to aim for? Let's add them up: $153.0 for the vacation, $310.0 for the car, and $1567.0 for the house. That gives me a total of $2030.0 per month. \n",
1420
+ "\n",
1421
+ "I should probably double-check that I've got everything right. The vacation savings are $153.0, car is $310.0, and house is $1567.0. Yep, adding those up confirms the total is $2030.0 per month.\n",
1422
+ "\n",
1423
+ "Now, where should I store these savings? For the short-term goal, like the vacation, a high-yield savings account (HYSA) is perfect. It's easily accessible, earns some interest, and keeps my money safe from market fluctuations.\n",
1424
+ "\n",
1425
+ "For the medium-term goal, the car down payment, I can also use a HYSA or consider a mix of HYSA and conservative investments if I'm comfortable with a bit of risk. This will help grow my savings over the 2-year period.\n",
1426
+ "\n",
1427
+ "For the long-term goal, the house down payment, I'll need to invest in a mix of index funds and bonds. This will allow me to grow my savings over the 10-year period, given the long time horizon.\n",
1428
+ "\n",
1429
+ "In conclusion, I've got a clear plan: save\n"
1430
+ ]
1431
+ }
1432
+ ],
1433
+ "source": [
1434
+ "few_shot_goal(test_goals,pipe,n = 3,q=10)"
1435
+ ]
1436
+ },
1437
+ {
1438
+ "cell_type": "code",
1439
+ "execution_count": 31,
1440
+ "id": "7687bd76-8ec6-4069-bf14-233be6efff27",
1441
+ "metadata": {
1442
+ "tags": []
1443
+ },
1444
+ "outputs": [
1445
+ {
1446
+ "name": "stderr",
1447
+ "output_type": "stream",
1448
+ "text": [
1449
+ "`pretrained` model kwarg is not of type `str`. Many other model arguments may be ignored. Please do not launch via accelerate or use `parallelize=True` if passing an existing model this way.\n",
1450
+ "Passed an already-initialized model through `pretrained`, assuming single-process call to evaluate() or custom distributed integration\n",
1451
+ "100%|██████████| 30/30 [00:00<00:00, 622.54it/s]\n",
1452
+ "100%|██████████| 30/30 [00:00<00:00, 620.90it/s]\n",
1453
+ "100%|██████████| 30/30 [00:00<00:00, 624.98it/s]\n",
1454
+ "100%|██████████| 30/30 [00:00<00:00, 636.38it/s]\n",
1455
+ "100%|██████████| 30/30 [00:00<00:00, 636.78it/s]\n",
1456
+ "100%|██████████| 30/30 [00:00<00:00, 620.74it/s]\n",
1457
+ "100%|██████████| 30/30 [00:00<00:00, 639.07it/s]\n",
1458
+ "100%|██████████| 30/30 [00:00<00:00, 630.23it/s]\n",
1459
+ "100%|██████████| 30/30 [00:00<00:00, 407.78it/s]\n",
1460
+ "100%|██████████| 30/30 [00:00<00:00, 624.93it/s]\n",
1461
+ "100%|██████████| 30/30 [00:00<00:00, 641.87it/s]\n",
1462
+ "100%|██████████| 30/30 [00:00<00:00, 630.35it/s]\n",
1463
+ "100%|██████████| 30/30 [00:00<00:00, 620.48it/s]\n",
1464
+ "100%|██████████| 30/30 [00:00<00:00, 636.17it/s]\n",
1465
+ "100%|██████████| 30/30 [00:00<00:00, 633.90it/s]\n",
1466
+ "100%|██████████| 30/30 [00:00<00:00, 639.94it/s]\n",
1467
+ "100%|██████████| 30/30 [00:00<00:00, 458.23it/s]\n",
1468
+ "100%|██████████| 30/30 [00:00<00:00, 617.72it/s]\n",
1469
+ "100%|██████████| 30/30 [00:00<00:00, 640.94it/s]\n",
1470
+ "100%|██████████| 30/30 [00:00<00:00, 628.91it/s]\n",
1471
+ "100%|██████████| 30/30 [00:00<00:00, 636.75it/s]\n",
1472
+ "100%|██████████| 30/30 [00:00<00:00, 634.69it/s]\n",
1473
+ "100%|██████████| 30/30 [00:00<00:00, 643.04it/s]\n",
1474
+ "100%|██████████| 30/30 [00:00<00:00, 637.35it/s]\n",
1475
+ "100%|██████████| 30/30 [00:00<00:00, 641.38it/s]\n",
1476
+ "100%|██████████| 30/30 [00:00<00:00, 631.82it/s]\n",
1477
+ "100%|██████████| 30/30 [00:00<00:00, 645.73it/s]\n",
1478
+ "100%|██████████| 30/30 [00:00<00:00, 636.58it/s]\n",
1479
+ "100%|██████████| 30/30 [00:00<00:00, 638.31it/s]\n",
1480
+ "100%|██████████| 30/30 [00:00<00:00, 638.65it/s]\n",
1481
+ "100%|██████████| 30/30 [00:00<00:00, 639.82it/s]\n",
1482
+ "100%|██████████| 30/30 [00:00<00:00, 644.89it/s]\n",
1483
+ "100%|██████████| 30/30 [00:00<00:00, 629.31it/s]\n",
1484
+ "100%|██████████| 30/30 [00:00<00:00, 639.52it/s]\n",
1485
+ "100%|██████████| 30/30 [00:00<00:00, 450.13it/s]\n",
1486
+ "100%|██████████| 30/30 [00:00<00:00, 634.88it/s]\n",
1487
+ "100%|██████████| 30/30 [00:00<00:00, 636.95it/s]\n",
1488
+ "100%|██████████| 30/30 [00:00<00:00, 633.42it/s]\n",
1489
+ "100%|██████████| 30/30 [00:00<00:00, 642.98it/s]\n",
1490
+ "100%|██████████| 30/30 [00:00<00:00, 644.13it/s]\n",
1491
+ "100%|██████████| 30/30 [00:00<00:00, 646.38it/s]\n",
1492
+ "100%|██████████| 30/30 [00:00<00:00, 643.25it/s]\n",
1493
+ "100%|██████████| 30/30 [00:00<00:00, 644.68it/s]\n",
1494
+ "100%|██████████| 30/30 [00:00<00:00, 642.12it/s]\n",
1495
+ "100%|██████████| 30/30 [00:00<00:00, 650.10it/s]\n",
1496
+ "100%|██████████| 30/30 [00:00<00:00, 641.65it/s]\n",
1497
+ "100%|██████████| 30/30 [00:00<00:00, 644.04it/s]\n",
1498
+ "100%|██████████| 30/30 [00:00<00:00, 620.65it/s]\n",
1499
+ "100%|██████████| 30/30 [00:00<00:00, 633.96it/s]\n",
1500
+ "100%|██████████| 30/30 [00:00<00:00, 630.25it/s]\n",
1501
+ "100%|██████████| 30/30 [00:00<00:00, 626.48it/s]\n",
1502
+ "100%|██████████| 30/30 [00:00<00:00, 635.92it/s]\n",
1503
+ "100%|██████████| 30/30 [00:00<00:00, 580.31it/s]\n",
1504
+ "100%|██████████| 30/30 [00:00<00:00, 614.04it/s]\n",
1505
+ "100%|██████████| 30/30 [00:00<00:00, 614.74it/s]\n",
1506
+ "100%|██████████| 30/30 [00:00<00:00, 615.03it/s]\n",
1507
+ "100%|██████████| 30/30 [00:00<00:00, 468.15it/s]\n",
1508
+ "100%|██████████| 30/30 [00:00<00:00, 56.67it/s]\n",
1509
+ "Running loglikelihood requests: 100%|██████████| 6840/6840 [01:21<00:00, 83.78it/s]\n",
1510
+ "Running generate_until requests: 0%| | 0/30 [00:00<?, ?it/s]/scratch/tar3kh/llm_course_2/lib/python3.11/site-packages/transformers/generation/configuration_utils.py:631: UserWarning: `do_sample` is set to `False`. However, `temperature` is set to `0.6` -- this flag is only used in sample-based generation modes. You should set `do_sample=True` or unset `temperature`.\n",
1511
+ " warnings.warn(\n",
1512
+ "Running generate_until requests: 100%|██████████| 30/30 [03:09<00:00, 6.32s/it]\n",
1513
+ "fatal: not a git repository (or any parent up to mount point /sfs/gpfs)\n",
1514
+ "Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).\n"
1515
+ ]
1516
+ }
1517
+ ],
1518
+ "source": [
1519
+ "results3 = lm_eval.simple_evaluate(\n",
1520
+ " model = 'hf',\n",
1521
+ " model_args = {\"pretrained\": model, \"dtype\": \"bfloat16\", \"toeknzier\": tokenizer},\n",
1522
+ " tasks = ['gsm8k_cot', 'mmlu'],\n",
1523
+ " task_manager = task_manager,\n",
1524
+ " log_samples = True, \n",
1525
+ " batch_size = \"1\", \n",
1526
+ " limit = 30, \n",
1527
+ " random_seed = 42)"
1528
+ ]
1529
+ },
1530
+ {
1531
+ "cell_type": "code",
1532
+ "execution_count": 32,
1533
+ "id": "e5fa13b0-e3b5-4ef2-8e8f-6e68d9121116",
1534
+ "metadata": {
1535
+ "tags": []
1536
+ },
1537
+ "outputs": [
1538
+ {
1539
+ "data": {
1540
+ "text/plain": [
1541
+ "{'gsm8k_cot': {'alias': 'gsm8k_cot',\n",
1542
+ " 'exact_match,strict-match': np.float64(0.6333333333333333),\n",
1543
+ " 'exact_match_stderr,strict-match': 0.0894855453983996,\n",
1544
+ " 'exact_match,flexible-extract': np.float64(0.6333333333333333),\n",
1545
+ " 'exact_match_stderr,flexible-extract': 0.0894855453983996},\n",
1546
+ " 'mmlu': {'acc,none': 0.6684210526315789,\n",
1547
+ " 'acc_stderr,none': np.float64(0.010724424663842536),\n",
1548
+ " 'alias': 'mmlu'},\n",
1549
+ " 'mmlu_humanities': {'acc,none': 0.7076923076923077,\n",
1550
+ " 'acc_stderr,none': np.float64(0.02268555050327971),\n",
1551
+ " 'alias': ' - humanities'},\n",
1552
+ " 'mmlu_formal_logic': {'alias': ' - formal_logic',\n",
1553
+ " 'acc,none': 0.5333333333333333,\n",
1554
+ " 'acc_stderr,none': 0.09264111117062017},\n",
1555
+ " 'mmlu_high_school_european_history': {'alias': ' - high_school_european_history',\n",
1556
+ " 'acc,none': 0.6333333333333333,\n",
1557
+ " 'acc_stderr,none': 0.08948554539839962},\n",
1558
+ " 'mmlu_high_school_us_history': {'alias': ' - high_school_us_history',\n",
1559
+ " 'acc,none': 0.7333333333333333,\n",
1560
+ " 'acc_stderr,none': 0.08211756827352532},\n",
1561
+ " 'mmlu_high_school_world_history': {'alias': ' - high_school_world_history',\n",
1562
+ " 'acc,none': 0.8,\n",
1563
+ " 'acc_stderr,none': 0.07427813527082075},\n",
1564
+ " 'mmlu_international_law': {'alias': ' - international_law',\n",
1565
+ " 'acc,none': 0.9,\n",
1566
+ " 'acc_stderr,none': 0.055708601453115555},\n",
1567
+ " 'mmlu_jurisprudence': {'alias': ' - jurisprudence',\n",
1568
+ " 'acc,none': 0.7333333333333333,\n",
1569
+ " 'acc_stderr,none': 0.08211756827352532},\n",
1570
+ " 'mmlu_logical_fallacies': {'alias': ' - logical_fallacies',\n",
1571
+ " 'acc,none': 0.8333333333333334,\n",
1572
+ " 'acc_stderr,none': 0.06920456654478331},\n",
1573
+ " 'mmlu_moral_disputes': {'alias': ' - moral_disputes',\n",
1574
+ " 'acc,none': 0.6333333333333333,\n",
1575
+ " 'acc_stderr,none': 0.0894855453983996},\n",
1576
+ " 'mmlu_moral_scenarios': {'alias': ' - moral_scenarios',\n",
1577
+ " 'acc,none': 0.5,\n",
1578
+ " 'acc_stderr,none': 0.09284766908852593},\n",
1579
+ " 'mmlu_philosophy': {'alias': ' - philosophy',\n",
1580
+ " 'acc,none': 0.6666666666666666,\n",
1581
+ " 'acc_stderr,none': 0.0875376219064817},\n",
1582
+ " 'mmlu_prehistory': {'alias': ' - prehistory',\n",
1583
+ " 'acc,none': 0.7333333333333333,\n",
1584
+ " 'acc_stderr,none': 0.0821175682735253},\n",
1585
+ " 'mmlu_professional_law': {'alias': ' - professional_law',\n",
1586
+ " 'acc,none': 0.6666666666666666,\n",
1587
+ " 'acc_stderr,none': 0.08753762190648169},\n",
1588
+ " 'mmlu_world_religions': {'alias': ' - world_religions',\n",
1589
+ " 'acc,none': 0.8333333333333334,\n",
1590
+ " 'acc_stderr,none': 0.06920456654478328},\n",
1591
+ " 'mmlu_other': {'acc,none': 0.7128205128205128,\n",
1592
+ " 'acc_stderr,none': np.float64(0.021964544728876025),\n",
1593
+ " 'alias': ' - other'},\n",
1594
+ " 'mmlu_business_ethics': {'alias': ' - business_ethics',\n",
1595
+ " 'acc,none': 0.8,\n",
1596
+ " 'acc_stderr,none': 0.07427813527082075},\n",
1597
+ " 'mmlu_clinical_knowledge': {'alias': ' - clinical_knowledge',\n",
1598
+ " 'acc,none': 0.7333333333333333,\n",
1599
+ " 'acc_stderr,none': 0.08211756827352529},\n",
1600
+ " 'mmlu_college_medicine': {'alias': ' - college_medicine',\n",
1601
+ " 'acc,none': 0.7333333333333333,\n",
1602
+ " 'acc_stderr,none': 0.08211756827352529},\n",
1603
+ " 'mmlu_global_facts': {'alias': ' - global_facts',\n",
1604
+ " 'acc,none': 0.4,\n",
1605
+ " 'acc_stderr,none': 0.09097176522946843},\n",
1606
+ " 'mmlu_human_aging': {'alias': ' - human_aging',\n",
1607
+ " 'acc,none': 0.5333333333333333,\n",
1608
+ " 'acc_stderr,none': 0.09264111117062017},\n",
1609
+ " 'mmlu_management': {'alias': ' - management',\n",
1610
+ " 'acc,none': 0.8666666666666667,\n",
1611
+ " 'acc_stderr,none': 0.06312427686319994},\n",
1612
+ " 'mmlu_marketing': {'alias': ' - marketing',\n",
1613
+ " 'acc,none': 0.8666666666666667,\n",
1614
+ " 'acc_stderr,none': 0.06312427686319991},\n",
1615
+ " 'mmlu_medical_genetics': {'alias': ' - medical_genetics',\n",
1616
+ " 'acc,none': 0.7666666666666667,\n",
1617
+ " 'acc_stderr,none': 0.0785403232453173},\n",
1618
+ " 'mmlu_miscellaneous': {'alias': ' - miscellaneous',\n",
1619
+ " 'acc,none': 0.8666666666666667,\n",
1620
+ " 'acc_stderr,none': 0.06312427686319994},\n",
1621
+ " 'mmlu_nutrition': {'alias': ' - nutrition',\n",
1622
+ " 'acc,none': 0.7666666666666667,\n",
1623
+ " 'acc_stderr,none': 0.07854032324531726},\n",
1624
+ " 'mmlu_professional_accounting': {'alias': ' - professional_accounting',\n",
1625
+ " 'acc,none': 0.4666666666666667,\n",
1626
+ " 'acc_stderr,none': 0.09264111117062017},\n",
1627
+ " 'mmlu_professional_medicine': {'alias': ' - professional_medicine',\n",
1628
+ " 'acc,none': 0.8333333333333334,\n",
1629
+ " 'acc_stderr,none': 0.06920456654478331},\n",
1630
+ " 'mmlu_virology': {'alias': ' - virology',\n",
1631
+ " 'acc,none': 0.6333333333333333,\n",
1632
+ " 'acc_stderr,none': 0.0894855453983996},\n",
1633
+ " 'mmlu_social_sciences': {'acc,none': 0.7583333333333333,\n",
1634
+ " 'acc_stderr,none': np.float64(0.021975401318080102),\n",
1635
+ " 'alias': ' - social sciences'},\n",
1636
+ " 'mmlu_econometrics': {'alias': ' - econometrics',\n",
1637
+ " 'acc,none': 0.4666666666666667,\n",
1638
+ " 'acc_stderr,none': 0.09264111117062017},\n",
1639
+ " 'mmlu_high_school_geography': {'alias': ' - high_school_geography',\n",
1640
+ " 'acc,none': 0.8666666666666667,\n",
1641
+ " 'acc_stderr,none': 0.06312427686319994},\n",
1642
+ " 'mmlu_high_school_government_and_politics': {'alias': ' - high_school_government_and_politics',\n",
1643
+ " 'acc,none': 0.9,\n",
1644
+ " 'acc_stderr,none': 0.05570860145311553},\n",
1645
+ " 'mmlu_high_school_macroeconomics': {'alias': ' - high_school_macroeconomics',\n",
1646
+ " 'acc,none': 0.6333333333333333,\n",
1647
+ " 'acc_stderr,none': 0.0894855453983996},\n",
1648
+ " 'mmlu_high_school_microeconomics': {'alias': ' - high_school_microeconomics',\n",
1649
+ " 'acc,none': 0.7,\n",
1650
+ " 'acc_stderr,none': 0.0850962943396763},\n",
1651
+ " 'mmlu_high_school_psychology': {'alias': ' - high_school_psychology',\n",
1652
+ " 'acc,none': 0.8333333333333334,\n",
1653
+ " 'acc_stderr,none': 0.06920456654478331},\n",
1654
+ " 'mmlu_human_sexuality': {'alias': ' - human_sexuality',\n",
1655
+ " 'acc,none': 0.8,\n",
1656
+ " 'acc_stderr,none': 0.07427813527082075},\n",
1657
+ " 'mmlu_professional_psychology': {'alias': ' - professional_psychology',\n",
1658
+ " 'acc,none': 0.7666666666666667,\n",
1659
+ " 'acc_stderr,none': 0.07854032324531729},\n",
1660
+ " 'mmlu_public_relations': {'alias': ' - public_relations',\n",
1661
+ " 'acc,none': 0.6333333333333333,\n",
1662
+ " 'acc_stderr,none': 0.0894855453983996},\n",
1663
+ " 'mmlu_security_studies': {'alias': ' - security_studies',\n",
1664
+ " 'acc,none': 0.8,\n",
1665
+ " 'acc_stderr,none': 0.07427813527082075},\n",
1666
+ " 'mmlu_sociology': {'alias': ' - sociology',\n",
1667
+ " 'acc,none': 0.8,\n",
1668
+ " 'acc_stderr,none': 0.07427813527082075},\n",
1669
+ " 'mmlu_us_foreign_policy': {'alias': ' - us_foreign_policy',\n",
1670
+ " 'acc,none': 0.9,\n",
1671
+ " 'acc_stderr,none': 0.055708601453115555},\n",
1672
+ " 'mmlu_stem': {'acc,none': 0.5543859649122806,\n",
1673
+ " 'acc_stderr,none': np.float64(0.01938330262875528),\n",
1674
+ " 'alias': ' - stem'},\n",
1675
+ " 'mmlu_abstract_algebra': {'alias': ' - abstract_algebra',\n",
1676
+ " 'acc,none': 0.4,\n",
1677
+ " 'acc_stderr,none': 0.09097176522946843},\n",
1678
+ " 'mmlu_anatomy': {'alias': ' - anatomy',\n",
1679
+ " 'acc,none': 0.6666666666666666,\n",
1680
+ " 'acc_stderr,none': 0.0875376219064817},\n",
1681
+ " 'mmlu_astronomy': {'alias': ' - astronomy',\n",
1682
+ " 'acc,none': 0.7666666666666667,\n",
1683
+ " 'acc_stderr,none': 0.0785403232453173},\n",
1684
+ " 'mmlu_college_biology': {'alias': ' - college_biology',\n",
1685
+ " 'acc,none': 0.8666666666666667,\n",
1686
+ " 'acc_stderr,none': 0.06312427686319992},\n",
1687
+ " 'mmlu_college_chemistry': {'alias': ' - college_chemistry',\n",
1688
+ " 'acc,none': 0.4666666666666667,\n",
1689
+ " 'acc_stderr,none': 0.09264111117062017},\n",
1690
+ " 'mmlu_college_computer_science': {'alias': ' - college_computer_science',\n",
1691
+ " 'acc,none': 0.5333333333333333,\n",
1692
+ " 'acc_stderr,none': 0.09264111117062017},\n",
1693
+ " 'mmlu_college_mathematics': {'alias': ' - college_mathematics',\n",
1694
+ " 'acc,none': 0.2,\n",
1695
+ " 'acc_stderr,none': 0.07427813527082075},\n",
1696
+ " 'mmlu_college_physics': {'alias': ' - college_physics',\n",
1697
+ " 'acc,none': 0.43333333333333335,\n",
1698
+ " 'acc_stderr,none': 0.0920186554465537},\n",
1699
+ " 'mmlu_computer_security': {'alias': ' - computer_security',\n",
1700
+ " 'acc,none': 0.8,\n",
1701
+ " 'acc_stderr,none': 0.07427813527082075},\n",
1702
+ " 'mmlu_conceptual_physics': {'alias': ' - conceptual_physics',\n",
1703
+ " 'acc,none': 0.6333333333333333,\n",
1704
+ " 'acc_stderr,none': 0.08948554539839962},\n",
1705
+ " 'mmlu_electrical_engineering': {'alias': ' - electrical_engineering',\n",
1706
+ " 'acc,none': 0.5,\n",
1707
+ " 'acc_stderr,none': 0.09284766908852593},\n",
1708
+ " 'mmlu_elementary_mathematics': {'alias': ' - elementary_mathematics',\n",
1709
+ " 'acc,none': 0.36666666666666664,\n",
1710
+ " 'acc_stderr,none': 0.08948554539839962},\n",
1711
+ " 'mmlu_high_school_biology': {'alias': ' - high_school_biology',\n",
1712
+ " 'acc,none': 0.8666666666666667,\n",
1713
+ " 'acc_stderr,none': 0.06312427686319992},\n",
1714
+ " 'mmlu_high_school_chemistry': {'alias': ' - high_school_chemistry',\n",
1715
+ " 'acc,none': 0.6666666666666666,\n",
1716
+ " 'acc_stderr,none': 0.08753762190648169},\n",
1717
+ " 'mmlu_high_school_computer_science': {'alias': ' - high_school_computer_science',\n",
1718
+ " 'acc,none': 0.8333333333333334,\n",
1719
+ " 'acc_stderr,none': 0.06920456654478331},\n",
1720
+ " 'mmlu_high_school_mathematics': {'alias': ' - high_school_mathematics',\n",
1721
+ " 'acc,none': 0.26666666666666666,\n",
1722
+ " 'acc_stderr,none': 0.08211756827352527},\n",
1723
+ " 'mmlu_high_school_physics': {'alias': ' - high_school_physics',\n",
1724
+ " 'acc,none': 0.36666666666666664,\n",
1725
+ " 'acc_stderr,none': 0.0894855453983996},\n",
1726
+ " 'mmlu_high_school_statistics': {'alias': ' - high_school_statistics',\n",
1727
+ " 'acc,none': 0.43333333333333335,\n",
1728
+ " 'acc_stderr,none': 0.0920186554465537},\n",
1729
+ " 'mmlu_machine_learning': {'alias': ' - machine_learning',\n",
1730
+ " 'acc,none': 0.4666666666666667,\n",
1731
+ " 'acc_stderr,none': 0.09264111117062017}}"
1732
+ ]
1733
+ },
1734
+ "execution_count": 32,
1735
+ "metadata": {},
1736
+ "output_type": "execute_result"
1737
+ }
1738
+ ],
1739
+ "source": [
1740
+ "results3['results']"
1741
+ ]
1742
+ },
1743
+ {
1744
+ "cell_type": "code",
1745
+ "execution_count": null,
1746
+ "id": "1345da8f-a8a6-493b-b28b-7021edb6b16b",
1747
+ "metadata": {},
1748
+ "outputs": [],
1749
+ "source": []
1750
+ }
1751
+ ],
1752
+ "metadata": {
1753
+ "kernelspec": {
1754
+ "display_name": "llm_course_2",
1755
+ "language": "python",
1756
+ "name": "llm_course_2"
1757
+ },
1758
+ "language_info": {
1759
+ "codemirror_mode": {
1760
+ "name": "ipython",
1761
+ "version": 3
1762
+ },
1763
+ "file_extension": ".py",
1764
+ "mimetype": "text/x-python",
1765
+ "name": "python",
1766
+ "nbconvert_exporter": "python",
1767
+ "pygments_lexer": "ipython3",
1768
+ "version": "3.11.11"
1769
+ }
1770
+ },
1771
+ "nbformat": 4,
1772
+ "nbformat_minor": 5
1773
+ }
budget_dataset.csv ADDED
The diff for this file is too large to render. See raw diff
 
goals_dataset.csv ADDED
The diff for this file is too large to render. See raw diff