{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2022-10-29T19:53:55.082843Z", "iopub.status.busy": "2022-10-29T19:53:55.082042Z", "iopub.status.idle": "2022-10-29T19:53:58.489989Z", "shell.execute_reply": "2022-10-29T19:53:58.488084Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Collecting tokenizer\r\n", " Downloading tokenizer-3.4.2-py2.py3-none-any.whl (79 kB)\r\n", "\u001B[2K \u001B[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001B[0m \u001B[32m79.1/79.1 KB\u001B[0m \u001B[31m6.1 MB/s\u001B[0m eta \u001B[36m0:00:00\u001B[0m\r\n", "\u001B[?25hCollecting sentencepiece\r\n", " Downloading sentencepiece-0.1.97-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB)\r\n", "\u001B[2K \u001B[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001B[0m \u001B[32m1.3/1.3 MB\u001B[0m \u001B[31m43.3 MB/s\u001B[0m eta \u001B[36m0:00:00\u001B[0m\r\n", "\u001B[?25hInstalling collected packages: tokenizer, sentencepiece\r\n", "Successfully installed sentencepiece-0.1.97 tokenizer-3.4.2\r\n", "\u001B[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001B[0m\u001B[33m\r\n", "\u001B[0m\u001B[33mWARNING: You are using pip version 22.0.4; however, version 22.3 is available.\r\n", "You should consider upgrading via the '/usr/bin/python3.9 -m pip install --upgrade pip' command.\u001B[0m\u001B[33m\r\n", "\u001B[0mSat Oct 29 19:53:58 2022 \r\n", "+-----------------------------------------------------------------------------+\r\n", "| NVIDIA-SMI 510.85.02 Driver Version: 510.85.02 CUDA Version: 11.6 |\r\n", "|-------------------------------+----------------------+----------------------+\r\n", "| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\r\n", "| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\r\n", "| | | MIG M. |\r\n", "|===============================+======================+======================|\r\n", "| 0 NVIDIA GeForce ... Off | 00000000:03:00.0 On | N/A |\r\n", "| 30% 41C P8 24W / 350W | 300MiB / 24576MiB | 1% Default |\r\n", "| | | N/A |\r\n", "+-------------------------------+----------------------+----------------------+\r\n", " \r\n", "+-----------------------------------------------------------------------------+\r\n", "| Processes: |\r\n", "| GPU GI CI PID Type Process name GPU Memory |\r\n", "| ID ID Usage |\r\n", "|=============================================================================|\r\n", "+-----------------------------------------------------------------------------+\r\n" ] } ], "source": [ "! pip install tokenizer sentencepiece\n", "! nvidia-smi" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2022-10-29T19:53:58.497762Z", "iopub.status.busy": "2022-10-29T19:53:58.497162Z", "iopub.status.idle": "2022-10-29T19:53:59.829844Z", "shell.execute_reply": "2022-10-29T19:53:59.828805Z" } }, "outputs": [], "source": [ "from transformers import AutoModelForSeq2SeqLM, AutoTokenizer\n", "\n", "import time\n", "import torch._dynamo as torchdynamo\n", "import torch\n", "from kernl.model_optimization import optimize_model" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2022-10-29T19:53:59.833560Z", "iopub.status.busy": "2022-10-29T19:53:59.833170Z", "iopub.status.idle": "2022-10-29T19:54:13.107793Z", "shell.execute_reply": "2022-10-29T19:54:13.106806Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "9eddb20b6abf4b89aed7878e55e01b35", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Downloading: 0%| | 0.00/1.20k [00:00