Upload Export_Recipe.ipynb
Browse files- Export_Recipe.ipynb +343 -0
Export_Recipe.ipynb
ADDED
@@ -0,0 +1,343 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"nbformat": 4,
|
3 |
+
"nbformat_minor": 0,
|
4 |
+
"metadata": {
|
5 |
+
"colab": {
|
6 |
+
"provenance": []
|
7 |
+
},
|
8 |
+
"kernelspec": {
|
9 |
+
"name": "python3",
|
10 |
+
"display_name": "Python 3"
|
11 |
+
},
|
12 |
+
"language_info": {
|
13 |
+
"name": "python"
|
14 |
+
}
|
15 |
+
},
|
16 |
+
"cells": [
|
17 |
+
{
|
18 |
+
"cell_type": "markdown",
|
19 |
+
"source": [
|
20 |
+
"## Step 1: Setting Up Optimum ExecuTorch"
|
21 |
+
],
|
22 |
+
"metadata": {
|
23 |
+
"id": "JJ2zK7BTZ2no"
|
24 |
+
}
|
25 |
+
},
|
26 |
+
{
|
27 |
+
"cell_type": "code",
|
28 |
+
"execution_count": 1,
|
29 |
+
"metadata": {
|
30 |
+
"colab": {
|
31 |
+
"base_uri": "https://localhost:8080/"
|
32 |
+
},
|
33 |
+
"collapsed": true,
|
34 |
+
"id": "Jf8cvq_TYlH1",
|
35 |
+
"outputId": "10b89e53-428e-4bf2-f08f-97c743a54ae1"
|
36 |
+
},
|
37 |
+
"outputs": [
|
38 |
+
{
|
39 |
+
"output_type": "stream",
|
40 |
+
"name": "stdout",
|
41 |
+
"text": [
|
42 |
+
"Cloning into 'optimum-executorch'...\n",
|
43 |
+
"remote: Enumerating objects: 309, done.\u001b[K\n",
|
44 |
+
"remote: Counting objects: 100% (196/196), done.\u001b[K\n",
|
45 |
+
"remote: Compressing objects: 100% (82/82), done.\u001b[K\n",
|
46 |
+
"remote: Total 309 (delta 122), reused 146 (delta 96), pack-reused 113 (from 1)\u001b[K\n",
|
47 |
+
"Receiving objects: 100% (309/309), 72.96 KiB | 633.00 KiB/s, done.\n",
|
48 |
+
"Resolving deltas: 100% (146/146), done.\n",
|
49 |
+
"Processing /content/optimum-executorch\n",
|
50 |
+
" Installing build dependencies ... \u001b[?25l\u001b[?25hdone\n",
|
51 |
+
" Getting requirements to build wheel ... \u001b[?25l\u001b[?25hdone\n",
|
52 |
+
" Preparing metadata (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n",
|
53 |
+
"Collecting optimum~=1.24 (from optimum-executorch==0.0.0.dev0)\n",
|
54 |
+
" Downloading optimum-1.24.0-py3-none-any.whl.metadata (21 kB)\n",
|
55 |
+
"Collecting executorch>=0.4.0 (from optimum-executorch==0.0.0.dev0)\n",
|
56 |
+
" Downloading executorch-0.5.0-cp311-cp311-manylinux1_x86_64.whl.metadata (6.0 kB)\n",
|
57 |
+
"Requirement already satisfied: transformers>=4.46 in /usr/local/lib/python3.11/dist-packages (from optimum-executorch==0.0.0.dev0) (4.48.3)\n",
|
58 |
+
"Collecting expecttest (from executorch>=0.4.0->optimum-executorch==0.0.0.dev0)\n",
|
59 |
+
" Downloading expecttest-0.3.0-py3-none-any.whl.metadata (3.8 kB)\n",
|
60 |
+
"Requirement already satisfied: flatbuffers in /usr/local/lib/python3.11/dist-packages (from executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (25.2.10)\n",
|
61 |
+
"Collecting hypothesis (from executorch>=0.4.0->optimum-executorch==0.0.0.dev0)\n",
|
62 |
+
" Downloading hypothesis-6.127.7-py3-none-any.whl.metadata (4.4 kB)\n",
|
63 |
+
"Requirement already satisfied: mpmath==1.3.0 in /usr/local/lib/python3.11/dist-packages (from executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (1.3.0)\n",
|
64 |
+
"Collecting numpy==2.0.0 (from executorch>=0.4.0->optimum-executorch==0.0.0.dev0)\n",
|
65 |
+
" Downloading numpy-2.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (60 kB)\n",
|
66 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m60.9/60.9 kB\u001b[0m \u001b[31m2.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
67 |
+
"\u001b[?25hRequirement already satisfied: packaging in /usr/local/lib/python3.11/dist-packages (from executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (24.2)\n",
|
68 |
+
"Requirement already satisfied: pandas==2.2.2 in /usr/local/lib/python3.11/dist-packages (from executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (2.2.2)\n",
|
69 |
+
"Collecting parameterized (from executorch>=0.4.0->optimum-executorch==0.0.0.dev0)\n",
|
70 |
+
" Downloading parameterized-0.9.0-py2.py3-none-any.whl.metadata (18 kB)\n",
|
71 |
+
"Requirement already satisfied: pytest in /usr/local/lib/python3.11/dist-packages (from executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (8.3.4)\n",
|
72 |
+
"Collecting pytest-xdist (from executorch>=0.4.0->optimum-executorch==0.0.0.dev0)\n",
|
73 |
+
" Downloading pytest_xdist-3.6.1-py3-none-any.whl.metadata (4.3 kB)\n",
|
74 |
+
"Requirement already satisfied: pyyaml in /usr/local/lib/python3.11/dist-packages (from executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (6.0.2)\n",
|
75 |
+
"Collecting ruamel.yaml (from executorch>=0.4.0->optimum-executorch==0.0.0.dev0)\n",
|
76 |
+
" Downloading ruamel.yaml-0.18.10-py3-none-any.whl.metadata (23 kB)\n",
|
77 |
+
"Requirement already satisfied: sympy in /usr/local/lib/python3.11/dist-packages (from executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (1.13.1)\n",
|
78 |
+
"Requirement already satisfied: tabulate in /usr/local/lib/python3.11/dist-packages (from executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (0.9.0)\n",
|
79 |
+
"Collecting torch==2.6.0 (from executorch>=0.4.0->optimum-executorch==0.0.0.dev0)\n",
|
80 |
+
" Downloading torch-2.6.0-cp311-cp311-manylinux1_x86_64.whl.metadata (28 kB)\n",
|
81 |
+
"Collecting torchaudio==2.6.0 (from executorch>=0.4.0->optimum-executorch==0.0.0.dev0)\n",
|
82 |
+
" Downloading torchaudio-2.6.0-cp311-cp311-manylinux1_x86_64.whl.metadata (6.6 kB)\n",
|
83 |
+
"Collecting torchvision==0.21.0 (from executorch>=0.4.0->optimum-executorch==0.0.0.dev0)\n",
|
84 |
+
" Downloading torchvision-0.21.0-cp311-cp311-manylinux1_x86_64.whl.metadata (6.1 kB)\n",
|
85 |
+
"Requirement already satisfied: typing-extensions in /usr/local/lib/python3.11/dist-packages (from executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (4.12.2)\n",
|
86 |
+
"Requirement already satisfied: python-dateutil>=2.8.2 in /usr/local/lib/python3.11/dist-packages (from pandas==2.2.2->executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (2.8.2)\n",
|
87 |
+
"Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.11/dist-packages (from pandas==2.2.2->executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (2025.1)\n",
|
88 |
+
"Requirement already satisfied: tzdata>=2022.7 in /usr/local/lib/python3.11/dist-packages (from pandas==2.2.2->executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (2025.1)\n",
|
89 |
+
"Requirement already satisfied: filelock in /usr/local/lib/python3.11/dist-packages (from torch==2.6.0->executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (3.17.0)\n",
|
90 |
+
"Requirement already satisfied: networkx in /usr/local/lib/python3.11/dist-packages (from torch==2.6.0->executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (3.4.2)\n",
|
91 |
+
"Requirement already satisfied: jinja2 in /usr/local/lib/python3.11/dist-packages (from torch==2.6.0->executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (3.1.5)\n",
|
92 |
+
"Requirement already satisfied: fsspec in /usr/local/lib/python3.11/dist-packages (from torch==2.6.0->executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (2024.10.0)\n",
|
93 |
+
"Collecting nvidia-cuda-nvrtc-cu12==12.4.127 (from torch==2.6.0->executorch>=0.4.0->optimum-executorch==0.0.0.dev0)\n",
|
94 |
+
" Downloading nvidia_cuda_nvrtc_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl.metadata (1.5 kB)\n",
|
95 |
+
"Collecting nvidia-cuda-runtime-cu12==12.4.127 (from torch==2.6.0->executorch>=0.4.0->optimum-executorch==0.0.0.dev0)\n",
|
96 |
+
" Downloading nvidia_cuda_runtime_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl.metadata (1.5 kB)\n",
|
97 |
+
"Collecting nvidia-cuda-cupti-cu12==12.4.127 (from torch==2.6.0->executorch>=0.4.0->optimum-executorch==0.0.0.dev0)\n",
|
98 |
+
" Downloading nvidia_cuda_cupti_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl.metadata (1.6 kB)\n",
|
99 |
+
"Collecting nvidia-cudnn-cu12==9.1.0.70 (from torch==2.6.0->executorch>=0.4.0->optimum-executorch==0.0.0.dev0)\n",
|
100 |
+
" Downloading nvidia_cudnn_cu12-9.1.0.70-py3-none-manylinux2014_x86_64.whl.metadata (1.6 kB)\n",
|
101 |
+
"Collecting nvidia-cublas-cu12==12.4.5.8 (from torch==2.6.0->executorch>=0.4.0->optimum-executorch==0.0.0.dev0)\n",
|
102 |
+
" Downloading nvidia_cublas_cu12-12.4.5.8-py3-none-manylinux2014_x86_64.whl.metadata (1.5 kB)\n",
|
103 |
+
"Collecting nvidia-cufft-cu12==11.2.1.3 (from torch==2.6.0->executorch>=0.4.0->optimum-executorch==0.0.0.dev0)\n",
|
104 |
+
" Downloading nvidia_cufft_cu12-11.2.1.3-py3-none-manylinux2014_x86_64.whl.metadata (1.5 kB)\n",
|
105 |
+
"Collecting nvidia-curand-cu12==10.3.5.147 (from torch==2.6.0->executorch>=0.4.0->optimum-executorch==0.0.0.dev0)\n",
|
106 |
+
" Downloading nvidia_curand_cu12-10.3.5.147-py3-none-manylinux2014_x86_64.whl.metadata (1.5 kB)\n",
|
107 |
+
"Collecting nvidia-cusolver-cu12==11.6.1.9 (from torch==2.6.0->executorch>=0.4.0->optimum-executorch==0.0.0.dev0)\n",
|
108 |
+
" Downloading nvidia_cusolver_cu12-11.6.1.9-py3-none-manylinux2014_x86_64.whl.metadata (1.6 kB)\n",
|
109 |
+
"Collecting nvidia-cusparse-cu12==12.3.1.170 (from torch==2.6.0->executorch>=0.4.0->optimum-executorch==0.0.0.dev0)\n",
|
110 |
+
" Downloading nvidia_cusparse_cu12-12.3.1.170-py3-none-manylinux2014_x86_64.whl.metadata (1.6 kB)\n",
|
111 |
+
"Collecting nvidia-cusparselt-cu12==0.6.2 (from torch==2.6.0->executorch>=0.4.0->optimum-executorch==0.0.0.dev0)\n",
|
112 |
+
" Downloading nvidia_cusparselt_cu12-0.6.2-py3-none-manylinux2014_x86_64.whl.metadata (6.8 kB)\n",
|
113 |
+
"Requirement already satisfied: nvidia-nccl-cu12==2.21.5 in /usr/local/lib/python3.11/dist-packages (from torch==2.6.0->executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (2.21.5)\n",
|
114 |
+
"Requirement already satisfied: nvidia-nvtx-cu12==12.4.127 in /usr/local/lib/python3.11/dist-packages (from torch==2.6.0->executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (12.4.127)\n",
|
115 |
+
"Collecting nvidia-nvjitlink-cu12==12.4.127 (from torch==2.6.0->executorch>=0.4.0->optimum-executorch==0.0.0.dev0)\n",
|
116 |
+
" Downloading nvidia_nvjitlink_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl.metadata (1.5 kB)\n",
|
117 |
+
"Collecting triton==3.2.0 (from torch==2.6.0->executorch>=0.4.0->optimum-executorch==0.0.0.dev0)\n",
|
118 |
+
" Downloading triton-3.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.4 kB)\n",
|
119 |
+
"Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in /usr/local/lib/python3.11/dist-packages (from torchvision==0.21.0->executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (11.1.0)\n",
|
120 |
+
"Requirement already satisfied: huggingface-hub>=0.8.0 in /usr/local/lib/python3.11/dist-packages (from optimum~=1.24->optimum-executorch==0.0.0.dev0) (0.28.1)\n",
|
121 |
+
"Requirement already satisfied: regex!=2019.12.17 in /usr/local/lib/python3.11/dist-packages (from transformers>=4.46->optimum-executorch==0.0.0.dev0) (2024.11.6)\n",
|
122 |
+
"Requirement already satisfied: requests in /usr/local/lib/python3.11/dist-packages (from transformers>=4.46->optimum-executorch==0.0.0.dev0) (2.32.3)\n",
|
123 |
+
"Requirement already satisfied: tokenizers<0.22,>=0.21 in /usr/local/lib/python3.11/dist-packages (from transformers>=4.46->optimum-executorch==0.0.0.dev0) (0.21.0)\n",
|
124 |
+
"Requirement already satisfied: safetensors>=0.4.1 in /usr/local/lib/python3.11/dist-packages (from transformers>=4.46->optimum-executorch==0.0.0.dev0) (0.5.3)\n",
|
125 |
+
"Requirement already satisfied: tqdm>=4.27 in /usr/local/lib/python3.11/dist-packages (from transformers>=4.46->optimum-executorch==0.0.0.dev0) (4.67.1)\n",
|
126 |
+
"Requirement already satisfied: attrs>=22.2.0 in /usr/local/lib/python3.11/dist-packages (from hypothesis->executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (25.1.0)\n",
|
127 |
+
"Requirement already satisfied: sortedcontainers<3.0.0,>=2.1.0 in /usr/local/lib/python3.11/dist-packages (from hypothesis->executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (2.4.0)\n",
|
128 |
+
"Requirement already satisfied: iniconfig in /usr/local/lib/python3.11/dist-packages (from pytest->executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (2.0.0)\n",
|
129 |
+
"Requirement already satisfied: pluggy<2,>=1.5 in /usr/local/lib/python3.11/dist-packages (from pytest->executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (1.5.0)\n",
|
130 |
+
"Collecting execnet>=2.1 (from pytest-xdist->executorch>=0.4.0->optimum-executorch==0.0.0.dev0)\n",
|
131 |
+
" Downloading execnet-2.1.1-py3-none-any.whl.metadata (2.9 kB)\n",
|
132 |
+
"Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.11/dist-packages (from requests->transformers>=4.46->optimum-executorch==0.0.0.dev0) (3.4.1)\n",
|
133 |
+
"Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.11/dist-packages (from requests->transformers>=4.46->optimum-executorch==0.0.0.dev0) (3.10)\n",
|
134 |
+
"Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.11/dist-packages (from requests->transformers>=4.46->optimum-executorch==0.0.0.dev0) (2.3.0)\n",
|
135 |
+
"Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.11/dist-packages (from requests->transformers>=4.46->optimum-executorch==0.0.0.dev0) (2025.1.31)\n",
|
136 |
+
"Collecting ruamel.yaml.clib>=0.2.7 (from ruamel.yaml->executorch>=0.4.0->optimum-executorch==0.0.0.dev0)\n",
|
137 |
+
" Downloading ruamel.yaml.clib-0.2.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.7 kB)\n",
|
138 |
+
"Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.11/dist-packages (from python-dateutil>=2.8.2->pandas==2.2.2->executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (1.17.0)\n",
|
139 |
+
"Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.11/dist-packages (from jinja2->torch==2.6.0->executorch>=0.4.0->optimum-executorch==0.0.0.dev0) (3.0.2)\n",
|
140 |
+
"Downloading executorch-0.5.0-cp311-cp311-manylinux1_x86_64.whl (6.1 MB)\n",
|
141 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m6.1/6.1 MB\u001b[0m \u001b[31m68.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
142 |
+
"\u001b[?25hDownloading numpy-2.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (19.3 MB)\n",
|
143 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m19.3/19.3 MB\u001b[0m \u001b[31m95.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
144 |
+
"\u001b[?25hDownloading torch-2.6.0-cp311-cp311-manylinux1_x86_64.whl (766.7 MB)\n",
|
145 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m766.7/766.7 MB\u001b[0m \u001b[31m2.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
146 |
+
"\u001b[?25hDownloading torchaudio-2.6.0-cp311-cp311-manylinux1_x86_64.whl (3.4 MB)\n",
|
147 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m3.4/3.4 MB\u001b[0m \u001b[31m82.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
148 |
+
"\u001b[?25hDownloading torchvision-0.21.0-cp311-cp311-manylinux1_x86_64.whl (7.2 MB)\n",
|
149 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m7.2/7.2 MB\u001b[0m \u001b[31m100.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
150 |
+
"\u001b[?25hDownloading nvidia_cublas_cu12-12.4.5.8-py3-none-manylinux2014_x86_64.whl (363.4 MB)\n",
|
151 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m363.4/363.4 MB\u001b[0m \u001b[31m3.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
152 |
+
"\u001b[?25hDownloading nvidia_cuda_cupti_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl (13.8 MB)\n",
|
153 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m13.8/13.8 MB\u001b[0m \u001b[31m53.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
154 |
+
"\u001b[?25hDownloading nvidia_cuda_nvrtc_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl (24.6 MB)\n",
|
155 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m24.6/24.6 MB\u001b[0m \u001b[31m36.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
156 |
+
"\u001b[?25hDownloading nvidia_cuda_runtime_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl (883 kB)\n",
|
157 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m883.7/883.7 kB\u001b[0m \u001b[31m45.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
158 |
+
"\u001b[?25hDownloading nvidia_cudnn_cu12-9.1.0.70-py3-none-manylinux2014_x86_64.whl (664.8 MB)\n",
|
159 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m664.8/664.8 MB\u001b[0m \u001b[31m2.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
160 |
+
"\u001b[?25hDownloading nvidia_cufft_cu12-11.2.1.3-py3-none-manylinux2014_x86_64.whl (211.5 MB)\n",
|
161 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m211.5/211.5 MB\u001b[0m \u001b[31m5.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
162 |
+
"\u001b[?25hDownloading nvidia_curand_cu12-10.3.5.147-py3-none-manylinux2014_x86_64.whl (56.3 MB)\n",
|
163 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m56.3/56.3 MB\u001b[0m \u001b[31m9.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
164 |
+
"\u001b[?25hDownloading nvidia_cusolver_cu12-11.6.1.9-py3-none-manylinux2014_x86_64.whl (127.9 MB)\n",
|
165 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m127.9/127.9 MB\u001b[0m \u001b[31m7.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
166 |
+
"\u001b[?25hDownloading nvidia_cusparse_cu12-12.3.1.170-py3-none-manylinux2014_x86_64.whl (207.5 MB)\n",
|
167 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m207.5/207.5 MB\u001b[0m \u001b[31m6.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
168 |
+
"\u001b[?25hDownloading nvidia_cusparselt_cu12-0.6.2-py3-none-manylinux2014_x86_64.whl (150.1 MB)\n",
|
169 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m150.1/150.1 MB\u001b[0m \u001b[31m6.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
170 |
+
"\u001b[?25hDownloading nvidia_nvjitlink_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl (21.1 MB)\n",
|
171 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m21.1/21.1 MB\u001b[0m \u001b[31m84.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
172 |
+
"\u001b[?25hDownloading triton-3.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (253.2 MB)\n",
|
173 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m253.2/253.2 MB\u001b[0m \u001b[31m4.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
174 |
+
"\u001b[?25hDownloading optimum-1.24.0-py3-none-any.whl (433 kB)\n",
|
175 |
+
"\u001b[2K \u001b[90mβββοΏ½οΏ½οΏ½ββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m433.6/433.6 kB\u001b[0m \u001b[31m31.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
176 |
+
"\u001b[?25hDownloading expecttest-0.3.0-py3-none-any.whl (8.2 kB)\n",
|
177 |
+
"Downloading hypothesis-6.127.7-py3-none-any.whl (483 kB)\n",
|
178 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m483.3/483.3 kB\u001b[0m \u001b[31m37.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
179 |
+
"\u001b[?25hDownloading parameterized-0.9.0-py2.py3-none-any.whl (20 kB)\n",
|
180 |
+
"Downloading pytest_xdist-3.6.1-py3-none-any.whl (46 kB)\n",
|
181 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m46.1/46.1 kB\u001b[0m \u001b[31m4.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
182 |
+
"\u001b[?25hDownloading ruamel.yaml-0.18.10-py3-none-any.whl (117 kB)\n",
|
183 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m117.7/117.7 kB\u001b[0m \u001b[31m12.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
184 |
+
"\u001b[?25hDownloading execnet-2.1.1-py3-none-any.whl (40 kB)\n",
|
185 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m40.6/40.6 kB\u001b[0m \u001b[31m3.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
186 |
+
"\u001b[?25hDownloading ruamel.yaml.clib-0.2.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (739 kB)\n",
|
187 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m739.1/739.1 kB\u001b[0m \u001b[31m53.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
188 |
+
"\u001b[?25hBuilding wheels for collected packages: optimum-executorch\n",
|
189 |
+
" Building wheel for optimum-executorch (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n",
|
190 |
+
" Created wheel for optimum-executorch: filename=optimum_executorch-0.0.0.dev0-py3-none-any.whl size=26854 sha256=4c8d4ff67f0691b21305f380afc74d27ad6eed5e9025fca6bfd0ac992f308461\n",
|
191 |
+
" Stored in directory: /root/.cache/pip/wheels/8f/7c/a6/ff41f7e873d3e74183b74cf6c37176e23ba574ae9e795ff660\n",
|
192 |
+
"Successfully built optimum-executorch\n",
|
193 |
+
"Installing collected packages: triton, nvidia-cusparselt-cu12, ruamel.yaml.clib, parameterized, nvidia-nvjitlink-cu12, nvidia-curand-cu12, nvidia-cufft-cu12, nvidia-cuda-runtime-cu12, nvidia-cuda-nvrtc-cu12, nvidia-cuda-cupti-cu12, nvidia-cublas-cu12, numpy, hypothesis, expecttest, execnet, ruamel.yaml, pytest-xdist, nvidia-cusparse-cu12, nvidia-cudnn-cu12, nvidia-cusolver-cu12, torch, torchvision, torchaudio, optimum, executorch, optimum-executorch\n",
|
194 |
+
" Attempting uninstall: triton\n",
|
195 |
+
" Found existing installation: triton 3.1.0\n",
|
196 |
+
" Uninstalling triton-3.1.0:\n",
|
197 |
+
" Successfully uninstalled triton-3.1.0\n",
|
198 |
+
" Attempting uninstall: nvidia-nvjitlink-cu12\n",
|
199 |
+
" Found existing installation: nvidia-nvjitlink-cu12 12.5.82\n",
|
200 |
+
" Uninstalling nvidia-nvjitlink-cu12-12.5.82:\n",
|
201 |
+
" Successfully uninstalled nvidia-nvjitlink-cu12-12.5.82\n",
|
202 |
+
" Attempting uninstall: nvidia-curand-cu12\n",
|
203 |
+
" Found existing installation: nvidia-curand-cu12 10.3.6.82\n",
|
204 |
+
" Uninstalling nvidia-curand-cu12-10.3.6.82:\n",
|
205 |
+
" Successfully uninstalled nvidia-curand-cu12-10.3.6.82\n",
|
206 |
+
" Attempting uninstall: nvidia-cufft-cu12\n",
|
207 |
+
" Found existing installation: nvidia-cufft-cu12 11.2.3.61\n",
|
208 |
+
" Uninstalling nvidia-cufft-cu12-11.2.3.61:\n",
|
209 |
+
" Successfully uninstalled nvidia-cufft-cu12-11.2.3.61\n",
|
210 |
+
" Attempting uninstall: nvidia-cuda-runtime-cu12\n",
|
211 |
+
" Found existing installation: nvidia-cuda-runtime-cu12 12.5.82\n",
|
212 |
+
" Uninstalling nvidia-cuda-runtime-cu12-12.5.82:\n",
|
213 |
+
" Successfully uninstalled nvidia-cuda-runtime-cu12-12.5.82\n",
|
214 |
+
" Attempting uninstall: nvidia-cuda-nvrtc-cu12\n",
|
215 |
+
" Found existing installation: nvidia-cuda-nvrtc-cu12 12.5.82\n",
|
216 |
+
" Uninstalling nvidia-cuda-nvrtc-cu12-12.5.82:\n",
|
217 |
+
" Successfully uninstalled nvidia-cuda-nvrtc-cu12-12.5.82\n",
|
218 |
+
" Attempting uninstall: nvidia-cuda-cupti-cu12\n",
|
219 |
+
" Found existing installation: nvidia-cuda-cupti-cu12 12.5.82\n",
|
220 |
+
" Uninstalling nvidia-cuda-cupti-cu12-12.5.82:\n",
|
221 |
+
" Successfully uninstalled nvidia-cuda-cupti-cu12-12.5.82\n",
|
222 |
+
" Attempting uninstall: nvidia-cublas-cu12\n",
|
223 |
+
" Found existing installation: nvidia-cublas-cu12 12.5.3.2\n",
|
224 |
+
" Uninstalling nvidia-cublas-cu12-12.5.3.2:\n",
|
225 |
+
" Successfully uninstalled nvidia-cublas-cu12-12.5.3.2\n",
|
226 |
+
" Attempting uninstall: numpy\n",
|
227 |
+
" Found existing installation: numpy 1.26.4\n",
|
228 |
+
" Uninstalling numpy-1.26.4:\n",
|
229 |
+
" Successfully uninstalled numpy-1.26.4\n",
|
230 |
+
" Attempting uninstall: nvidia-cusparse-cu12\n",
|
231 |
+
" Found existing installation: nvidia-cusparse-cu12 12.5.1.3\n",
|
232 |
+
" Uninstalling nvidia-cusparse-cu12-12.5.1.3:\n",
|
233 |
+
" Successfully uninstalled nvidia-cusparse-cu12-12.5.1.3\n",
|
234 |
+
" Attempting uninstall: nvidia-cudnn-cu12\n",
|
235 |
+
" Found existing installation: nvidia-cudnn-cu12 9.3.0.75\n",
|
236 |
+
" Uninstalling nvidia-cudnn-cu12-9.3.0.75:\n",
|
237 |
+
" Successfully uninstalled nvidia-cudnn-cu12-9.3.0.75\n",
|
238 |
+
" Attempting uninstall: nvidia-cusolver-cu12\n",
|
239 |
+
" Found existing installation: nvidia-cusolver-cu12 11.6.3.83\n",
|
240 |
+
" Uninstalling nvidia-cusolver-cu12-11.6.3.83:\n",
|
241 |
+
" Successfully uninstalled nvidia-cusolver-cu12-11.6.3.83\n",
|
242 |
+
" Attempting uninstall: torch\n",
|
243 |
+
" Found existing installation: torch 2.5.1+cu124\n",
|
244 |
+
" Uninstalling torch-2.5.1+cu124:\n",
|
245 |
+
" Successfully uninstalled torch-2.5.1+cu124\n",
|
246 |
+
" Attempting uninstall: torchvision\n",
|
247 |
+
" Found existing installation: torchvision 0.20.1+cu124\n",
|
248 |
+
" Uninstalling torchvision-0.20.1+cu124:\n",
|
249 |
+
" Successfully uninstalled torchvision-0.20.1+cu124\n",
|
250 |
+
" Attempting uninstall: torchaudio\n",
|
251 |
+
" Found existing installation: torchaudio 2.5.1+cu124\n",
|
252 |
+
" Uninstalling torchaudio-2.5.1+cu124:\n",
|
253 |
+
" Successfully uninstalled torchaudio-2.5.1+cu124\n",
|
254 |
+
"\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
|
255 |
+
"fastai 2.7.18 requires torch<2.6,>=1.10, but you have torch 2.6.0 which is incompatible.\n",
|
256 |
+
"pytensor 2.27.1 requires numpy<2,>=1.17.0, but you have numpy 2.0.0 which is incompatible.\n",
|
257 |
+
"gensim 4.3.3 requires numpy<2.0,>=1.18.5, but you have numpy 2.0.0 which is incompatible.\n",
|
258 |
+
"thinc 8.2.5 requires numpy<2.0.0,>=1.19.0; python_version >= \"3.9\", but you have numpy 2.0.0 which is incompatible.\n",
|
259 |
+
"langchain 0.3.19 requires numpy<2,>=1.26.4; python_version < \"3.12\", but you have numpy 2.0.0 which is incompatible.\u001b[0m\u001b[31m\n",
|
260 |
+
"\u001b[0mSuccessfully installed execnet-2.1.1 executorch-0.5.0 expecttest-0.3.0 hypothesis-6.127.7 numpy-2.0.0 nvidia-cublas-cu12-12.4.5.8 nvidia-cuda-cupti-cu12-12.4.127 nvidia-cuda-nvrtc-cu12-12.4.127 nvidia-cuda-runtime-cu12-12.4.127 nvidia-cudnn-cu12-9.1.0.70 nvidia-cufft-cu12-11.2.1.3 nvidia-curand-cu12-10.3.5.147 nvidia-cusolver-cu12-11.6.1.9 nvidia-cusparse-cu12-12.3.1.170 nvidia-cusparselt-cu12-0.6.2 nvidia-nvjitlink-cu12-12.4.127 optimum-1.24.0 optimum-executorch-0.0.0.dev0 parameterized-0.9.0 pytest-xdist-3.6.1 ruamel.yaml-0.18.10 ruamel.yaml.clib-0.2.12 torch-2.6.0 torchaudio-2.6.0 torchvision-0.21.0 triton-3.2.0\n"
|
261 |
+
]
|
262 |
+
}
|
263 |
+
],
|
264 |
+
"source": [
|
265 |
+
"! touch /content/optimum-executorch; rm -rf /content/optimum-executorch\n",
|
266 |
+
"! git clone https://github.com/huggingface/optimum-executorch ; cd /content/optimum-executorch; pip install ."
|
267 |
+
]
|
268 |
+
},
|
269 |
+
{
|
270 |
+
"cell_type": "markdown",
|
271 |
+
"source": [
|
272 |
+
"## Step 2: Export to ExecuTorch"
|
273 |
+
],
|
274 |
+
"metadata": {
|
275 |
+
"id": "fC9CGHJraXYo"
|
276 |
+
}
|
277 |
+
},
|
278 |
+
{
|
279 |
+
"cell_type": "code",
|
280 |
+
"source": [
|
281 |
+
"! cd /content/optimum-executorch; optimum-cli export executorch \\\n",
|
282 |
+
" --model \"HuggingFaceTB/SmolLM2-135M\" \\\n",
|
283 |
+
" --task \"text-generation\" \\\n",
|
284 |
+
" --recipe \"xnnpack\" \\\n",
|
285 |
+
" --output_dir=\"./smollmv2_135m\""
|
286 |
+
],
|
287 |
+
"metadata": {
|
288 |
+
"colab": {
|
289 |
+
"base_uri": "https://localhost:8080/"
|
290 |
+
},
|
291 |
+
"id": "ZRh7wlLuad8o",
|
292 |
+
"outputId": "e953dcb6-ca53-49db-f93e-9ed4e21f3950"
|
293 |
+
},
|
294 |
+
"execution_count": 2,
|
295 |
+
"outputs": [
|
296 |
+
{
|
297 |
+
"output_type": "stream",
|
298 |
+
"name": "stdout",
|
299 |
+
"text": [
|
300 |
+
"2025-03-05 22:27:06.717266: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:477] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\n",
|
301 |
+
"WARNING: All log messages before absl::InitializeLog() is called are written to STDERR\n",
|
302 |
+
"E0000 00:00:1741213626.971880 2192 cuda_dnn.cc:8310] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\n",
|
303 |
+
"E0000 00:00:1741213627.038529 2192 cuda_blas.cc:1418] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\n",
|
304 |
+
"2025-03-05 22:27:07.579918: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.\n",
|
305 |
+
"To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.\n",
|
306 |
+
"config.json: 100% 704/704 [00:00<00:00, 5.44MB/s]\n",
|
307 |
+
"model.safetensors: 100% 269M/269M [00:01<00:00, 206MB/s]\n",
|
308 |
+
"The 'batch_size' argument of StaticCache is deprecated and will be removed in v4.49. Use the more precisely named 'max_batch_size' argument instead.\n",
|
309 |
+
"The 'batch_size' attribute of StaticCache is deprecated and will be removed in v4.49. Use the more precisely named 'self.max_batch_size' attribute instead.\n",
|
310 |
+
"/usr/local/lib/python3.11/dist-packages/executorch/exir/emit/_emitter.py:1575: UserWarning: Mutation on a buffer in the model is detected. ExecuTorch assumes buffers that are mutated in the graph have a meaningless initial state, only the shape and dtype will be serialized.\n",
|
311 |
+
" warnings.warn(\n"
|
312 |
+
]
|
313 |
+
}
|
314 |
+
]
|
315 |
+
},
|
316 |
+
{
|
317 |
+
"cell_type": "code",
|
318 |
+
"source": [
|
319 |
+
"! cd /content/optimum-executorch; ls -all ./smollmv2_135m"
|
320 |
+
],
|
321 |
+
"metadata": {
|
322 |
+
"colab": {
|
323 |
+
"base_uri": "https://localhost:8080/"
|
324 |
+
},
|
325 |
+
"id": "gCVEovBPbk1p",
|
326 |
+
"outputId": "2e648007-15ee-47bd-a444-2ae0015976d1"
|
327 |
+
},
|
328 |
+
"execution_count": 6,
|
329 |
+
"outputs": [
|
330 |
+
{
|
331 |
+
"output_type": "stream",
|
332 |
+
"name": "stdout",
|
333 |
+
"text": [
|
334 |
+
"total 530244\n",
|
335 |
+
"drwxr-xr-x 2 root root 4096 Mar 5 22:32 .\n",
|
336 |
+
"drwxr-xr-x 10 root root 4096 Mar 5 22:27 ..\n",
|
337 |
+
"-rw-r--r-- 1 root root 542957120 Mar 5 22:32 model.pte\n"
|
338 |
+
]
|
339 |
+
}
|
340 |
+
]
|
341 |
+
}
|
342 |
+
]
|
343 |
+
}
|