388 lines
32 KiB
Plaintext
388 lines
32 KiB
Plaintext
|
|
{
|
||
|
|
"cells": [
|
||
|
|
{
|
||
|
|
"cell_type": "code",
|
||
|
|
"execution_count": 10,
|
||
|
|
"id": "cd3b4cc2-0bb3-4fba-9c92-48e40f5419c4",
|
||
|
|
"metadata": {
|
||
|
|
"tags": [
|
||
|
|
"parameters"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
"outputs": [],
|
||
|
|
"source": [
|
||
|
|
"filepattern = \"tabby/dataset/data.jsonl\"\n",
|
||
|
|
"api = \"http://localhost:8080\"\n",
|
||
|
|
"max_records = \"3\""
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"cell_type": "code",
|
||
|
|
"execution_count": 11,
|
||
|
|
"id": "f12319d9",
|
||
|
|
"metadata": {
|
||
|
|
"tags": [
|
||
|
|
"remove"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
"outputs": [],
|
||
|
|
"source": [
|
||
|
|
"max_records = int(max_records)"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"cell_type": "code",
|
||
|
|
"execution_count": 64,
|
||
|
|
"id": "172d7105-ecac-4019-bbe1-dcd70ed6af60",
|
||
|
|
"metadata": {
|
||
|
|
"tags": [
|
||
|
|
"remove"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
"outputs": [],
|
||
|
|
"source": [
|
||
|
|
"import pandas as pd\n",
|
||
|
|
"\n",
|
||
|
|
"from tabby_client import Client\n",
|
||
|
|
"from tabby_client.api.v1 import health\n",
|
||
|
|
"from tabby_client.api.v1 import completion\n",
|
||
|
|
"\n",
|
||
|
|
"from tabby_client.models import CompletionRequest, CompletionRequest, Segments, Choice\n",
|
||
|
|
"\n",
|
||
|
|
"import processing\n",
|
||
|
|
"import editdistance\n",
|
||
|
|
"import random\n",
|
||
|
|
"\n",
|
||
|
|
"\n",
|
||
|
|
"def valid_item(item: processing.Item):\n",
|
||
|
|
" count_body_lines = len(item.body.splitlines())\n",
|
||
|
|
"\n",
|
||
|
|
" if count_body_lines > 10:\n",
|
||
|
|
" return False\n",
|
||
|
|
"\n",
|
||
|
|
" return True\n",
|
||
|
|
"\n",
|
||
|
|
"\n",
|
||
|
|
"def scorer(label, prediction):\n",
|
||
|
|
" distance = editdistance.eval(label, prediction)\n",
|
||
|
|
" return max(0.0, 1.0 - distance / len(label))\n",
|
||
|
|
"\n",
|
||
|
|
"\n",
|
||
|
|
"def run_eval():\n",
|
||
|
|
" client = Client(base_url=api, timeout=50)\n",
|
||
|
|
" try:\n",
|
||
|
|
" health.sync(client=client)\n",
|
||
|
|
" except:\n",
|
||
|
|
" print(f\"Tabby Server is not ready, please check if '{api}' is correct.\")\n",
|
||
|
|
" return\n",
|
||
|
|
" \n",
|
||
|
|
" items = [x for x in processing.items_from_filepattern(filepattern) if valid_item(x)];\n",
|
||
|
|
" if len(items) > max_records:\n",
|
||
|
|
" random.seed(0xbadbeef)\n",
|
||
|
|
" items = random.sample(items, max_records)\n",
|
||
|
|
" \n",
|
||
|
|
"\n",
|
||
|
|
" for item in items:\n",
|
||
|
|
" if not valid_item(item):\n",
|
||
|
|
" continue\n",
|
||
|
|
"\n",
|
||
|
|
" request = CompletionRequest(\n",
|
||
|
|
" language=item.language, segments=Segments(prefix=item.prefix)\n",
|
||
|
|
" )\n",
|
||
|
|
"\n",
|
||
|
|
" resp: CompletionResponse = completion.sync(client=client, json_body=request)\n",
|
||
|
|
" label = item.body\n",
|
||
|
|
" prediction = resp.choices[0].text\n",
|
||
|
|
"\n",
|
||
|
|
" block_score = scorer(label, prediction)\n",
|
||
|
|
" \n",
|
||
|
|
" label_lines = label.splitlines()\n",
|
||
|
|
" prediction_lines = prediction.splitlines()\n",
|
||
|
|
" \n",
|
||
|
|
" if len(label_lines) > 0 and len(prediction_lines) > 0:\n",
|
||
|
|
" line_score = scorer(label_lines[0], prediction_lines[0])\n",
|
||
|
|
"\n",
|
||
|
|
" yield dict(\n",
|
||
|
|
" prompt=item.prefix,\n",
|
||
|
|
" prediction=prediction,\n",
|
||
|
|
" label=label,\n",
|
||
|
|
" block_score=block_score,\n",
|
||
|
|
" line_score=line_score,\n",
|
||
|
|
" )"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"cell_type": "code",
|
||
|
|
"execution_count": 65,
|
||
|
|
"id": "76c08e41-42fc-486a-96b3-5cf647635e90",
|
||
|
|
"metadata": {
|
||
|
|
"tags": [
|
||
|
|
"remove"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
"outputs": [],
|
||
|
|
"source": [
|
||
|
|
"df = pd.DataFrame(list(run_eval()))"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"cell_type": "code",
|
||
|
|
"execution_count": 66,
|
||
|
|
"id": "038f9c95-edf4-463a-a600-d1945b17c235",
|
||
|
|
"metadata": {},
|
||
|
|
"outputs": [
|
||
|
|
{
|
||
|
|
"data": {
|
||
|
|
"text/plain": [
|
||
|
|
"array([<Axes: title={'center': 'block_score'}>], dtype=object)"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
"execution_count": 66,
|
||
|
|
"metadata": {},
|
||
|
|
"output_type": "execute_result"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"data": {
|
||
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABL4AAAHDCAYAAAAqZtO0AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA4iUlEQVR4nO3de5xVdbk/8GdGh0EOjEgEyJ0U74i3UDAPpOCIaHJSLOwEImoXSYnUX1YK6Cks7yc1NVOsDqFiYKcQHREkc9SDikcsPWKopQyK5AyXHEdm/f4oRseZgdnArHEv3+/Xa/7Ya3/X3s96WK/N8/rM2msKkiRJAgAAAAAyprC1CwAAAACAliD4AgAAACCTBF8AAAAAZJLgCwAAAIBMEnwBAAAAkEmCLwAAAAAySfAFAAAAQCYJvgAAAADIJMEXAAAAAJkk+IKPqZkzZ0ZBQUG8/PLLERExbNiwGDZsWKvWBABA65o2bVoUFBTEmjVrtriub9++cfrpp7dIDS+//HIUFBTElVde2SKvD3y8CL4AAAAAyKSdW7sA4KPhgQceaO0SAAAAYIdyxRcQERFt2rSJNm3atHYZre69996Ld999t7XLAAAgA2pra+Odd95p7TLgY03wBUREw3t8LV68OAoKCuKuu+6K73//+9GzZ89o27ZtHHPMMbFixYoG+z/++ONx3HHHxa677hrt2rWLoUOHxh/+8Iec65g9e3Yceuih0aFDhygpKYkBAwbEddddV2/N22+/Hd/85jejb9++UVxcHD179oxx48bVuxfFG2+8ERMnToyuXbtG27ZtY+DAgXHHHXfUe50P3j/i2muvjT322COKi4vjj3/8Y0REPP/883HKKadEp06dom3btnHYYYfFb37zm5yPCQAg36xZsyZOPfXUKCkpiU984hNx3nnnbTXA+fOf/xxjxoyJTp06Rbt27eKII46I3/3udw3WvfPOOzFt2rTYa6+9om3btrH77rvH5z//+XjppZeafO0kSeLss8+ONm3axK9//etmH0dZWVl85jOfiY4dO0b79u1j7733ju985zs517Nhw4b41re+Fb169Yri4uLYe++948orr4wkSeq9VkFBQUyaNCn+67/+K/bff/8oLi6OBQsWRETEa6+9FmeccUZ07do1iouLY//994/bbrut2ccCbBtfdQS26PLLL4/CwsI4//zzo7KyMn70ox/Fl770pXj88cfr1jz00EMxcuTIOPTQQ2Pq1KlRWFgYt99+exx99NHx+9//PgYNGtSs9yorK4uxY8fGMcccEz/84Q8jIuJPf/pT/OEPf4jzzjsvIiLWr18fRx11VPzpT3+KM844Iw455JBYs2ZN/OY3v4m//vWv0blz5/j73/8ew4YNixUrVsSkSZOiX79+cffdd8fpp58eb7/9dt1rbXb77bfHO++8E2effXYUFxdHp06d4rnnnosjjzwyevToEd/+9rfjX/7lX+Kuu+6K0aNHxz333BP/9m//toM6DADw0XPqqadG3759Y8aMGfHYY4/Ff/7nf8bf/va3+PnPf97o+tWrV8eQIUNi48aNce6558YnPvGJuOOOO+Jzn/tczJkzp2522rRpU5xwwgmxcOHC+OIXvxjnnXderFu3LsrKymL58uWxxx57NHjtTZs2xRlnnBF33nlnzJ07N0aNGtWsY3juuefihBNOiAMPPDAuvfTSKC4ujhUrVtT75Wxz6kmSJD73uc/FokWLYuLEiXHQQQfF/fffHxdccEG89tprcc0119R734ceeijuuuuumDRpUnTu3Dn69u0bq1evjiOOOKIuGPvkJz8Z9913X0ycODGqqqpi8uTJzfyXAXKWAB9Lt99+exIRycqVK5MkSZKhQ4cmQ4cOrXt+0aJFSUQk++67b1JdXV23/brrrksiInn22WeTJEmS2trapH///klpaWlSW1tbt27jxo1Jv379khEjRjS7pvPOOy8pKSlJ3nvvvSbXXHLJJUlEJL/+9a8bPLf5/a+99tokIpJf/vKXdc+9++67yeDBg5P27dsnVVVVSZIkycqVK5OISEpKSpI33nij3msdc8wxyYABA5J33nmn3usPGTIk6d+/f7OPCQAgn0ydOjWJiORzn/tcve1f//rXk4hInnnmmSRJkqRPnz7J+PHj656fPHlyEhHJ73//+7pt69atS/r165f07ds32bRpU5IkSXLbbbclEZFcffXVDd578yy3eUa74oorkpqamuQLX/hCsssuuyT3339/TsdyzTXXJBGRvPnmm02uaU498+bNSyIi+Y//+I96z59yyilJQUFBsmLFirptEZEUFhYmzz33XL21EydOTHbfffdkzZo19bZ/8YtfTHbddddk48aNOR0b0Hy+6ghs0YQJE+rd++uoo46KiH9cyh4RsWzZsnjxxRfjtNNOi7feeivWrFkTa9asiQ0bNsQxxxwTS5Ysidra2ma9V8eOHWPDhg1RVlbW5Jp77rknBg4c2OgVVwUFBRERMX/+/OjWrVuMHTu27rmioqI499xzY/369fHwww/X2+/kk0+OT37yk3WP165dGw899FCceuqpsW7durpjeuutt6K0tDRefPHFeO2115p1TAAA+eicc86p9/gb3/hGRPxjzmrM/PnzY9CgQfGZz3ymblv79u3j7LPPjpdffrnuVhL33HNPdO7cue71PmjzLLfZu+++G2PGjInf/va3MX/+/Dj22GNzOoaOHTtGRMS9997b5DzanHrmz58fO+20U5x77rn1nv/Wt74VSZLEfffdV2/70KFDY7/99qt7nCRJ3HPPPXHiiSdGkiR1s+WaNWuitLQ0Kisr46mnnsrp2IDmE3wBW9S7d+96j3fbbbeIiPjb3/4WEREvvvhiRESMHz8+PvnJT9b7ufXWW6O6ujoqKyub9V5f//rXY6+99oqRI0dGz54944wzzqi7J8JmL730UhxwwAFbfJ1XXnkl+vfvH4WF9T/i9t1337rnP6hfv371Hq9YsSKSJImLL764wTFNnTo1Iv5xDzEAgKzq379/vcd77LFHFBYWxssvv9zo+ldeeSX23nvvBts/PH+99NJLsffee8fOO2/9rjszZsyIefPmxZw5c+rdi7a5vvCFL8SRRx4ZZ555ZnTt2jW++MUvxl133VUvBGtOPa+88kp07949OnTosMVj2+zDs+Wbb74Zb7/9dtxyyy0NZssJEyZEhNkSWpJ7fAFbtNNOOzW6PfnnjTw3Dw5XXHFFHHTQQY2ubd++fbPeq0uXLrFs2bK4//7747777ov77rsvbr/99hg3blyDG9PvSLvssku9x5uP6fzzz4/S0tJG99lzzz1brB4AgI+aD1+NlYbS0tJYsGBB/OhHP4phw4ZF27Ztc9p/l112iSVLlsSiRYvid7/7XSxYsCDuvPPOOProo+OBBx5ocs7dXk3Nlv/+7/8e48ePb3SfAw88sEVqAQRfwHbafAPSkpKSGD58+Ha/Xps2beLEE0+ME088MWpra+PrX/963HzzzXHxxRfHnnvuGXvssUcsX758i6/Rp0+f+N///d+ora2td9XX888/X/f8lnzqU5+KiH98PXJHHBMAQL558cUX6125tGLFiqitrY2+ffs2ur5Pnz7xwgsvNNj+4flrjz32iMcffzxqamqiqKhoizUcccQR8dWvfjVOOOGEGDNmTMydO7dZV4p9UGFhYRxzzDFxzDHHxNVXXx0/+MEP4rvf/W4sWrQohg8f3qx6+vTpEw8++GCsW7eu3lVfzZ0tP/nJT0aHDh1i06ZNZktoBb7qCGyXQw89NPbYY4+48sorY/369Q2ef/PNN5v9Wm+99Va9x4WFhXW//aquro6If9yP65lnnom5c+c22H/zVWjHH398VFRUxJ133ln33HvvvRc//vGPo3379jF06NAt1tGlS5cYNmxY3HzzzbFq1artOiYAgHx0ww031Hv84x//OCIiRo4c2ej6448/Pp544okoLy+v27Zhw4a45ZZbom/fvnX3vDr55JNjzZo1cf311zd4jc2z3AcNHz48Zs+eHQsWLIgvf/nLzb53bMQ/7tv6YZu/ofDB2XJr9Rx//PG
|
||
|
|
"text/plain": [
|
||
|
|
"<Figure size 1500x500 with 2 Axes>"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
"metadata": {},
|
||
|
|
"output_type": "display_data"
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"source": [
|
||
|
|
"import matplotlib.pyplot as plt\n",
|
||
|
|
"\n",
|
||
|
|
"fig, axes = plt.subplots(nrows=1, ncols=2, sharex=True, sharey=True, figsize=(15, 5))\n",
|
||
|
|
"\n",
|
||
|
|
"df.hist(\n",
|
||
|
|
" column=\"line_score\",\n",
|
||
|
|
" ax=axes[0],\n",
|
||
|
|
")\n",
|
||
|
|
"\n",
|
||
|
|
"df.hist(\n",
|
||
|
|
" column=\"block_score\",\n",
|
||
|
|
" ax=axes[1],\n",
|
||
|
|
")"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"cell_type": "code",
|
||
|
|
"execution_count": 67,
|
||
|
|
"id": "3b8d339e-4452-4e2c-823c-0f69f6eb4805",
|
||
|
|
"metadata": {},
|
||
|
|
"outputs": [
|
||
|
|
{
|
||
|
|
"data": {
|
||
|
|
"text/html": [
|
||
|
|
"<style type=\"text/css\">\n",
|
||
|
|
"#T_7cc01 td.col0 {\n",
|
||
|
|
" white-space: pre;\n",
|
||
|
|
" font-family: monospace;\n",
|
||
|
|
" text-align: left;\n",
|
||
|
|
" max-width: 400px;\n",
|
||
|
|
" overflow-x: scroll;\n",
|
||
|
|
"}\n",
|
||
|
|
"#T_7cc01 td.col1 {\n",
|
||
|
|
" white-space: pre;\n",
|
||
|
|
" font-family: monospace;\n",
|
||
|
|
" text-align: left;\n",
|
||
|
|
" max-width: 400px;\n",
|
||
|
|
" overflow-x: scroll;\n",
|
||
|
|
"}\n",
|
||
|
|
"#T_7cc01 td.col2 {\n",
|
||
|
|
" white-space: pre;\n",
|
||
|
|
" font-family: monospace;\n",
|
||
|
|
" text-align: left;\n",
|
||
|
|
" max-width: 400px;\n",
|
||
|
|
" overflow-x: scroll;\n",
|
||
|
|
"}\n",
|
||
|
|
"</style>\n",
|
||
|
|
"<table id=\"T_7cc01\">\n",
|
||
|
|
" <thead>\n",
|
||
|
|
" <tr>\n",
|
||
|
|
" <th class=\"blank level0\" > </th>\n",
|
||
|
|
" <th id=\"T_7cc01_level0_col0\" class=\"col_heading level0 col0\" >prompt</th>\n",
|
||
|
|
" <th id=\"T_7cc01_level0_col1\" class=\"col_heading level0 col1\" >prediction</th>\n",
|
||
|
|
" <th id=\"T_7cc01_level0_col2\" class=\"col_heading level0 col2\" >label</th>\n",
|
||
|
|
" <th id=\"T_7cc01_level0_col3\" class=\"col_heading level0 col3\" >block_score</th>\n",
|
||
|
|
" <th id=\"T_7cc01_level0_col4\" class=\"col_heading level0 col4\" >line_score</th>\n",
|
||
|
|
" </tr>\n",
|
||
|
|
" </thead>\n",
|
||
|
|
" <tbody>\n",
|
||
|
|
" <tr>\n",
|
||
|
|
" <th id=\"T_7cc01_level0_row0\" class=\"row_heading level0 row0\" >0</th>\n",
|
||
|
|
" <td id=\"T_7cc01_row0_col0\" class=\"data row0 col0\" > attentions=all_attentions,\n",
|
||
|
|
" cross_attentions=all_cross_attentions,\n",
|
||
|
|
" )\n",
|
||
|
|
"\n",
|
||
|
|
"\n",
|
||
|
|
"class T5ForConditionalGeneration(T5PreTrainedModel):\n",
|
||
|
|
" def __init__(self, config: T5Config, weights):\n",
|
||
|
|
" super().__init__(config)\n",
|
||
|
|
" self.model_dim = config.d_model\n",
|
||
|
|
"\n",
|
||
|
|
" try:\n",
|
||
|
|
" self.shared = TensorParallelEmbedding(prefix=\"shared\", weights=weights)\n",
|
||
|
|
" except RuntimeError:\n",
|
||
|
|
" self.shared = TensorParallelEmbedding(prefix=\"encoder.embed_tokens\", weights=weights)\n",
|
||
|
|
"\n",
|
||
|
|
" encoder_config = copy.deepcopy(config)\n",
|
||
|
|
" encoder_config.is_decoder = False\n",
|
||
|
|
" encoder_config.use_cache = False\n",
|
||
|
|
" encoder_config.is_encoder_decoder = False\n",
|
||
|
|
" self.encoder = </td>\n",
|
||
|
|
" <td id=\"T_7cc01_row0_col1\" class=\"data row0 col1\" >/*\n",
|
||
|
|
" * Copyright (c) 2008-2021, Hazelcast, Inc. All Rights Reserved.\n",
|
||
|
|
" *\n",
|
||
|
|
" * Licensed under the Apache License, Version 2.0 (the \"License\");\n",
|
||
|
|
" * you may not use this file except in compliance with the License.\n",
|
||
|
|
" * You may obtain a copy of the License at\n",
|
||
|
|
" *\n",
|
||
|
|
" * http://www.apache.org/licenses/LICENSE-2.0\n",
|
||
|
|
" *\n",
|
||
|
|
" * Unless required by applicable law or agreed to in writing, software\n",
|
||
|
|
" * distributed under the License is distributed on an \"AS IS\" BASIS,</td>\n",
|
||
|
|
" <td id=\"T_7cc01_row0_col2\" class=\"data row0 col2\" >T5Stack(\n",
|
||
|
|
" config=encoder_config,\n",
|
||
|
|
" prefix=\"encoder\",\n",
|
||
|
|
" weights=weights,\n",
|
||
|
|
" embed_tokens=self.shared,\n",
|
||
|
|
" )</td>\n",
|
||
|
|
" <td id=\"T_7cc01_row0_col3\" class=\"data row0 col3\" >0.000000</td>\n",
|
||
|
|
" <td id=\"T_7cc01_row0_col4\" class=\"data row0 col4\" >0.000000</td>\n",
|
||
|
|
" </tr>\n",
|
||
|
|
" <tr>\n",
|
||
|
|
" <th id=\"T_7cc01_level0_row1\" class=\"row_heading level0 row1\" >1</th>\n",
|
||
|
|
" <td id=\"T_7cc01_row1_col0\" class=\"data row1 col0\" > past_present_indices,\n",
|
||
|
|
" past_key_values: Optional[torch.Tensor] = None,\n",
|
||
|
|
" pre_allocate_past_size: Optional[int] = None,\n",
|
||
|
|
" lm_head_indices: Optional[torch.Tensor] = None,\n",
|
||
|
|
" ):\n",
|
||
|
|
" hidden_states, present = self.gpt_neox(\n",
|
||
|
|
" input_ids,\n",
|
||
|
|
" position_ids,\n",
|
||
|
|
" start_seq,\n",
|
||
|
|
" end_seq,\n",
|
||
|
|
" start_seq_q,\n",
|
||
|
|
" end_seq_q,\n",
|
||
|
|
" max_s,\n",
|
||
|
|
" past_present_indices,\n",
|
||
|
|
" past_key_values,\n",
|
||
|
|
" pre_allocate_past_size,\n",
|
||
|
|
" )\n",
|
||
|
|
" if lm_head_indices is not None:\n",
|
||
|
|
" hidden_states = hidden_states[lm_head_indices]\n",
|
||
|
|
" logits = </td>\n",
|
||
|
|
" <td id=\"T_7cc01_row1_col1\" class=\"data row1 col1\" >/*\n",
|
||
|
|
" * Copyright (c) 2008-2021, Hazelcast, Inc. All Rights Reserved.\n",
|
||
|
|
" *\n",
|
||
|
|
" * Licensed under the Apache License, Version 2.0 (the \"License\");\n",
|
||
|
|
" * you may not use this file except in compliance with the License.\n",
|
||
|
|
" * You may obtain a copy of the License at\n",
|
||
|
|
" *\n",
|
||
|
|
" * http://www.apache.org/licenses/LICENSE-2.0\n",
|
||
|
|
" *\n",
|
||
|
|
" * Unless required by applicable law or agreed to in writing, software\n",
|
||
|
|
" * distributed under the License is distributed on an \"AS IS\" BASIS,</td>\n",
|
||
|
|
" <td id=\"T_7cc01_row1_col2\" class=\"data row1 col2\" >self.embed_out(hidden_states)</td>\n",
|
||
|
|
" <td id=\"T_7cc01_row1_col3\" class=\"data row1 col3\" >0.000000</td>\n",
|
||
|
|
" <td id=\"T_7cc01_row1_col4\" class=\"data row1 col4\" >0.000000</td>\n",
|
||
|
|
" </tr>\n",
|
||
|
|
" <tr>\n",
|
||
|
|
" <th id=\"T_7cc01_level0_row2\" class=\"row_heading level0 row2\" >2</th>\n",
|
||
|
|
" <td id=\"T_7cc01_row2_col0\" class=\"data row2 col0\" > if not isinstance(serialized_data, List):\n",
|
||
|
|
" serialized_data = [serialized_data]\n",
|
||
|
|
" if not isinstance(snapshot_data, List):\n",
|
||
|
|
" snapshot_data = [snapshot_data]\n",
|
||
|
|
"\n",
|
||
|
|
" return len(snapshot_data) == len(serialized_data) and all(\n",
|
||
|
|
" [eq_response(r, o) for r, o in zip(serialized_data, snapshot_data)]\n",
|
||
|
|
" )\n",
|
||
|
|
"\n",
|
||
|
|
"\n",
|
||
|
|
"class LauncherHandle:\n",
|
||
|
|
" def __init__(self, port: int):\n",
|
||
|
|
" self.client = AsyncClient(f\"http://localhost:{port}\")\n",
|
||
|
|
"\n",
|
||
|
|
" def _inner_health(self):\n",
|
||
|
|
" raise NotImplementedError\n",
|
||
|
|
"\n",
|
||
|
|
" async def health(self, timeout: int = 60):\n",
|
||
|
|
" assert timeout > 0\n",
|
||
|
|
" for _ in </td>\n",
|
||
|
|
" <td id=\"T_7cc01_row2_col1\" class=\"data row2 col1\" >/*\n",
|
||
|
|
" * Copyright (c) 2008-2021, Hazelcast, Inc. All Rights Reserved.\n",
|
||
|
|
" *\n",
|
||
|
|
" * Licensed under the Apache License, Version 2.0 (the \"License\");\n",
|
||
|
|
" * you may not use this file except in compliance with the License.\n",
|
||
|
|
" * You may obtain a copy of the License at\n",
|
||
|
|
" *\n",
|
||
|
|
" * http://www.apache.org/licenses/LICENSE-2.0\n",
|
||
|
|
" *\n",
|
||
|
|
" * Unless required by applicable law or agreed to in writing, software\n",
|
||
|
|
" * distributed under the License is distributed on an \"AS IS\" BASIS,</td>\n",
|
||
|
|
" <td id=\"T_7cc01_row2_col2\" class=\"data row2 col2\" >range(timeout)</td>\n",
|
||
|
|
" <td id=\"T_7cc01_row2_col3\" class=\"data row2 col3\" >0.000000</td>\n",
|
||
|
|
" <td id=\"T_7cc01_row2_col4\" class=\"data row2 col4\" >0.000000</td>\n",
|
||
|
|
" </tr>\n",
|
||
|
|
" </tbody>\n",
|
||
|
|
"</table>\n"
|
||
|
|
],
|
||
|
|
"text/plain": [
|
||
|
|
"<pandas.io.formats.style.Styler at 0x16ba0fe50>"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
"execution_count": 67,
|
||
|
|
"metadata": {},
|
||
|
|
"output_type": "execute_result"
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"source": [
|
||
|
|
"codeStyle = {\n",
|
||
|
|
" \"selector\": \"td\",\n",
|
||
|
|
" \"props\": [\n",
|
||
|
|
" (\"white-space\", \"pre\"),\n",
|
||
|
|
" (\"font-family\", \"monospace\"),\n",
|
||
|
|
" (\"text-align\", \"left\"),\n",
|
||
|
|
" (\"max-width\", \"400px\"),\n",
|
||
|
|
" (\"overflow-x\", \"scroll\"),\n",
|
||
|
|
" ],\n",
|
||
|
|
"}\n",
|
||
|
|
"\n",
|
||
|
|
"df.style.set_table_styles(\n",
|
||
|
|
" {\n",
|
||
|
|
" \"prompt\": [codeStyle],\n",
|
||
|
|
" \"prediction\": [codeStyle],\n",
|
||
|
|
" \"label\": [codeStyle],\n",
|
||
|
|
" }\n",
|
||
|
|
")"
|
||
|
|
]
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"metadata": {
|
||
|
|
"celltoolbar": "Tags",
|
||
|
|
"kernelspec": {
|
||
|
|
"display_name": "Python 3 (ipykernel)",
|
||
|
|
"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.10"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"nbformat": 4,
|
||
|
|
"nbformat_minor": 5
|
||
|
|
}
|