Skip to content

Commit 583fe6e

Browse files
committedOct 13, 2021
cleaned up pytorch_to_onnx.ipynb
1 parent 74b7f11 commit 583fe6e

File tree

2 files changed

+21
-26
lines changed

2 files changed

+21
-26
lines changed
 

‎rapids_triton_example/example_client.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@
189189
"name": "stdout",
190190
"output_type": "stream",
191191
"text": [
192-
"2.63 ms ± 71.1 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)\n"
192+
"2.79 ms ± 381 µs per loop (mean ± std. dev. of 7 runs, 1 loop each)\n"
193193
]
194194
}
195195
],
@@ -230,7 +230,7 @@
230230
"name": "stdout",
231231
"output_type": "stream",
232232
"text": [
233-
"16 ms ± 599 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
233+
"15.7 ms ± 184 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
234234
]
235235
}
236236
],
@@ -250,7 +250,7 @@
250250
"name": "stdout",
251251
"output_type": "stream",
252252
"text": [
253-
"60.9 ms ± 216 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
253+
"59.8 ms ± 1.13 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n"
254254
]
255255
}
256256
],

‎rapids_triton_example/pytorch_to_onnx/pytorch_to_trt.ipynb ‎rapids_triton_example/pytorch_to_onnx/pytorch_to_onnx.ipynb

+18-23
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 49,
5+
"execution_count": 1,
66
"id": "1bc79bfd-5c67-4da6-acda-dc70b97981d0",
77
"metadata": {},
88
"outputs": [],
@@ -12,7 +12,7 @@
1212
},
1313
{
1414
"cell_type": "code",
15-
"execution_count": 50,
15+
"execution_count": 2,
1616
"id": "b1fa7a6e-3cc9-44db-8c59-ee824b7a6061",
1717
"metadata": {},
1818
"outputs": [],
@@ -22,7 +22,7 @@
2222
},
2323
{
2424
"cell_type": "code",
25-
"execution_count": 51,
25+
"execution_count": 3,
2626
"id": "561648c9-41aa-445d-a0aa-d4ed4837903b",
2727
"metadata": {},
2828
"outputs": [],
@@ -45,7 +45,7 @@
4545
},
4646
{
4747
"cell_type": "code",
48-
"execution_count": 72,
48+
"execution_count": 4,
4949
"id": "8c44b4de-2f03-4af3-a413-76baa24307ab",
5050
"metadata": {},
5151
"outputs": [],
@@ -85,7 +85,7 @@
8585
},
8686
{
8787
"cell_type": "code",
88-
"execution_count": 73,
88+
"execution_count": 5,
8989
"id": "8a53dc2f-2e8c-4e1e-9b45-90efb68b35ab",
9090
"metadata": {},
9191
"outputs": [],
@@ -95,15 +95,15 @@
9595
},
9696
{
9797
"cell_type": "code",
98-
"execution_count": 74,
98+
"execution_count": 6,
9999
"id": "62ee0aed-61d1-414c-8e78-b76b8d98759c",
100100
"metadata": {},
101101
"outputs": [
102102
{
103103
"name": "stderr",
104104
"output_type": "stream",
105105
"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",
107107
"- 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",
108108
"- 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"
109109
]
@@ -130,7 +130,7 @@
130130
},
131131
{
132132
"cell_type": "code",
133-
"execution_count": 75,
133+
"execution_count": 7,
134134
"id": "5d243431-dc7a-48d0-a644-affc51ca4ae4",
135135
"metadata": {},
136136
"outputs": [],
@@ -142,7 +142,7 @@
142142
},
143143
{
144144
"cell_type": "code",
145-
"execution_count": 76,
145+
"execution_count": 8,
146146
"id": "bab6c4ec-8a14-4ef0-9103-64bf5fbed6f9",
147147
"metadata": {},
148148
"outputs": [],
@@ -171,7 +171,7 @@
171171
},
172172
{
173173
"cell_type": "code",
174-
"execution_count": 77,
174+
"execution_count": 9,
175175
"id": "9f4a66f5-83a7-4f0b-b766-3b04cbe904bb",
176176
"metadata": {},
177177
"outputs": [
@@ -181,7 +181,7 @@
181181
"torch.int32"
182182
]
183183
},
184-
"execution_count": 77,
184+
"execution_count": 9,
185185
"metadata": {},
186186
"output_type": "execute_result"
187187
}
@@ -195,14 +195,15 @@
195195
"id": "7aca03dc-8a24-45be-a699-163c652b7f01",
196196
"metadata": {},
197197
"source": [
198-
"# Optimize ONNX \n",
198+
"## Optimize BERT ONNX \n",
199+
"(Currently makes it slower :-( ) \n",
199200
"\n",
200-
"https://pypi.org/project/onnxruntime-tools/"
201+
"See Docs at: https://pypi.org/project/onnxruntime-tools/"
201202
]
202203
},
203204
{
204205
"cell_type": "code",
205-
"execution_count": 78,
206+
"execution_count": 10,
206207
"id": "1158ceed-0ba1-4325-88aa-18c950031a5c",
207208
"metadata": {},
208209
"outputs": [
@@ -247,16 +248,10 @@
247248
" num_heads=12,\n",
248249
" hidden_size=768,\n",
249250
" 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')"
251254
]
252-
},
253-
{
254-
"cell_type": "code",
255-
"execution_count": null,
256-
"id": "4b7ce667-0ad4-4cb9-89b6-8d096ad2698a",
257-
"metadata": {},
258-
"outputs": [],
259-
"source": []
260255
}
261256
],
262257
"metadata": {

0 commit comments

Comments
 (0)