{ "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 }