|
2 | 2 | "cells": [
|
3 | 3 | {
|
4 | 4 | "cell_type": "code",
|
5 |
| - "execution_count": 49, |
| 5 | + "execution_count": 1, |
6 | 6 | "id": "1bc79bfd-5c67-4da6-acda-dc70b97981d0",
|
7 | 7 | "metadata": {},
|
8 | 8 | "outputs": [],
|
|
12 | 12 | },
|
13 | 13 | {
|
14 | 14 | "cell_type": "code",
|
15 |
| - "execution_count": 50, |
| 15 | + "execution_count": 2, |
16 | 16 | "id": "b1fa7a6e-3cc9-44db-8c59-ee824b7a6061",
|
17 | 17 | "metadata": {},
|
18 | 18 | "outputs": [],
|
|
22 | 22 | },
|
23 | 23 | {
|
24 | 24 | "cell_type": "code",
|
25 |
| - "execution_count": 51, |
| 25 | + "execution_count": 3, |
26 | 26 | "id": "561648c9-41aa-445d-a0aa-d4ed4837903b",
|
27 | 27 | "metadata": {},
|
28 | 28 | "outputs": [],
|
|
45 | 45 | },
|
46 | 46 | {
|
47 | 47 | "cell_type": "code",
|
48 |
| - "execution_count": 72, |
| 48 | + "execution_count": 4, |
49 | 49 | "id": "8c44b4de-2f03-4af3-a413-76baa24307ab",
|
50 | 50 | "metadata": {},
|
51 | 51 | "outputs": [],
|
|
85 | 85 | },
|
86 | 86 | {
|
87 | 87 | "cell_type": "code",
|
88 |
| - "execution_count": 73, |
| 88 | + "execution_count": 5, |
89 | 89 | "id": "8a53dc2f-2e8c-4e1e-9b45-90efb68b35ab",
|
90 | 90 | "metadata": {},
|
91 | 91 | "outputs": [],
|
|
95 | 95 | },
|
96 | 96 | {
|
97 | 97 | "cell_type": "code",
|
98 |
| - "execution_count": 74, |
| 98 | + "execution_count": 6, |
99 | 99 | "id": "62ee0aed-61d1-414c-8e78-b76b8d98759c",
|
100 | 100 | "metadata": {},
|
101 | 101 | "outputs": [
|
102 | 102 | {
|
103 | 103 | "name": "stderr",
|
104 | 104 | "output_type": "stream",
|
105 | 105 | "text": [
|
106 |
| - "Some weights of the model checkpoint at bert-base-uncased were not used when initializing BertModel: ['cls.predictions.decoder.weight', 'cls.predictions.transform.LayerNorm.bias', 'cls.predictions.transform.dense.bias', 'cls.predictions.transform.dense.weight', 'cls.seq_relationship.weight', 'cls.seq_relationship.bias', 'cls.predictions.bias', 'cls.predictions.transform.LayerNorm.weight']\n", |
| 106 | + "Some weights of the model checkpoint at bert-base-uncased were not used when initializing BertModel: ['cls.predictions.bias', 'cls.predictions.transform.dense.weight', 'cls.predictions.transform.dense.bias', 'cls.predictions.transform.LayerNorm.weight', 'cls.predictions.transform.LayerNorm.bias', 'cls.seq_relationship.bias', 'cls.predictions.decoder.weight', 'cls.seq_relationship.weight']\n", |
107 | 107 | "- This IS expected if you are initializing BertModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).\n",
|
108 | 108 | "- This IS NOT expected if you are initializing BertModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).\n"
|
109 | 109 | ]
|
|
130 | 130 | },
|
131 | 131 | {
|
132 | 132 | "cell_type": "code",
|
133 |
| - "execution_count": 75, |
| 133 | + "execution_count": 7, |
134 | 134 | "id": "5d243431-dc7a-48d0-a644-affc51ca4ae4",
|
135 | 135 | "metadata": {},
|
136 | 136 | "outputs": [],
|
|
142 | 142 | },
|
143 | 143 | {
|
144 | 144 | "cell_type": "code",
|
145 |
| - "execution_count": 76, |
| 145 | + "execution_count": 8, |
146 | 146 | "id": "bab6c4ec-8a14-4ef0-9103-64bf5fbed6f9",
|
147 | 147 | "metadata": {},
|
148 | 148 | "outputs": [],
|
|
171 | 171 | },
|
172 | 172 | {
|
173 | 173 | "cell_type": "code",
|
174 |
| - "execution_count": 77, |
| 174 | + "execution_count": 9, |
175 | 175 | "id": "9f4a66f5-83a7-4f0b-b766-3b04cbe904bb",
|
176 | 176 | "metadata": {},
|
177 | 177 | "outputs": [
|
|
181 | 181 | "torch.int32"
|
182 | 182 | ]
|
183 | 183 | },
|
184 |
| - "execution_count": 77, |
| 184 | + "execution_count": 9, |
185 | 185 | "metadata": {},
|
186 | 186 | "output_type": "execute_result"
|
187 | 187 | }
|
|
195 | 195 | "id": "7aca03dc-8a24-45be-a699-163c652b7f01",
|
196 | 196 | "metadata": {},
|
197 | 197 | "source": [
|
198 |
| - "# Optimize ONNX \n", |
| 198 | + "## Optimize BERT ONNX \n", |
| 199 | + "(Currently makes it slower :-( ) \n", |
199 | 200 | "\n",
|
200 |
| - "https://pypi.org/project/onnxruntime-tools/" |
| 201 | + "See Docs at: https://pypi.org/project/onnxruntime-tools/" |
201 | 202 | ]
|
202 | 203 | },
|
203 | 204 | {
|
204 | 205 | "cell_type": "code",
|
205 |
| - "execution_count": 78, |
| 206 | + "execution_count": 10, |
206 | 207 | "id": "1158ceed-0ba1-4325-88aa-18c950031a5c",
|
207 | 208 | "metadata": {},
|
208 | 209 | "outputs": [
|
|
247 | 248 | " num_heads=12,\n",
|
248 | 249 | " hidden_size=768,\n",
|
249 | 250 | " use_gpu=True)\n",
|
250 |
| - "opt_model.save_model_to_file('sentimet_bert.opt.onnx')" |
| 251 | + "\n", |
| 252 | + "\n", |
| 253 | + "opt_model.save_model_to_file('sentiment_bert.opt.onnx')" |
251 | 254 | ]
|
252 |
| - }, |
253 |
| - { |
254 |
| - "cell_type": "code", |
255 |
| - "execution_count": null, |
256 |
| - "id": "4b7ce667-0ad4-4cb9-89b6-8d096ad2698a", |
257 |
| - "metadata": {}, |
258 |
| - "outputs": [], |
259 |
| - "source": [] |
260 | 255 | }
|
261 | 256 | ],
|
262 | 257 | "metadata": {
|
|
0 commit comments