diff --git a/src/ai2_internal/figure_table_predictors/figure_table_timo_service_invocation_profiling.ipynb b/src/ai2_internal/figure_table_predictors/figure_table_timo_service_invocation_profiling.ipynb new file mode 100644 index 00000000..370f86ec --- /dev/null +++ b/src/ai2_internal/figure_table_predictors/figure_table_timo_service_invocation_profiling.ipynb @@ -0,0 +1,298 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 14, + "id": "48c1ef46-ef7a-4849-b832-e1e39f9bd0e5", + "metadata": { + "tags": [], + "ExecuteTime": { + "start_time": "2023-05-02T11:59:41.447228Z", + "end_time": "2023-05-02T11:59:41.570896Z" + } + }, + "outputs": [], + "source": [ + "from mmda.types import *" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "e43e9a67-6431-4002-9579-39a724afff88", + "metadata": { + "tags": [], + "ExecuteTime": { + "start_time": "2023-05-02T11:59:42.029914Z", + "end_time": "2023-05-02T11:59:42.032573Z" + } + }, + "outputs": [], + "source": [ + "import logging\n", + "logger = logging.getLogger(__name__)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "outputs": [], + "source": [ + "from ai2_internal.figure_table_predictors.interface import Instance\n", + "import os\n", + "from ai2_internal import api\n", + "import mmda.types as mmda_types\n", + "import json\n", + "\n", + "def resolve(file: str) -> str:\n", + " return os.path.join('./test_fixtures', file)\n", + "\n", + "def get_test_instance(sha) -> Instance:\n", + " doc_file = resolve(f'test_doc_sha_{sha}.json')\n", + " with open(doc_file) as f:\n", + " dic_json = json.load(f)\n", + " return dic_json" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "start_time": "2023-05-02T12:11:21.591926Z", + "end_time": "2023-05-02T12:11:21.593500Z" + } + } + }, + { + "cell_type": "code", + "execution_count": 56, + "id": "872c7b95-6266-4ba5-867d-82e3fb6c7108", + "metadata": { + "tags": [], + "ExecuteTime": { + "start_time": "2023-05-02T12:13:25.465458Z", + "end_time": "2023-05-02T12:13:25.610475Z" + } + }, + "outputs": [], + "source": [ + "import time\n", + "\n", + "def generate_content(sha):\n", + " doc_json = get_test_instance(sha)\n", + " doc = doc_json['doc']\n", + " return {\n", + " \"symbols\": doc['symbols'],\n", + " \"tokens\": doc['tokens'],\n", + " \"pages\": doc['pages'],\n", + " \"vila_span_groups\": doc['vila_span_groups'],\n", + " \"blocks\": doc_json['layout_equations'],\n", + " }\n", + "\n", + "def process_table_figure(content, local=True, multiple=1):\n", + " if local:\n", + " url='http://localhost:8080/invocations'\n", + " else:\n", + " url = 'http://mmda-figure-cap-pred.v2.prod.models.s2.allenai.org/invocations'\n", + "\n", + " start = time.time()\n", + " try:\n", + " result = requests.post(url, json={\n", + " \"instances\": [content]*multiple})\n", + " except requests.exceptions.ReadTimeout: \n", + " pass\n", + "\n", + " print(f'Call time: {time.time() - start} seconds')\n", + "\n", + " return (result, time.time() - start)" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "id": "30e48266-78cc-470e-80ed-a514151029ea", + "metadata": { + "tags": [], + "ExecuteTime": { + "start_time": "2023-05-02T12:06:49.261946Z", + "end_time": "2023-05-02T12:06:49.267985Z" + } + }, + "outputs": [], + "source": [ + "import numpy as np" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "id": "9e438dc4-b712-40dd-aeb8-0cdb9f8bb02f", + "metadata": { + "tags": [], + "ExecuteTime": { + "start_time": "2023-05-02T12:06:50.049561Z", + "end_time": "2023-05-02T12:06:50.054817Z" + } + }, + "outputs": [], + "source": [ + "import requests\n", + "from concurrent.futures import ThreadPoolExecutor, as_completed\n", + "\n", + "def process_table_figure_concurent(content, local=True, multiple=1, concurrent_requests=10):\n", + " if local:\n", + " url = 'http://localhost:8080/invocations'\n", + " else:\n", + " url = 'http://mmda-figure-cap-pred.v2.prod.models.s2.allenai.org/invocations'\n", + "\n", + " def send_request():\n", + " start = time.time()\n", + " try:\n", + " result = requests.post(url, json={\"instances\": [content] * multiple}, timeout=120)\n", + " except requests.exceptions.ReadTimeout:\n", + " pass\n", + " return time.time() - start\n", + "\n", + " with ThreadPoolExecutor(max_workers=concurrent_requests) as executor:\n", + " futures = [executor.submit(send_request) for _ in range(concurrent_requests)]\n", + "\n", + " response_times = [future.result() for future in as_completed(futures)]\n", + "\n", + " print(f'Call times: {response_times} seconds')\n", + " print(f'Average call time: {np.average(response_times):.2f} seconds std: {np.std(response_times):.2f}, concurent requests {concurrent_requests}')\n", + " return response_times" + ] + }, + { + "cell_type": "code", + "execution_count": 57, + "outputs": [], + "source": [ + "content = generate_content('d0450478c38dda61f9943f417ab9fcdb2ebeae0a')" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "start_time": "2023-05-02T12:13:28.547210Z", + "end_time": "2023-05-02T12:13:28.843678Z" + } + } + }, + { + "cell_type": "code", + "execution_count": 58, + "id": "5feb5329-8f0a-4877-8018-662dbafe8fba", + "metadata": { + "tags": [], + "ExecuteTime": { + "start_time": "2023-05-02T12:13:38.128898Z", + "end_time": "2023-05-02T12:14:12.965511Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Call times: [1.400001049041748] seconds\n", + "Average call time: 1.40 seconds std: 0.00, concurent requests 1\n", + "Call times: [1.4494168758392334, 1.9214510917663574] seconds\n", + "Average call time: 1.69 seconds std: 0.24, concurent requests 2\n", + "Call times: [1.4738659858703613, 1.659148931503296, 1.9143550395965576] seconds\n", + "Average call time: 1.68 seconds std: 0.18, concurent requests 3\n", + "Call times: [1.6855049133300781, 1.7503199577331543, 2.171604871749878, 2.8290040493011475] seconds\n", + "Average call time: 2.11 seconds std: 0.46, concurent requests 4\n", + "Call times: [3.0311622619628906, 5.55782675743103, 5.702712059020996, 2.9607818126678467, 4.632144927978516] seconds\n", + "Average call time: 4.38 seconds std: 1.19, concurent requests 5\n", + "Call times: [4.024920225143433, 3.444732904434204, 2.084078073501587, 3.9703519344329834, 1.8279399871826172, 4.025630950927734] seconds\n", + "Average call time: 3.23 seconds std: 0.93, concurent requests 6\n", + "Call times: [2.4059410095214844, 3.4998137950897217, 2.4905200004577637, 3.4603328704833984, 5.1612138748168945, 5.26596212387085, 3.494436264038086] seconds\n", + "Average call time: 3.68 seconds std: 1.06, concurent requests 7\n", + "Call times: [2.842933177947998, 4.663649082183838, 3.921501874923706, 3.4676191806793213, 4.249823808670044, 3.160644769668579, 3.0885989665985107, 5.589174032211304] seconds\n", + "Average call time: 3.87 seconds std: 0.87, concurent requests 8\n", + "Call times: [3.414668083190918, 5.664439916610718, 3.953460931777954, 2.412278175354004, 3.599186897277832, 3.316335916519165, 4.343087911605835, 3.7883291244506836, 5.769091844558716] seconds\n", + "Average call time: 4.03 seconds std: 1.03, concurent requests 9\n" + ] + } + ], + "source": [ + "call_times = {}\n", + "for concurent_req in range(1, 10):\n", + " call_times[concurent_req] = process_table_figure_concurent(content, local=False, multiple=1, concurrent_requests=concurent_req)" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "id": "f1ed418f-b6e5-41e8-942c-8a4dd94b36bc", + "metadata": { + "tags": [], + "ExecuteTime": { + "start_time": "2023-05-02T12:14:12.968163Z", + "end_time": "2023-05-02T12:14:13.214839Z" + } + }, + "outputs": [], + "source": [ + "import matplotlib.pyplot as plt" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "id": "b5369922-e7a4-4b6f-a07e-d7ac597fc6b3", + "metadata": { + "tags": [], + "ExecuteTime": { + "start_time": "2023-05-02T12:36:50.438266Z", + "end_time": "2023-05-02T12:36:50.548366Z" + } + }, + "outputs": [ + { + "data": { + "text/plain": "Text(0, 0.5, 'Average response times (sec)')" + }, + "execution_count": 62, + "metadata": {}, + "output_type": "execute_result" + }, + { + "data": { + "text/plain": "
", + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXgAAAEGCAYAAABvtY4XAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy88F64QAAAACXBIWXMAAAsTAAALEwEAmpwYAAAphElEQVR4nO3dd3Rc5bX+8e9W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hBEfCHwPODqZJrgB+SKS96ltAMZFfAt8I2uk2tZ8aImPdvw5Okj5D5Gj9VWA9kba7vyLSeTBMrpXAd4is+vRWsL9Bzb+L64EzzGwZkaGbCW3cj0iT1E1SRCRJ6QheRCRJqcCLiCQpFXgRkSSlAi8ikqRU4EVEkpQKvIhIklKBFxFJUv8fAjK3yBEAS4MAAAAASUVORK5CYII=\n" + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "plt.errorbar(list(call_times.keys()), [np.average(response_times) for response_times in call_times.values()], \n", + " [np.std(response_times) for response_times in call_times.values()])\n", + "plt.xlabel('Concurrence')\n", + "plt.ylabel('Average response times (sec)')" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "mmda", + "language": "python", + "name": "mmda" + }, + "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.8.16" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/src/ai2_internal/figure_table_predictors/integration_test.py b/src/ai2_internal/figure_table_predictors/integration_test.py index 1ec33be6..74f1f1eb 100644 --- a/src/ai2_internal/figure_table_predictors/integration_test.py +++ b/src/ai2_internal/figure_table_predictors/integration_test.py @@ -34,7 +34,6 @@ def test_prediction(self, container): from .. import api from mmda.types.document import Document -from mmda.types.image import tobase64 from .interface import Instance import mmda.types as mmda_types