picocreator commited on
Commit
d19887c
1 Parent(s): f7b798b

Compiling the results together

Browse files
compile-results.ipynb ADDED
@@ -0,0 +1,863 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 47,
6
+ "metadata": {},
7
+ "outputs": [
8
+ {
9
+ "name": "stdout",
10
+ "output_type": "stream",
11
+ "text": [
12
+ "Defaulting to user installation because normal site-packages is not writeable\n",
13
+ "Requirement already satisfied: pandas in /Users/picocreator/Library/Python/3.9/lib/python/site-packages (2.2.0)\n",
14
+ "Requirement already satisfied: tzdata>=2022.7 in /Users/picocreator/Library/Python/3.9/lib/python/site-packages (from pandas) (2024.1)\n",
15
+ "Requirement already satisfied: python-dateutil>=2.8.2 in /Users/picocreator/Library/Python/3.9/lib/python/site-packages (from pandas) (2.8.2)\n",
16
+ "Requirement already satisfied: pytz>=2020.1 in /Users/picocreator/Library/Python/3.9/lib/python/site-packages (from pandas) (2024.1)\n",
17
+ "Requirement already satisfied: numpy<2,>=1.22.4 in /Users/picocreator/Library/Python/3.9/lib/python/site-packages (from pandas) (1.26.1)\n",
18
+ "Requirement already satisfied: six>=1.5 in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages (from python-dateutil>=2.8.2->pandas) (1.15.0)\n",
19
+ "\u001b[33mWARNING: You are using pip version 21.2.4; however, version 24.0 is available.\n",
20
+ "You should consider upgrading via the '/Library/Developer/CommandLineTools/usr/bin/python3 -m pip install --upgrade pip' command.\u001b[0m\n"
21
+ ]
22
+ }
23
+ ],
24
+ "source": [
25
+ "!pip3 install pandas"
26
+ ]
27
+ },
28
+ {
29
+ "cell_type": "markdown",
30
+ "metadata": {},
31
+ "source": [
32
+ "### Get the filelist\n",
33
+ "\n",
34
+ "For the full results.json"
35
+ ]
36
+ },
37
+ {
38
+ "cell_type": "code",
39
+ "execution_count": 48,
40
+ "metadata": {},
41
+ "outputs": [
42
+ {
43
+ "name": "stdout",
44
+ "output_type": "stream",
45
+ "text": [
46
+ "Found 2217 results.json files\n"
47
+ ]
48
+ }
49
+ ],
50
+ "source": [
51
+ "import glob\n",
52
+ "\n",
53
+ "# Specify the path to the folder containing the results.json files\n",
54
+ "folder_path = \"lm-eval-output\"\n",
55
+ "\n",
56
+ "# Use glob to find all the results.json files\n",
57
+ "results_json_files = glob.glob(f\"{folder_path}/**/results.json\", recursive=True)\n",
58
+ "\n",
59
+ "# Show total number of results.json files found\n",
60
+ "print(f\"Found {len(results_json_files)} results.json files\")\n"
61
+ ]
62
+ },
63
+ {
64
+ "cell_type": "markdown",
65
+ "metadata": {},
66
+ "source": [
67
+ "### Process all the results.json\n",
68
+ "\n",
69
+ "One file at a time"
70
+ ]
71
+ },
72
+ {
73
+ "cell_type": "code",
74
+ "execution_count": 49,
75
+ "metadata": {},
76
+ "outputs": [
77
+ {
78
+ "name": "stdout",
79
+ "output_type": "stream",
80
+ "text": [
81
+ "Processed example: {'name': 'bigscience/bloom-7b1', 'config': {'dtype=bfloat16,trust_remote_code=True': {'confStr': 'dtype=bfloat16,trust_remote_code=True', 'confObj': {'dtype': 'bfloat16', 'trust_remote_code': 'True'}, 'results': {'xcopa': {'acc,none': 0.5709090909090908, 'acc_stderr,none': 0.06135942275478038, 'alias': 'xcopa'}, 'xcopa_et': {'acc,none': 0.482, 'acc_stderr,none': 0.02236856511738799, 'alias': ' - xcopa_et'}, 'xcopa_ht': {'acc,none': 0.516, 'acc_stderr,none': 0.0223716109825804, 'alias': ' - xcopa_ht'}, 'xcopa_id': {'acc,none': 0.702, 'acc_stderr,none': 0.020475118092988978, 'alias': ' - xcopa_id'}, 'xcopa_it': {'acc,none': 0.528, 'acc_stderr,none': 0.022347949832668093, 'alias': ' - xcopa_it'}, 'xcopa_qu': {'acc,none': 0.512, 'acc_stderr,none': 0.02237662679792717, 'alias': ' - xcopa_qu'}, 'xcopa_sw': {'acc,none': 0.518, 'acc_stderr,none': 0.02236856511738799, 'alias': ' - xcopa_sw'}, 'xcopa_ta': {'acc,none': 0.592, 'acc_stderr,none': 0.02200091089387719, 'alias': ' - xcopa_ta'}, 'xcopa_th': {'acc,none': 0.552, 'acc_stderr,none': 0.022261697292270132, 'alias': ' - xcopa_th'}, 'xcopa_tr': {'acc,none': 0.512, 'acc_stderr,none': 0.02237662679792717, 'alias': ' - xcopa_tr'}, 'xcopa_vi': {'acc,none': 0.716, 'acc_stderr,none': 0.02018670369357085, 'alias': ' - xcopa_vi'}, 'xcopa_zh': {'acc,none': 0.65, 'acc_stderr,none': 0.021352091786223104, 'alias': ' - xcopa_zh'}, 'xnli': {'acc,none': 0.41204819277108434, 'acc_stderr,none': 0.051535476594892576, 'alias': 'xnli'}, 'xnli_ar': {'acc,none': 0.3377510040160643, 'acc_stderr,none': 0.009479742273956477, 'alias': ' - xnli_ar'}, 'xnli_bg': {'acc,none': 0.3779116465863454, 'acc_stderr,none': 0.009718712281227459, 'alias': ' - xnli_bg'}, 'xnli_de': {'acc,none': 0.41365461847389556, 'acc_stderr,none': 0.009871502159099368, 'alias': ' - xnli_de'}, 'xnli_el': {'acc,none': 0.3650602409638554, 'acc_stderr,none': 0.009650194822749637, 'alias': ' - xnli_el'}, 'xnli_en': {'acc,none': 0.5261044176706827, 'acc_stderr,none': 0.01000840465166064, 'alias': ' - xnli_en'}, 'xnli_es': {'acc,none': 0.4879518072289157, 'acc_stderr,none': 0.010019162857624487, 'alias': ' - xnli_es'}, 'xnli_fr': {'acc,none': 0.478714859437751, 'acc_stderr,none': 0.010012987604500423, 'alias': ' - xnli_fr'}, 'xnli_hi': {'acc,none': 0.4666666666666667, 'acc_stderr,none': 0.00999977679318763, 'alias': ' - xnli_hi'}, 'xnli_ru': {'acc,none': 0.43253012048192774, 'acc_stderr,none': 0.009930409027139453, 'alias': ' - xnli_ru'}, 'xnli_sw': {'acc,none': 0.3855421686746988, 'acc_stderr,none': 0.009755949341224318, 'alias': ' - xnli_sw'}, 'xnli_th': {'acc,none': 0.3437751004016064, 'acc_stderr,none': 0.009520310502882936, 'alias': ' - xnli_th'}, 'xnli_tr': {'acc,none': 0.3522088353413655, 'acc_stderr,none': 0.009574259292495757, 'alias': ' - xnli_tr'}, 'xnli_ur': {'acc,none': 0.42289156626506025, 'acc_stderr,none': 0.009902179034797438, 'alias': ' - xnli_ur'}, 'xnli_vi': {'acc,none': 0.44497991967871486, 'acc_stderr,none': 0.009961210239024633, 'alias': ' - xnli_vi'}, 'xnli_zh': {'acc,none': 0.3449799196787149, 'acc_stderr,none': 0.009528219800053311, 'alias': ' - xnli_zh'}, 'pawsx': {'acc,none': 0.5078571428571429, 'acc_stderr,none': 0.03988534011535243, 'alias': 'pawsx'}, 'paws_de': {'acc,none': 0.5175, 'acc_stderr,none': 0.011176284251254179, 'alias': ' - paws_de'}, 'paws_en': {'acc,none': 0.4145, 'acc_stderr,none': 0.011018419931591767, 'alias': ' - paws_en'}, 'paws_es': {'acc,none': 0.437, 'acc_stderr,none': 0.011094009127418984, 'alias': ' - paws_es'}, 'paws_fr': {'acc,none': 0.5435, 'acc_stderr,none': 0.011140733053371404, 'alias': ' - paws_fr'}, 'paws_ja': {'acc,none': 0.5575, 'acc_stderr,none': 0.01110894141174761, 'alias': ' - paws_ja'}, 'paws_ko': {'acc,none': 0.552, 'acc_stderr,none': 0.011122493197456285, 'alias': ' - paws_ko'}, 'paws_zh': {'acc,none': 0.533, 'acc_stderr,none': 0.01115875256825067, 'alias': ' - paws_zh'}, 'lambada_multilingual': {'perplexity,none': 131.45396740665825, 'perplexity_stderr,none': 95.28024178884175, 'acc,none': 0.38490199883562976, 'acc_stderr,none': 0.07608898792977997, 'alias': 'lambada_multilingual'}, 'lambada_openai_mt_de': {'perplexity,none': 370.91952810475857, 'perplexity_stderr,none': 24.98299339282566, 'acc,none': 0.23015718998641568, 'acc_stderr,none': 0.0058644241714399855, 'alias': ' - lambada_openai_mt_de'}, 'lambada_openai_mt_en': {'perplexity,none': 6.583236525584539, 'perplexity_stderr,none': 0.17481189179976453, 'acc,none': 0.5717058024451775, 'acc_stderr,none': 0.0068939712541951454, 'alias': ' - lambada_openai_mt_en'}, 'lambada_openai_mt_es': {'perplexity,none': 51.02874715706533, 'perplexity_stderr,none': 2.6341920857292744, 'acc,none': 0.36638851154667185, 'acc_stderr,none': 0.0067126579546010565, 'alias': ' - lambada_openai_mt_es'}, 'lambada_openai_mt_fr': {'perplexity,none': 29.56217917543056, 'perplexity_stderr,none': 1.5411073949753211, 'acc,none': 0.4513875412381137, 'acc_stderr,none': 0.0069329758883686235, 'alias': ' - lambada_openai_mt_fr'}, 'lambada_openai_mt_it': {'perplexity,none': 199.1761460704524, 'perplexity_stderr,none': 13.648756866456297, 'acc,none': 0.30487094896176986, 'acc_stderr,none': 0.006413613926848421, 'alias': ' - lambada_openai_mt_it'}, 'xwinograd': {'acc,none': 0.7442121825129242, 'acc_stderr,none': 0.06414679137553342, 'alias': 'xwinograd'}, 'xwinograd_en': {'acc,none': 0.8219354838709677, 'acc_stderr,none': 0.007935777723887321, 'alias': ' - xwinograd_en'}, 'xwinograd_fr': {'acc,none': 0.6987951807228916, 'acc_stderr,none': 0.0506639425494172, 'alias': ' - xwinograd_fr'}, 'xwinograd_jp': {'acc,none': 0.6037539103232534, 'acc_stderr,none': 0.015802642616557255, 'alias': ' - xwinograd_jp'}, 'xwinograd_pt': {'acc,none': 0.7680608365019012, 'acc_stderr,none': 0.026075593860304693, 'alias': ' - xwinograd_pt'}, 'xwinograd_ru': {'acc,none': 0.5714285714285714, 'acc_stderr,none': 0.02792722339076032, 'alias': ' - xwinograd_ru'}, 'xwinograd_zh': {'acc,none': 0.7559523809523809, 'acc_stderr,none': 0.01915139944664688, 'alias': ' - xwinograd_zh'}, 'xstorycloze': {'acc,none': 0.5927441188857469, 'acc_stderr,none': 0.05262352730974911, 'alias': 'xstorycloze'}, 'xstorycloze_ar': {'acc,none': 0.5883520847121112, 'acc_stderr,none': 0.01266464832921408, 'alias': ' - xstorycloze_ar'}, 'xstorycloze_en': {'acc,none': 0.7081403044341495, 'acc_stderr,none': 0.01169925603764938, 'alias': ' - xstorycloze_en'}, 'xstorycloze_es': {'acc,none': 0.6598279285241562, 'acc_stderr,none': 0.012192034998028832, 'alias': ' - xstorycloze_es'}, 'xstorycloze_eu': {'acc,none': 0.57114493712773, 'acc_stderr,none': 0.012736202713147777, 'alias': ' - xstorycloze_eu'}, 'xstorycloze_hi': {'acc,none': 0.6048974189278623, 'acc_stderr,none': 0.012580772976133262, 'alias': ' - xstorycloze_hi'}, 'xstorycloze_id': {'acc,none': 0.6419589675711449, 'acc_stderr,none': 0.012337624883487575, 'alias': ' - xstorycloze_id'}, 'xstorycloze_my': {'acc,none': 0.48378557246856385, 'acc_stderr,none': 0.012860357805055867, 'alias': ' - xstorycloze_my'}, 'xstorycloze_ru': {'acc,none': 0.5268034414295168, 'acc_stderr,none': 0.012848623899505765, 'alias': ' - xstorycloze_ru'}, 'xstorycloze_sw': {'acc,none': 0.5413633355393779, 'acc_stderr,none': 0.012823020340169822, 'alias': ' - xstorycloze_sw'}, 'xstorycloze_te': {'acc,none': 0.5744540039708802, 'acc_stderr,none': 0.012723670419166326, 'alias': ' - xstorycloze_te'}, 'xstorycloze_zh': {'acc,none': 0.6194573130377233, 'acc_stderr,none': 0.012494500786685344, 'alias': ' - xstorycloze_zh'}}, 'groups': {'xcopa': {'acc,none': 0.5709090909090908, 'acc_stderr,none': 0.06135942275478038, 'alias': 'xcopa'}, 'xnli': {'acc,none': 0.41204819277108434, 'acc_stderr,none': 0.051535476594892576, 'alias': 'xnli'}, 'pawsx': {'acc,none': 0.5078571428571429, 'acc_stderr,none': 0.03988534011535243, 'alias': 'pawsx'}, 'lambada_multilingual': {'perplexity,none': 131.45396740665825, 'perplexity_stderr,none': 95.28024178884175, 'acc,none': 0.38490199883562976, 'acc_stderr,none': 0.07608898792977997, 'alias': 'lambada_multilingual'}, 'xwinograd': {'acc,none': 0.7442121825129242, 'acc_stderr,none': 0.06414679137553342, 'alias': 'xwinograd'}, 'xstorycloze': {'acc,none': 0.5927441188857469, 'acc_stderr,none': 0.05262352730974911, 'alias': 'xstorycloze'}}}}}\n"
82
+ ]
83
+ }
84
+ ],
85
+ "source": [
86
+ "import json\n",
87
+ "\n",
88
+ "# Global result map if it's not set\n",
89
+ "if 'global_result_map' not in globals():\n",
90
+ " global_result_map = {}\n",
91
+ "\n",
92
+ "#\n",
93
+ "# Function to process the results.json file\n",
94
+ "#\n",
95
+ "def process_results_json(file_path):\n",
96
+ " with open(file_path) as f:\n",
97
+ " data = json.load(f)\n",
98
+ "\n",
99
+ " # Model args, presplit by ','\n",
100
+ " model_args = data['config']['model_args'].split(',')\n",
101
+ "\n",
102
+ " # Extract the pretrained value from config.model_args\n",
103
+ " modelname = model_args[0].split('=')[1]\n",
104
+ "\n",
105
+ " # Opt array\n",
106
+ " confArgsArr = model_args[1:]\n",
107
+ "\n",
108
+ " # Sort the opt array\n",
109
+ " confArgsArr.sort()\n",
110
+ " # Convert it to a string\n",
111
+ " confStr = ','.join(confArgsArr)\n",
112
+ "\n",
113
+ " # Convert the option array of key=value strings to a dictionary\n",
114
+ " confObj = { }\n",
115
+ " for o in confArgsArr:\n",
116
+ " k, v = o.split('=')\n",
117
+ " confObj[k] = v\n",
118
+ " \n",
119
+ " # Create a dictionary to store the results, or use the existing one if it exists\n",
120
+ " if modelname in global_result_map:\n",
121
+ " modelObj = global_result_map[modelname]\n",
122
+ " else:\n",
123
+ " modelObj = {\n",
124
+ " 'name': modelname,\n",
125
+ " 'config': { }\n",
126
+ " }\n",
127
+ " \n",
128
+ " # Get the opt object for the model\n",
129
+ " if confStr in modelObj['config']:\n",
130
+ " confSet = modelObj['config'][confStr]\n",
131
+ " else:\n",
132
+ " confSet = {\n",
133
+ " 'confStr': confStr,\n",
134
+ " 'confObj': confObj,\n",
135
+ " 'results': {},\n",
136
+ " 'groups': {}\n",
137
+ " }\n",
138
+ "\n",
139
+ " # Iterate over the results and extract the result object for each test/group\n",
140
+ " if 'results' in data:\n",
141
+ " for test, result in data['results'].items():\n",
142
+ " confSet['results'][test] = result\n",
143
+ " if 'groups' in data:\n",
144
+ " for test, result in data['groups'].items():\n",
145
+ " confSet['groups'][test] = result\n",
146
+ " \n",
147
+ " # Update the global result map object\n",
148
+ " modelObj['config'][confStr] = confSet\n",
149
+ " global_result_map[modelname] = modelObj\n",
150
+ " return modelObj\n",
151
+ "\n",
152
+ "# Lets test the function with the first results.json file\n",
153
+ "first_result = process_results_json(results_json_files[0])\n",
154
+ "print(f\"Processed example: \", first_result)\n"
155
+ ]
156
+ },
157
+ {
158
+ "cell_type": "code",
159
+ "execution_count": 50,
160
+ "metadata": {},
161
+ "outputs": [
162
+ {
163
+ "name": "stdout",
164
+ "output_type": "stream",
165
+ "text": [
166
+ "Found 36 models\n",
167
+ "Models: \n",
168
+ "['bigscience/bloom-7b1', 'togethercomputer/RedPajama-INCITE-7B-Base', 'mistralai/Mistral-7B-v0.1', 'mosaicml/mpt-7b-instruct', 'mosaicml/mpt-7b', 'mosaicml/mpt-7b-chat', 'bigscience/bloomz-7b1-mt', 'bigscience/bloomz-7b1', 'EleutherAI/pythia-2.8b', 'EleutherAI/pythia-1.4b', 'EleutherAI/gpt-j-6b', 'EleutherAI/pythia-6.9b', 'microsoft/phi-1_5', 'microsoft/phi-2', 'microsoft/phi-1', 'allenai/OLMo-7B', 'TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T', 'TinyLlama/TinyLlama-1.1B-Chat-v1.0', 'RWKV/rwkv-5-world-1b5', 'RWKV/rwkv-5-world-3b', 'RWKV/rwkv-4-world-3b', 'RWKV/rwkv-4-world-1b5', 'RWKV/rwkv-4-world-7b', 'RWKV/HF_v5-Eagle-7B', 'togethercomputer/RedPajama-INCITE-7B-Instruct', 'togethercomputer/RedPajama-INCITE-7B-Chat', 'facebook/opt-2.7b', 'facebook/opt-6.7b', 'facebook/opt-1.3b', 'tiiuae/falcon-7b-instruct', 'tiiuae/falcon-rw-1b', 'tiiuae/falcon-rw-7b', 'tiiuae/falcon-7b', 'huggyllama/llama-7b', 'meta-llama/Llama-2-7b-chat-hf', 'meta-llama/Llama-2-7b-hf']\n",
169
+ "Saved to compiled-lm-eval-results.json\n"
170
+ ]
171
+ }
172
+ ],
173
+ "source": [
174
+ "# Lets reset and reprocess all the results.json files\n",
175
+ "global_result_map = {}\n",
176
+ "\n",
177
+ "# Process all the results.json files\n",
178
+ "for file in results_json_files:\n",
179
+ " process_results_json(file)\n",
180
+ "\n",
181
+ "# Show high level list of models\n",
182
+ "print(f\"Found {len(global_result_map)} models\")\n",
183
+ "print(f\"Models: \\n{list(global_result_map.keys())}\")\n",
184
+ "\n",
185
+ "# Save the result map to a file\n",
186
+ "with open('summary/compiled-lm-eval-results.json', 'w') as f:\n",
187
+ " json.dump(global_result_map, f, sort_keys=True, indent='\\t')\n",
188
+ "\n",
189
+ "# Echo that its been saved to json\n",
190
+ "print(f\"Saved to compiled-lm-eval-results.json\")"
191
+ ]
192
+ },
193
+ {
194
+ "cell_type": "markdown",
195
+ "metadata": {},
196
+ "source": [
197
+ "### Convert the results into CSV table formats"
198
+ ]
199
+ },
200
+ {
201
+ "cell_type": "code",
202
+ "execution_count": 56,
203
+ "metadata": {},
204
+ "outputs": [
205
+ {
206
+ "data": {
207
+ "text/html": [
208
+ "<div>\n",
209
+ "<style scoped>\n",
210
+ " .dataframe tbody tr th:only-of-type {\n",
211
+ " vertical-align: middle;\n",
212
+ " }\n",
213
+ "\n",
214
+ " .dataframe tbody tr th {\n",
215
+ " vertical-align: top;\n",
216
+ " }\n",
217
+ "\n",
218
+ " .dataframe thead th {\n",
219
+ " text-align: right;\n",
220
+ " }\n",
221
+ "</style>\n",
222
+ "<table border=\"1\" class=\"dataframe\">\n",
223
+ " <thead>\n",
224
+ " <tr style=\"text-align: right;\">\n",
225
+ " <th></th>\n",
226
+ " <th>model</th>\n",
227
+ " <th>avg_acc</th>\n",
228
+ " <th>avg_acc_stderr</th>\n",
229
+ " <th>xcopa (acc)</th>\n",
230
+ " <th>xcopa (acc_stderr)</th>\n",
231
+ " </tr>\n",
232
+ " </thead>\n",
233
+ " <tbody>\n",
234
+ " <tr>\n",
235
+ " <th>0</th>\n",
236
+ " <td>bigscience/bloom-7b1</td>\n",
237
+ " <td>0.570909</td>\n",
238
+ " <td>0.061359</td>\n",
239
+ " <td>0.570909</td>\n",
240
+ " <td>0.061359</td>\n",
241
+ " </tr>\n",
242
+ " <tr>\n",
243
+ " <th>1</th>\n",
244
+ " <td>togethercomputer/RedPajama-INCITE-7B-Base</td>\n",
245
+ " <td>0.525455</td>\n",
246
+ " <td>0.036407</td>\n",
247
+ " <td>0.525455</td>\n",
248
+ " <td>0.036407</td>\n",
249
+ " </tr>\n",
250
+ " <tr>\n",
251
+ " <th>2</th>\n",
252
+ " <td>mistralai/Mistral-7B-v0.1</td>\n",
253
+ " <td>0.558727</td>\n",
254
+ " <td>0.055164</td>\n",
255
+ " <td>0.558727</td>\n",
256
+ " <td>0.055164</td>\n",
257
+ " </tr>\n",
258
+ " <tr>\n",
259
+ " <th>3</th>\n",
260
+ " <td>mosaicml/mpt-7b-instruct</td>\n",
261
+ " <td>0.537091</td>\n",
262
+ " <td>0.041919</td>\n",
263
+ " <td>0.537091</td>\n",
264
+ " <td>0.041919</td>\n",
265
+ " </tr>\n",
266
+ " <tr>\n",
267
+ " <th>4</th>\n",
268
+ " <td>mosaicml/mpt-7b</td>\n",
269
+ " <td>0.536000</td>\n",
270
+ " <td>0.042339</td>\n",
271
+ " <td>0.536000</td>\n",
272
+ " <td>0.042339</td>\n",
273
+ " </tr>\n",
274
+ " <tr>\n",
275
+ " <th>5</th>\n",
276
+ " <td>mosaicml/mpt-7b-chat</td>\n",
277
+ " <td>0.538000</td>\n",
278
+ " <td>0.047059</td>\n",
279
+ " <td>0.538000</td>\n",
280
+ " <td>0.047059</td>\n",
281
+ " </tr>\n",
282
+ " <tr>\n",
283
+ " <th>6</th>\n",
284
+ " <td>bigscience/bloomz-7b1-mt</td>\n",
285
+ " <td>0.546000</td>\n",
286
+ " <td>0.038321</td>\n",
287
+ " <td>0.546000</td>\n",
288
+ " <td>0.038321</td>\n",
289
+ " </tr>\n",
290
+ " <tr>\n",
291
+ " <th>7</th>\n",
292
+ " <td>bigscience/bloomz-7b1</td>\n",
293
+ " <td>0.547818</td>\n",
294
+ " <td>0.038920</td>\n",
295
+ " <td>0.547818</td>\n",
296
+ " <td>0.038920</td>\n",
297
+ " </tr>\n",
298
+ " <tr>\n",
299
+ " <th>8</th>\n",
300
+ " <td>EleutherAI/pythia-2.8b</td>\n",
301
+ " <td>0.537455</td>\n",
302
+ " <td>0.026941</td>\n",
303
+ " <td>0.537455</td>\n",
304
+ " <td>0.026941</td>\n",
305
+ " </tr>\n",
306
+ " <tr>\n",
307
+ " <th>9</th>\n",
308
+ " <td>EleutherAI/pythia-1.4b</td>\n",
309
+ " <td>0.526545</td>\n",
310
+ " <td>0.027441</td>\n",
311
+ " <td>0.526545</td>\n",
312
+ " <td>0.027441</td>\n",
313
+ " </tr>\n",
314
+ " <tr>\n",
315
+ " <th>10</th>\n",
316
+ " <td>EleutherAI/gpt-j-6b</td>\n",
317
+ " <td>0.544182</td>\n",
318
+ " <td>0.034404</td>\n",
319
+ " <td>0.544182</td>\n",
320
+ " <td>0.034404</td>\n",
321
+ " </tr>\n",
322
+ " <tr>\n",
323
+ " <th>11</th>\n",
324
+ " <td>EleutherAI/pythia-6.9b</td>\n",
325
+ " <td>0.540545</td>\n",
326
+ " <td>0.029689</td>\n",
327
+ " <td>0.540545</td>\n",
328
+ " <td>0.029689</td>\n",
329
+ " </tr>\n",
330
+ " <tr>\n",
331
+ " <th>12</th>\n",
332
+ " <td>microsoft/phi-1_5</td>\n",
333
+ " <td>0.521636</td>\n",
334
+ " <td>0.026198</td>\n",
335
+ " <td>0.521636</td>\n",
336
+ " <td>0.026198</td>\n",
337
+ " </tr>\n",
338
+ " <tr>\n",
339
+ " <th>13</th>\n",
340
+ " <td>microsoft/phi-2</td>\n",
341
+ " <td>0.512182</td>\n",
342
+ " <td>0.029742</td>\n",
343
+ " <td>0.512182</td>\n",
344
+ " <td>0.029742</td>\n",
345
+ " </tr>\n",
346
+ " <tr>\n",
347
+ " <th>14</th>\n",
348
+ " <td>microsoft/phi-1</td>\n",
349
+ " <td>0.517636</td>\n",
350
+ " <td>0.029612</td>\n",
351
+ " <td>0.517636</td>\n",
352
+ " <td>0.029612</td>\n",
353
+ " </tr>\n",
354
+ " <tr>\n",
355
+ " <th>15</th>\n",
356
+ " <td>allenai/OLMo-7B</td>\n",
357
+ " <td>0.537818</td>\n",
358
+ " <td>0.034147</td>\n",
359
+ " <td>0.537818</td>\n",
360
+ " <td>0.034147</td>\n",
361
+ " </tr>\n",
362
+ " <tr>\n",
363
+ " <th>16</th>\n",
364
+ " <td>TinyLlama/TinyLlama-1.1B-intermediate-step-143...</td>\n",
365
+ " <td>0.529273</td>\n",
366
+ " <td>0.029316</td>\n",
367
+ " <td>0.529273</td>\n",
368
+ " <td>0.029316</td>\n",
369
+ " </tr>\n",
370
+ " <tr>\n",
371
+ " <th>17</th>\n",
372
+ " <td>TinyLlama/TinyLlama-1.1B-Chat-v1.0</td>\n",
373
+ " <td>0.528909</td>\n",
374
+ " <td>0.031702</td>\n",
375
+ " <td>0.528909</td>\n",
376
+ " <td>0.031702</td>\n",
377
+ " </tr>\n",
378
+ " <tr>\n",
379
+ " <th>18</th>\n",
380
+ " <td>RWKV/rwkv-5-world-1b5</td>\n",
381
+ " <td>0.578909</td>\n",
382
+ " <td>0.045103</td>\n",
383
+ " <td>0.578909</td>\n",
384
+ " <td>0.045103</td>\n",
385
+ " </tr>\n",
386
+ " <tr>\n",
387
+ " <th>19</th>\n",
388
+ " <td>RWKV/rwkv-5-world-3b</td>\n",
389
+ " <td>0.590182</td>\n",
390
+ " <td>0.056241</td>\n",
391
+ " <td>0.590182</td>\n",
392
+ " <td>0.056241</td>\n",
393
+ " </tr>\n",
394
+ " <tr>\n",
395
+ " <th>20</th>\n",
396
+ " <td>RWKV/rwkv-4-world-3b</td>\n",
397
+ " <td>0.575455</td>\n",
398
+ " <td>0.040977</td>\n",
399
+ " <td>0.575455</td>\n",
400
+ " <td>0.040977</td>\n",
401
+ " </tr>\n",
402
+ " <tr>\n",
403
+ " <th>21</th>\n",
404
+ " <td>RWKV/rwkv-4-world-1b5</td>\n",
405
+ " <td>0.554000</td>\n",
406
+ " <td>0.039406</td>\n",
407
+ " <td>0.554000</td>\n",
408
+ " <td>0.039406</td>\n",
409
+ " </tr>\n",
410
+ " <tr>\n",
411
+ " <th>22</th>\n",
412
+ " <td>RWKV/rwkv-4-world-7b</td>\n",
413
+ " <td>0.601455</td>\n",
414
+ " <td>0.053116</td>\n",
415
+ " <td>0.601455</td>\n",
416
+ " <td>0.053116</td>\n",
417
+ " </tr>\n",
418
+ " <tr>\n",
419
+ " <th>23</th>\n",
420
+ " <td>RWKV/HF_v5-Eagle-7B</td>\n",
421
+ " <td>0.621818</td>\n",
422
+ " <td>0.068986</td>\n",
423
+ " <td>0.621818</td>\n",
424
+ " <td>0.068986</td>\n",
425
+ " </tr>\n",
426
+ " <tr>\n",
427
+ " <th>24</th>\n",
428
+ " <td>togethercomputer/RedPajama-INCITE-7B-Instruct</td>\n",
429
+ " <td>0.528545</td>\n",
430
+ " <td>0.036470</td>\n",
431
+ " <td>0.528545</td>\n",
432
+ " <td>0.036470</td>\n",
433
+ " </tr>\n",
434
+ " <tr>\n",
435
+ " <th>25</th>\n",
436
+ " <td>togethercomputer/RedPajama-INCITE-7B-Chat</td>\n",
437
+ " <td>0.535455</td>\n",
438
+ " <td>0.038723</td>\n",
439
+ " <td>0.535455</td>\n",
440
+ " <td>0.038723</td>\n",
441
+ " </tr>\n",
442
+ " <tr>\n",
443
+ " <th>26</th>\n",
444
+ " <td>facebook/opt-2.7b</td>\n",
445
+ " <td>0.521818</td>\n",
446
+ " <td>0.029821</td>\n",
447
+ " <td>0.521818</td>\n",
448
+ " <td>0.029821</td>\n",
449
+ " </tr>\n",
450
+ " <tr>\n",
451
+ " <th>27</th>\n",
452
+ " <td>facebook/opt-6.7b</td>\n",
453
+ " <td>0.522909</td>\n",
454
+ " <td>0.027216</td>\n",
455
+ " <td>0.522909</td>\n",
456
+ " <td>0.027216</td>\n",
457
+ " </tr>\n",
458
+ " <tr>\n",
459
+ " <th>28</th>\n",
460
+ " <td>facebook/opt-1.3b</td>\n",
461
+ " <td>0.521818</td>\n",
462
+ " <td>0.029112</td>\n",
463
+ " <td>0.521818</td>\n",
464
+ " <td>0.029112</td>\n",
465
+ " </tr>\n",
466
+ " <tr>\n",
467
+ " <th>29</th>\n",
468
+ " <td>tiiuae/falcon-7b-instruct</td>\n",
469
+ " <td>0.536727</td>\n",
470
+ " <td>0.053430</td>\n",
471
+ " <td>0.536727</td>\n",
472
+ " <td>0.053430</td>\n",
473
+ " </tr>\n",
474
+ " <tr>\n",
475
+ " <th>30</th>\n",
476
+ " <td>tiiuae/falcon-rw-1b</td>\n",
477
+ " <td>0.522545</td>\n",
478
+ " <td>0.029446</td>\n",
479
+ " <td>0.522545</td>\n",
480
+ " <td>0.029446</td>\n",
481
+ " </tr>\n",
482
+ " <tr>\n",
483
+ " <th>31</th>\n",
484
+ " <td>tiiuae/falcon-rw-7b</td>\n",
485
+ " <td>0.535818</td>\n",
486
+ " <td>0.033185</td>\n",
487
+ " <td>0.535818</td>\n",
488
+ " <td>0.033185</td>\n",
489
+ " </tr>\n",
490
+ " <tr>\n",
491
+ " <th>32</th>\n",
492
+ " <td>tiiuae/falcon-7b</td>\n",
493
+ " <td>0.559636</td>\n",
494
+ " <td>0.071650</td>\n",
495
+ " <td>0.559636</td>\n",
496
+ " <td>0.071650</td>\n",
497
+ " </tr>\n",
498
+ " <tr>\n",
499
+ " <th>33</th>\n",
500
+ " <td>huggyllama/llama-7b</td>\n",
501
+ " <td>0.541818</td>\n",
502
+ " <td>0.040718</td>\n",
503
+ " <td>0.541818</td>\n",
504
+ " <td>0.040718</td>\n",
505
+ " </tr>\n",
506
+ " <tr>\n",
507
+ " <th>34</th>\n",
508
+ " <td>meta-llama/Llama-2-7b-chat-hf</td>\n",
509
+ " <td>0.000000</td>\n",
510
+ " <td>0.000000</td>\n",
511
+ " <td>NaN</td>\n",
512
+ " <td>NaN</td>\n",
513
+ " </tr>\n",
514
+ " <tr>\n",
515
+ " <th>35</th>\n",
516
+ " <td>meta-llama/Llama-2-7b-hf</td>\n",
517
+ " <td>0.566727</td>\n",
518
+ " <td>0.052515</td>\n",
519
+ " <td>0.566727</td>\n",
520
+ " <td>0.052515</td>\n",
521
+ " </tr>\n",
522
+ " </tbody>\n",
523
+ "</table>\n",
524
+ "</div>"
525
+ ],
526
+ "text/plain": [
527
+ " model avg_acc \\\n",
528
+ "0 bigscience/bloom-7b1 0.570909 \n",
529
+ "1 togethercomputer/RedPajama-INCITE-7B-Base 0.525455 \n",
530
+ "2 mistralai/Mistral-7B-v0.1 0.558727 \n",
531
+ "3 mosaicml/mpt-7b-instruct 0.537091 \n",
532
+ "4 mosaicml/mpt-7b 0.536000 \n",
533
+ "5 mosaicml/mpt-7b-chat 0.538000 \n",
534
+ "6 bigscience/bloomz-7b1-mt 0.546000 \n",
535
+ "7 bigscience/bloomz-7b1 0.547818 \n",
536
+ "8 EleutherAI/pythia-2.8b 0.537455 \n",
537
+ "9 EleutherAI/pythia-1.4b 0.526545 \n",
538
+ "10 EleutherAI/gpt-j-6b 0.544182 \n",
539
+ "11 EleutherAI/pythia-6.9b 0.540545 \n",
540
+ "12 microsoft/phi-1_5 0.521636 \n",
541
+ "13 microsoft/phi-2 0.512182 \n",
542
+ "14 microsoft/phi-1 0.517636 \n",
543
+ "15 allenai/OLMo-7B 0.537818 \n",
544
+ "16 TinyLlama/TinyLlama-1.1B-intermediate-step-143... 0.529273 \n",
545
+ "17 TinyLlama/TinyLlama-1.1B-Chat-v1.0 0.528909 \n",
546
+ "18 RWKV/rwkv-5-world-1b5 0.578909 \n",
547
+ "19 RWKV/rwkv-5-world-3b 0.590182 \n",
548
+ "20 RWKV/rwkv-4-world-3b 0.575455 \n",
549
+ "21 RWKV/rwkv-4-world-1b5 0.554000 \n",
550
+ "22 RWKV/rwkv-4-world-7b 0.601455 \n",
551
+ "23 RWKV/HF_v5-Eagle-7B 0.621818 \n",
552
+ "24 togethercomputer/RedPajama-INCITE-7B-Instruct 0.528545 \n",
553
+ "25 togethercomputer/RedPajama-INCITE-7B-Chat 0.535455 \n",
554
+ "26 facebook/opt-2.7b 0.521818 \n",
555
+ "27 facebook/opt-6.7b 0.522909 \n",
556
+ "28 facebook/opt-1.3b 0.521818 \n",
557
+ "29 tiiuae/falcon-7b-instruct 0.536727 \n",
558
+ "30 tiiuae/falcon-rw-1b 0.522545 \n",
559
+ "31 tiiuae/falcon-rw-7b 0.535818 \n",
560
+ "32 tiiuae/falcon-7b 0.559636 \n",
561
+ "33 huggyllama/llama-7b 0.541818 \n",
562
+ "34 meta-llama/Llama-2-7b-chat-hf 0.000000 \n",
563
+ "35 meta-llama/Llama-2-7b-hf 0.566727 \n",
564
+ "\n",
565
+ " avg_acc_stderr xcopa (acc) xcopa (acc_stderr) \n",
566
+ "0 0.061359 0.570909 0.061359 \n",
567
+ "1 0.036407 0.525455 0.036407 \n",
568
+ "2 0.055164 0.558727 0.055164 \n",
569
+ "3 0.041919 0.537091 0.041919 \n",
570
+ "4 0.042339 0.536000 0.042339 \n",
571
+ "5 0.047059 0.538000 0.047059 \n",
572
+ "6 0.038321 0.546000 0.038321 \n",
573
+ "7 0.038920 0.547818 0.038920 \n",
574
+ "8 0.026941 0.537455 0.026941 \n",
575
+ "9 0.027441 0.526545 0.027441 \n",
576
+ "10 0.034404 0.544182 0.034404 \n",
577
+ "11 0.029689 0.540545 0.029689 \n",
578
+ "12 0.026198 0.521636 0.026198 \n",
579
+ "13 0.029742 0.512182 0.029742 \n",
580
+ "14 0.029612 0.517636 0.029612 \n",
581
+ "15 0.034147 0.537818 0.034147 \n",
582
+ "16 0.029316 0.529273 0.029316 \n",
583
+ "17 0.031702 0.528909 0.031702 \n",
584
+ "18 0.045103 0.578909 0.045103 \n",
585
+ "19 0.056241 0.590182 0.056241 \n",
586
+ "20 0.040977 0.575455 0.040977 \n",
587
+ "21 0.039406 0.554000 0.039406 \n",
588
+ "22 0.053116 0.601455 0.053116 \n",
589
+ "23 0.068986 0.621818 0.068986 \n",
590
+ "24 0.036470 0.528545 0.036470 \n",
591
+ "25 0.038723 0.535455 0.038723 \n",
592
+ "26 0.029821 0.521818 0.029821 \n",
593
+ "27 0.027216 0.522909 0.027216 \n",
594
+ "28 0.029112 0.521818 0.029112 \n",
595
+ "29 0.053430 0.536727 0.053430 \n",
596
+ "30 0.029446 0.522545 0.029446 \n",
597
+ "31 0.033185 0.535818 0.033185 \n",
598
+ "32 0.071650 0.559636 0.071650 \n",
599
+ "33 0.040718 0.541818 0.040718 \n",
600
+ "34 0.000000 NaN NaN \n",
601
+ "35 0.052515 0.566727 0.052515 "
602
+ ]
603
+ },
604
+ "execution_count": 56,
605
+ "metadata": {},
606
+ "output_type": "execute_result"
607
+ }
608
+ ],
609
+ "source": [
610
+ "# Lets convert this into a table, which we will display in this notebook, and save as a CSV\n",
611
+ "import pandas as pd\n",
612
+ "\n",
613
+ "##################################################\n",
614
+ "#\n",
615
+ "# Utility functions\n",
616
+ "#\n",
617
+ "##################################################\n",
618
+ "\n",
619
+ "# Check if the given name string, is within the list, including \"*\" wildcard\n",
620
+ "def is_in_list(name, list):\n",
621
+ " for n in list:\n",
622
+ " if n[-1] == '*':\n",
623
+ " if name.startswith(n[:-1]):\n",
624
+ " return True\n",
625
+ " elif n == name:\n",
626
+ " return True\n",
627
+ " return False\n",
628
+ "\n",
629
+ "# Is in inclusion exclusion list pair\n",
630
+ "def is_in_list_pair(name, inList, exList):\n",
631
+ " if not is_in_list(name, inList):\n",
632
+ " return False\n",
633
+ " if is_in_list(name, exList):\n",
634
+ " return False\n",
635
+ " return True\n",
636
+ "\n",
637
+ "# Prepare a single test/group result object\n",
638
+ "# By applying common filtering and formatting changes\n",
639
+ "def prepare_test_result(result):\n",
640
+ " # The reutrn object\n",
641
+ " ret = {}\n",
642
+ " # Iterate the result key/value\n",
643
+ " for k, v in result.items():\n",
644
+ " # Skip if its alias\n",
645
+ " if k == 'alias':\n",
646
+ " continue\n",
647
+ "\n",
648
+ " # If the key ends with \",none\", drop the \",none\"\n",
649
+ " if k.endswith(',none'):\n",
650
+ " k = k[:-5]\n",
651
+ " \n",
652
+ " # Save the result\n",
653
+ " ret[k] = v\n",
654
+ " \n",
655
+ " # Return the result\n",
656
+ " return ret\n",
657
+ "\n",
658
+ "##################################################\n",
659
+ "#\n",
660
+ "# Generate the result\n",
661
+ "#\n",
662
+ "##################################################\n",
663
+ "\n",
664
+ "# Create a list of rows for the table\n",
665
+ "def generate_result_table(\n",
666
+ " inConfig = { \"dtype\": \"bfloat16\" },\n",
667
+ "\n",
668
+ " # Results and groups to include\n",
669
+ " inResults = [],\n",
670
+ " inGroups = [\"*\"],\n",
671
+ "\n",
672
+ " # Exclude results and groups, applied after inResults and inGroups\n",
673
+ " exResults = [],\n",
674
+ " exGroups = [],\n",
675
+ "\n",
676
+ " # Sorted\n",
677
+ " sort = False\n",
678
+ "):\n",
679
+ " table_rows = []\n",
680
+ "\n",
681
+ " # Iterate over the models\n",
682
+ " for model, modelObj in global_result_map.items():\n",
683
+ " # Iterate over the configurations\n",
684
+ " for confStr, confSet in modelObj['config'].items():\n",
685
+ " # Get the confObj\n",
686
+ " confObj = confSet['confObj']\n",
687
+ "\n",
688
+ " # Check if the inConfig, matches the confObj\n",
689
+ " if inConfig:\n",
690
+ " skip = False\n",
691
+ " for k, v in inConfig.items():\n",
692
+ " if k not in confObj or confObj[k] != v:\n",
693
+ " skip = True\n",
694
+ " break\n",
695
+ " if skip:\n",
696
+ " continue\n",
697
+ "\n",
698
+ " # Create a row object\n",
699
+ " row = {\n",
700
+ " 'model': model,\n",
701
+ " # 'config': confStr\n",
702
+ "\n",
703
+ " \"avg_acc\": 0.0,\n",
704
+ " \"avg_acc_stderr\": 0.0,\n",
705
+ " }\n",
706
+ "\n",
707
+ " # Total acc / acc_stderr\n",
708
+ " acc_total = 0.0\n",
709
+ " acc_count = 0\n",
710
+ " acc_stderr_total = 0.0\n",
711
+ " acc_stderr_count = 0\n",
712
+ "\n",
713
+ " # Add the groups\n",
714
+ " for test, result in confSet['groups'].items():\n",
715
+ "\n",
716
+ " # Skip if not in the inGroups or exGroups\n",
717
+ " if not is_in_list_pair(test, inGroups, exGroups):\n",
718
+ " continue\n",
719
+ "\n",
720
+ " # Filter the result obj\n",
721
+ " cleanResult = prepare_test_result(result)\n",
722
+ "\n",
723
+ " # Add the result to the row, as seperate columns for each key\n",
724
+ " for k, v in cleanResult.items():\n",
725
+ " row[f\"{test} ({k})\"] = v\n",
726
+ "\n",
727
+ " if k == 'acc':\n",
728
+ " acc_total += v\n",
729
+ " acc_count += 1\n",
730
+ " elif k == 'acc_stderr':\n",
731
+ " acc_stderr_total += v\n",
732
+ " acc_stderr_count += 1\n",
733
+ "\n",
734
+ " # Add the results\n",
735
+ " for test, result in confSet['results'].items():\n",
736
+ "\n",
737
+ " # Skip if not in the inResults or exResults\n",
738
+ " if not is_in_list_pair(test, inResults, exResults):\n",
739
+ " continue\n",
740
+ "\n",
741
+ " # Filter the result obj\n",
742
+ " cleanResult = prepare_test_result(result)\n",
743
+ "\n",
744
+ " # Add the result to the row, as seperate columns for each key\n",
745
+ " for k, v in cleanResult.items():\n",
746
+ " row[f\"{test} ({k})\"] = v\n",
747
+ "\n",
748
+ " if k == 'acc':\n",
749
+ " acc_total += v\n",
750
+ " acc_count += 1\n",
751
+ " elif k == 'acc_stderr':\n",
752
+ " acc_stderr_total += v\n",
753
+ " acc_stderr_count += 1\n",
754
+ " \n",
755
+ " # Add the avg acc and acc_stderr\n",
756
+ " if acc_count > 0:\n",
757
+ " row[\"avg_acc\"] = acc_total / acc_count\n",
758
+ " if acc_stderr_count > 0:\n",
759
+ " row[\"avg_acc_stderr\"] = acc_stderr_total / acc_stderr_count\n",
760
+ "\n",
761
+ " # Append the row to the table\n",
762
+ " table_rows.append(row)\n",
763
+ "\n",
764
+ " # Create a dataframe from the table rows\n",
765
+ " df = pd.DataFrame(table_rows)\n",
766
+ "\n",
767
+ " # Sort by avg_acc\n",
768
+ " if sort:\n",
769
+ " df = df.sort_values(by='avg_acc', ascending=False)\n",
770
+ "\n",
771
+ " # Show the dataframe\n",
772
+ " return df\n",
773
+ "\n",
774
+ "# Generate the dataframe\n",
775
+ "df = generate_result_table( inConfig = { \"dtype\": \"bfloat16\" }, inGroups=[\"xcopa\"], inResults=[] )\n",
776
+ "\n",
777
+ "# # Save the dataframe to a CSV file\n",
778
+ "# df.to_csv('summary/compiled-lm-eval-results.csv', index=False)\n",
779
+ "\n",
780
+ "# Show results\n",
781
+ "df\n"
782
+ ]
783
+ },
784
+ {
785
+ "cell_type": "code",
786
+ "execution_count": 58,
787
+ "metadata": {},
788
+ "outputs": [
789
+ {
790
+ "name": "stdout",
791
+ "output_type": "stream",
792
+ "text": [
793
+ "total 13472\n",
794
+ "-rw-r--r--@ 1 picocreator staff 841504 Feb 22 13:33 bf16-all-results-and-groups.csv\n",
795
+ "-rw-r--r-- 1 picocreator staff 768190 Feb 22 13:33 bf16-eng-results.csv\n",
796
+ "-rw-r--r--@ 1 picocreator staff 64695 Feb 22 13:33 bf16-eng-summary.csv\n",
797
+ "-rw-r--r--@ 1 picocreator staff 85450 Feb 22 13:33 bf16-multilang-results.csv\n",
798
+ "-rw-r--r--@ 1 picocreator staff 12083 Feb 22 13:33 bf16-multilang-summary.csv\n",
799
+ "-rw-r--r-- 1 picocreator staff 768190 Feb 22 13:33 bf16-sorted-eng-results.csv\n",
800
+ "-rw-r--r-- 1 picocreator staff 12083 Feb 22 13:33 bf16-sorted-multilang-summary.csv\n",
801
+ "-rw-r--r-- 1 picocreator staff 3296588 Feb 22 13:29 compiled-lm-eval-results.json\n"
802
+ ]
803
+ }
804
+ ],
805
+ "source": [
806
+ "##################################################\n",
807
+ "#\n",
808
+ "# Build the various subsets\n",
809
+ "#\n",
810
+ "##################################################\n",
811
+ "\n",
812
+ "# Overall results\n",
813
+ "all_results = generate_result_table( inConfig = { \"dtype\": \"bfloat16\" }, inGroups=[\"*\"], inResults=[\"*\"] )\n",
814
+ "all_results.to_csv('summary/bf16-all-results-and-groups.csv', index=False)\n",
815
+ "\n",
816
+ "# Multilang results\n",
817
+ "multiLang_tTest = [\"xcopa_*\", \"xnli_*\", \"xstorycloze_*\", \"xwinograd_*\", \"lambada_openai_*\", \"pawsx_*\"]\n",
818
+ "multiLang_tGrps = [\"xcopa\", \"xnli\", \"xstorycloze\", \"xwinograd\", \"lambada_multilingual\", \"pawsx\"]\n",
819
+ "\n",
820
+ "multilang_grp = generate_result_table( inConfig = { \"dtype\": \"bfloat16\" }, inGroups=multiLang_tGrps, inResults=[] )\n",
821
+ "multilang_test = generate_result_table( inConfig = { \"dtype\": \"bfloat16\" }, inGroups=multiLang_tGrps, inResults=multiLang_tTest )\n",
822
+ "multilang_grp.to_csv('summary/bf16-multilang-summary.csv', index=False)\n",
823
+ "multilang_test.to_csv('summary/bf16-multilang-results.csv', index=False)\n",
824
+ "\n",
825
+ "multilang_grp_sorted = generate_result_table( inConfig = { \"dtype\": \"bfloat16\" }, inGroups=multiLang_tGrps, inResults=[], sort=True )\n",
826
+ "multilang_grp_sorted.to_csv('summary/bf16-sorted-multilang-summary.csv', index=False)\n",
827
+ "\n",
828
+ "# All other results\n",
829
+ "eng_grp = generate_result_table( inConfig = { \"dtype\": \"bfloat16\" }, inGroups=[\"*\"], inResults=[], exGroups=multiLang_tGrps )\n",
830
+ "eng_test = generate_result_table( inConfig = { \"dtype\": \"bfloat16\" }, inGroups=[\"*\"], inResults=[\"*\"], exGroups=multiLang_tGrps, exResults=multiLang_tTest )\n",
831
+ "eng_test_sorted = generate_result_table( inConfig = { \"dtype\": \"bfloat16\" }, inGroups=[\"*\"], inResults=[\"*\"], exGroups=multiLang_tGrps, exResults=multiLang_tTest, sort=True )\n",
832
+ "\n",
833
+ "eng_grp.to_csv('summary/bf16-eng-summary.csv', index=False)\n",
834
+ "eng_test.to_csv('summary/bf16-eng-results.csv', index=False)\n",
835
+ "eng_test_sorted.to_csv('summary/bf16-sorted-eng-results.csv', index=False)\n",
836
+ "\n",
837
+ "# List the files\n",
838
+ "!ls -lh summary"
839
+ ]
840
+ }
841
+ ],
842
+ "metadata": {
843
+ "kernelspec": {
844
+ "display_name": "Python 3",
845
+ "language": "python",
846
+ "name": "python3"
847
+ },
848
+ "language_info": {
849
+ "codemirror_mode": {
850
+ "name": "ipython",
851
+ "version": 3
852
+ },
853
+ "file_extension": ".py",
854
+ "mimetype": "text/x-python",
855
+ "name": "python",
856
+ "nbconvert_exporter": "python",
857
+ "pygments_lexer": "ipython3",
858
+ "version": "3.9.6"
859
+ }
860
+ },
861
+ "nbformat": 4,
862
+ "nbformat_minor": 2
863
+ }
summary/bf16-all-results-and-groups.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b51fed6f12f96793d355f036bc05e4cb525567285952404ddb1ea548d0d349e6
3
+ size 841504
summary/bf16-eng-results.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:46a5d04a4470f36b0e97e671f879c8f76069d32142dddcef6e3ebd27fd82fbba
3
+ size 768190
summary/bf16-eng-summary.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6575764c4415fb3ac5a654d677e6f87c3cdf0da7a78624791d254b18199619ae
3
+ size 64695
summary/bf16-multilang-results.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4784d69b93eb5a6a2f553c5316ee97d3bc129b191b6e2473e671606a5f17e0f0
3
+ size 85450
summary/bf16-multilang-summary.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:96968d346e4ac691bc5bd002866291726d0a8b25c1aa8e81868099ee7929f3bc
3
+ size 12083
summary/bf16-sorted-eng-results.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a97c4dba38a3654d7d8464d0caceea814164e628367cebdf5cc934d65c9b16cd
3
+ size 768190
summary/bf16-sorted-multilang-summary.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:36c4f7e3f9059e3a0ab09be556b0822e80ba2b856a830357f6dc4c5b2b94011d
3
+ size 12083
summary/compiled-lm-eval-results.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:13af71e6bb88fc3987cf53bf01e13542cdf0340fcc87538724f3228f51edddf7
3
+ size 3296588