Skip to content

Commit 3355944

Browse files
committed
finalize model deployment
1 parent 376c38e commit 3355944

File tree

9 files changed

+93
-449
lines changed

9 files changed

+93
-449
lines changed

hf_test_2.ipynb

Lines changed: 40 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 2,
5+
"execution_count": 1,
66
"id": "f5f60283-55bb-481a-983f-610d0c967532",
77
"metadata": {},
88
"outputs": [],
@@ -14,15 +14,15 @@
1414
},
1515
{
1616
"cell_type": "code",
17-
"execution_count": 3,
17+
"execution_count": 2,
1818
"id": "796c7458-1b0c-4520-add7-b9014916af22",
1919
"metadata": {},
2020
"outputs": [
2121
{
2222
"name": "stderr",
2323
"output_type": "stream",
2424
"text": [
25-
"Some weights of the model checkpoint at bert-base-uncased were not used when initializing BertForMaskedLM: ['cls.seq_relationship.bias', 'bert.pooler.dense.bias', 'bert.pooler.dense.weight', 'cls.seq_relationship.weight']\n",
25+
"Some weights of the model checkpoint at bert-base-uncased were not used when initializing BertForMaskedLM: ['bert.pooler.dense.bias', 'cls.seq_relationship.bias', 'bert.pooler.dense.weight', 'cls.seq_relationship.weight']\n",
2626
"- This IS expected if you are initializing BertForMaskedLM 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",
2727
"- This IS NOT expected if you are initializing BertForMaskedLM from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).\n"
2828
]
@@ -34,7 +34,7 @@
3434
},
3535
{
3636
"cell_type": "code",
37-
"execution_count": 4,
37+
"execution_count": 3,
3838
"id": "4ddb2410-cc9b-4ce1-a323-4759d9afd549",
3939
"metadata": {},
4040
"outputs": [
@@ -63,7 +63,7 @@
6363
" 'sequence': 'steve jobs is the father of apple'}]"
6464
]
6565
},
66-
"execution_count": 4,
66+
"execution_count": 3,
6767
"metadata": {},
6868
"output_type": "execute_result"
6969
}
@@ -74,7 +74,7 @@
7474
},
7575
{
7676
"cell_type": "code",
77-
"execution_count": 5,
77+
"execution_count": 4,
7878
"id": "4d2c7245-d1bf-4466-89f0-c99b4c7bd8a7",
7979
"metadata": {},
8080
"outputs": [],
@@ -85,7 +85,7 @@
8585
},
8686
{
8787
"cell_type": "code",
88-
"execution_count": 6,
88+
"execution_count": 5,
8989
"id": "6f2f9d6d-a6a3-4a94-ba5e-0dbec405a90c",
9090
"metadata": {},
9191
"outputs": [],
@@ -97,7 +97,7 @@
9797
},
9898
{
9999
"cell_type": "code",
100-
"execution_count": 7,
100+
"execution_count": 6,
101101
"id": "80cbf5a2-4613-4614-aeff-5db4d56c156c",
102102
"metadata": {},
103103
"outputs": [],
@@ -107,20 +107,20 @@
107107
},
108108
{
109109
"cell_type": "code",
110-
"execution_count": 9,
110+
"execution_count": 7,
111111
"id": "160b1a5a-e1f5-49da-91e8-a9a8bdc10a34",
112112
"metadata": {},
113113
"outputs": [
114114
{
115115
"data": {
116116
"text/plain": [
117-
"{'id': 'c93e32d2-5c52-4caf-8830-e4729eb0b987',\n",
118-
" 'created': '2023-09-24T21:06:29.115401Z',\n",
117+
"{'id': '653adbbd-fb58-47bb-b47b-6586f10739c2',\n",
118+
" 'created': '2023-10-10T22:39:56.607079Z',\n",
119119
" 'status': 'IN_PROGRESS',\n",
120120
" 'name': 'my_model_3'}"
121121
]
122122
},
123-
"execution_count": 9,
123+
"execution_count": 7,
124124
"metadata": {},
125125
"output_type": "execute_result"
126126
}
@@ -131,22 +131,20 @@
131131
},
132132
{
133133
"cell_type": "code",
134-
"execution_count": 8,
134+
"execution_count": 1,
135135
"id": "0b47a4f9-a195-4155-b4ce-1ae67dfb16af",
136136
"metadata": {},
137137
"outputs": [
138138
{
139-
"data": {
140-
"text/plain": [
141-
"{'id': 'c93e32d2-5c52-4caf-8830-e4729eb0b987',\n",
142-
" 'created': '2023-09-24T21:06:29.115401Z',\n",
143-
" 'status': 'IN_PROGRESS',\n",
144-
" 'name': 'my_model_3'}"
145-
]
146-
},
147-
"execution_count": 8,
148-
"metadata": {},
149-
"output_type": "execute_result"
139+
"ename": "NameError",
140+
"evalue": "name 'client' is not defined",
141+
"output_type": "error",
142+
"traceback": [
143+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
144+
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
145+
"Cell \u001b[0;32mIn[1], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mclient\u001b[49m\u001b[38;5;241m.\u001b[39mstatus(model_version_id\u001b[38;5;241m=\u001b[39mresponse\u001b[38;5;241m.\u001b[39mid)\n",
146+
"\u001b[0;31mNameError\u001b[0m: name 'client' is not defined"
147+
]
150148
}
151149
],
152150
"source": [
@@ -155,15 +153,27 @@
155153
},
156154
{
157155
"cell_type": "code",
158-
"execution_count": 10,
156+
"execution_count": 9,
159157
"id": "c6521f61-9de8-4b7f-a5d7-d6e8673e6e8c",
160158
"metadata": {},
161159
"outputs": [
162160
{
163161
"name": "stdout",
164162
"output_type": "stream",
165163
"text": [
166-
"model succeeded\n"
164+
"status: IN_PROGRESS\n",
165+
"trying again in 5 seconds\n"
166+
]
167+
},
168+
{
169+
"ename": "KeyboardInterrupt",
170+
"evalue": "",
171+
"output_type": "error",
172+
"traceback": [
173+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
174+
"\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
175+
"Cell \u001b[0;32mIn[9], line 6\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mstatus: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mstatus\u001b[38;5;241m.\u001b[39mstatus\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtrying again in 5 seconds\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m----> 6\u001b[0m \u001b[43mtime\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msleep\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m5\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 7\u001b[0m status \u001b[38;5;241m=\u001b[39m model\u001b[38;5;241m.\u001b[39mstatus(model_version_id\u001b[38;5;241m=\u001b[39mresponse\u001b[38;5;241m.\u001b[39mid)\n\u001b[1;32m 9\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m status\u001b[38;5;241m.\u001b[39mstatus \u001b[38;5;129;01min\u001b[39;00m [\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mFAILED\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mERROR\u001b[39m\u001b[38;5;124m\"\u001b[39m]:\n",
176+
"\u001b[0;31mKeyboardInterrupt\u001b[0m: "
167177
]
168178
}
169179
],
@@ -192,59 +202,21 @@
192202
},
193203
{
194204
"cell_type": "code",
195-
"execution_count": 11,
205+
"execution_count": 12,
196206
"id": "0a775518-1577-4430-b80f-d580218526ea",
197207
"metadata": {},
198-
"outputs": [
199-
{
200-
"name": "stdout",
201-
"output_type": "stream",
202-
"text": [
203-
"{'id': 'c93e32d2-5c52-4caf-8830-e4729eb0b987', 'model_input': 'Steve jobs is the [MASK] of Apple.', 'model_response': {'predictions': [{'score': 0.49993884563446045, 'sequence': 'steve jobs is the founder of apple.', 'token': 3910, 'token_str': 'founder'}, {'score': 0.39265578985214233, 'sequence': 'steve jobs is the ceo of apple.', 'token': 5766, 'token_str': 'ceo'}, {'score': 0.04603331536054611, 'sequence': 'steve jobs is the president of apple.', 'token': 2343, 'token_str': 'president'}, {'score': 0.01692850887775421, 'sequence': 'steve jobs is the creator of apple.', 'token': 8543, 'token_str': 'creator'}, {'score': 0.008718223311007023, 'sequence': 'steve jobs is the chairman of apple.', 'token': 3472, 'token_str': 'chairman'}]}}\n"
204-
]
205-
}
206-
],
208+
"outputs": [],
207209
"source": [
208210
"input_text = 'Steve jobs is the [MASK] of Apple.'\n",
209211
"prediction = client.predict(model_version_id=response.id, model_input=input_text)"
210212
]
211213
},
212214
{
213215
"cell_type": "code",
214-
"execution_count": 13,
216+
"execution_count": null,
215217
"id": "17947dfb-ac77-473e-a758-515d5cd324d4",
216218
"metadata": {},
217-
"outputs": [
218-
{
219-
"data": {
220-
"text/plain": [
221-
"[{'score': 0.49993884563446045,\n",
222-
" 'sequence': 'steve jobs is the founder of apple.',\n",
223-
" 'token': 3910,\n",
224-
" 'token_str': 'founder'},\n",
225-
" {'score': 0.39265578985214233,\n",
226-
" 'sequence': 'steve jobs is the ceo of apple.',\n",
227-
" 'token': 5766,\n",
228-
" 'token_str': 'ceo'},\n",
229-
" {'score': 0.04603331536054611,\n",
230-
" 'sequence': 'steve jobs is the president of apple.',\n",
231-
" 'token': 2343,\n",
232-
" 'token_str': 'president'},\n",
233-
" {'score': 0.01692850887775421,\n",
234-
" 'sequence': 'steve jobs is the creator of apple.',\n",
235-
" 'token': 8543,\n",
236-
" 'token_str': 'creator'},\n",
237-
" {'score': 0.008718223311007023,\n",
238-
" 'sequence': 'steve jobs is the chairman of apple.',\n",
239-
" 'token': 3472,\n",
240-
" 'token_str': 'chairman'}]"
241-
]
242-
},
243-
"execution_count": 13,
244-
"metadata": {},
245-
"output_type": "execute_result"
246-
}
247-
],
219+
"outputs": [],
248220
"source": [
249221
"prediction['model_response']['predictions']"
250222
]

my_model.tar.gz

-4.25 MB
Binary file not shown.

my_model/config.yaml

Lines changed: 0 additions & 45 deletions
This file was deleted.
-4.58 MB
Binary file not shown.

my_model/examples.yaml

Whitespace-only changes.

my_model/model/__init__.py

Whitespace-only changes.

my_model/model/model.py

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)