File size: 4,827 Bytes
1e5e2ae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a24bc73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e09c49f
 
 
 
 
 
 
 
 
a24bc73
 
 
 
1e5e2ae
 
 
 
 
 
 
 
 
e09c49f
a24bc73
 
 
 
 
 
 
 
 
 
e09c49f
 
 
 
 
1e5e2ae
 
 
 
 
a24bc73
1e5e2ae
 
 
 
 
 
 
 
 
 
 
 
 
 
a24bc73
1e5e2ae
 
 
 
 
 
 
 
 
 
a24bc73
 
 
 
 
 
1e5e2ae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import os\n",
    "import json\n",
    "import datetime\n",
    "\n",
    "time_now = datetime.datetime.now().strftime(\"%Y-%m-%dT%H-%M-%S\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.read_csv(\"results.csv\")\n",
    "new_df = df.groupby([\"model\", \"problem\"], as_index=False)[['weighted_accuracy']].sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['Claude 2', 'Claude Instant', 'GPT 3.5 Turbo', 'GPT 4 Turbo',\n",
       "       'MPT-30b', 'Mistral-7b', 'PaLM 2', 'Phi-1.5', 'Phi-2', 'Qwen-14b',\n",
       "       'Vicuna-13b', 'Yi-34b'], dtype=object)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "new_df.model.unique()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- https://grabon.com/blog/claude-users-statistics/\n",
    "- https://medium.com/@seanbetts/peering-inside-gpt-4-understanding-its-mixture-of-experts-moe-architecture-2a42eb8bdcb3\n",
    "- https://www.cnbc.com/2023/05/16/googles-palm-2-uses-nearly-five-times-more-text-data-than-predecessor.html"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "open_models = {\n",
    "    \"Yi-34b\": \"01-ai/Yi-34B-Chat\",\n",
    "    \"Mistral-7b\": \"mistralai/Mistral-7B-Instruct-v0.1\",\n",
    "    \"Vicuna-13b\": \"lmsys/vicuna-13b-v1.3\",\n",
    "    \"Phi-1.5\": \"microsoft/phi-1_5\",\n",
    "    \"MPT-30b\": \"mosaicml/mpt-30b-instruct\",\n",
    "    \"Phi-2\": \"microsoft/phi-2\",\n",
    "    \"Qwen-14b\": \"Qwen/Qwen-14B-Chat\",\n",
    "}\n",
    "\n",
    "model_params = {\n",
    "    'Yi-34b': ('torch.bfloat16', 34.389),\n",
    "    'Mistral-7b': ('torch.bfloat16', 7.242),\n",
    "    'Vicuna-13b': ('torch.float16', 13.0),\n",
    "    'Phi-1.5': ('torch.float16', 1.3),\n",
    "    'MPT-30b': ('torch.bfloat16', 30.0),\n",
    "    'Phi-2': ('torch.float16', 2.78),\n",
    "    'Qwen-14b': ('torch.bfloat16', 14.167),\n",
    "    'Claude 2': ('?', 176),\n",
    "    'Claude Instant': ('?', 60),\n",
    "    \"GPT 3.5 Turbo\": ('?', 175),\n",
    "    \"GPT 4 Turbo\": ('?', 1760),\n",
    "    'PaLM 2': ('?', 340),\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "def result_export(model_df, model_name):\n",
    "    model_df = model_df.set_index(\"problem\")\n",
    "    model_df = model_df.drop(columns=[\"model\"])\n",
    "    model_df = model_df.to_dict(orient=\"index\")\n",
    "    convert_problem_name = lambda x: x.replace(\"_Results\", \"\").replace(\"Results\", \"\").replace(\"bsp\", \"sas\").upper()\n",
    "    model_df = {convert_problem_name(k): v for k, v in model_df.items()}\n",
    "    return model_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "for model in new_df.model.unique():   \n",
    "    model_dir = open_models[model] if model in open_models else model.replace(\" \", \"-\")\n",
    "    # os.system(f\"rm -rf {model_dir.split('/')[0]}\")\n",
    "    os.makedirs(f\"{model_dir}\", exist_ok=True)\n",
    "    model_df = new_df[new_df[\"model\"] == model]\n",
    "    model_result = result_export(model_df, model)\n",
    "    model_result = {\n",
    "        \"config\": {\n",
    "            \"model_name\": model_dir, \n",
    "            \"model_type\": \"open-source\" if model in open_models else \"close-source\",\n",
    "            \"model_dtype\": model_params[model][0] if model in model_params else \"?\",\n",
    "            \"num_params\": model_params[model][1] if model in model_params else 0,\n",
    "        },\n",
    "        \"results\": model_result\n",
    "    }\n",
    "    with open(f\"{model_dir}/results_{time_now}.json\", \"w\") as f:\n",
    "        json.dump(model_result, f, indent=4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "llm_reason",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}