|
2 | 2 | "cells": [ |
3 | 3 | { |
4 | 4 | "cell_type": "code", |
5 | | - "execution_count": 2, |
| 5 | + "execution_count": 1, |
6 | 6 | "id": "f5f60283-55bb-481a-983f-610d0c967532", |
7 | 7 | "metadata": {}, |
8 | 8 | "outputs": [], |
|
14 | 14 | }, |
15 | 15 | { |
16 | 16 | "cell_type": "code", |
17 | | - "execution_count": 3, |
| 17 | + "execution_count": 2, |
18 | 18 | "id": "796c7458-1b0c-4520-add7-b9014916af22", |
19 | 19 | "metadata": {}, |
20 | 20 | "outputs": [ |
21 | 21 | { |
22 | 22 | "name": "stderr", |
23 | 23 | "output_type": "stream", |
24 | 24 | "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", |
26 | 26 | "- 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", |
27 | 27 | "- 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" |
28 | 28 | ] |
|
34 | 34 | }, |
35 | 35 | { |
36 | 36 | "cell_type": "code", |
37 | | - "execution_count": 4, |
| 37 | + "execution_count": 3, |
38 | 38 | "id": "4ddb2410-cc9b-4ce1-a323-4759d9afd549", |
39 | 39 | "metadata": {}, |
40 | 40 | "outputs": [ |
|
63 | 63 | " 'sequence': 'steve jobs is the father of apple'}]" |
64 | 64 | ] |
65 | 65 | }, |
66 | | - "execution_count": 4, |
| 66 | + "execution_count": 3, |
67 | 67 | "metadata": {}, |
68 | 68 | "output_type": "execute_result" |
69 | 69 | } |
|
74 | 74 | }, |
75 | 75 | { |
76 | 76 | "cell_type": "code", |
77 | | - "execution_count": 5, |
| 77 | + "execution_count": 4, |
78 | 78 | "id": "4d2c7245-d1bf-4466-89f0-c99b4c7bd8a7", |
79 | 79 | "metadata": {}, |
80 | 80 | "outputs": [], |
|
85 | 85 | }, |
86 | 86 | { |
87 | 87 | "cell_type": "code", |
88 | | - "execution_count": 6, |
| 88 | + "execution_count": 5, |
89 | 89 | "id": "6f2f9d6d-a6a3-4a94-ba5e-0dbec405a90c", |
90 | 90 | "metadata": {}, |
91 | 91 | "outputs": [], |
|
97 | 97 | }, |
98 | 98 | { |
99 | 99 | "cell_type": "code", |
100 | | - "execution_count": 7, |
| 100 | + "execution_count": 6, |
101 | 101 | "id": "80cbf5a2-4613-4614-aeff-5db4d56c156c", |
102 | 102 | "metadata": {}, |
103 | 103 | "outputs": [], |
|
107 | 107 | }, |
108 | 108 | { |
109 | 109 | "cell_type": "code", |
110 | | - "execution_count": 9, |
| 110 | + "execution_count": 7, |
111 | 111 | "id": "160b1a5a-e1f5-49da-91e8-a9a8bdc10a34", |
112 | 112 | "metadata": {}, |
113 | 113 | "outputs": [ |
114 | 114 | { |
115 | 115 | "data": { |
116 | 116 | "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", |
119 | 119 | " 'status': 'IN_PROGRESS',\n", |
120 | 120 | " 'name': 'my_model_3'}" |
121 | 121 | ] |
122 | 122 | }, |
123 | | - "execution_count": 9, |
| 123 | + "execution_count": 7, |
124 | 124 | "metadata": {}, |
125 | 125 | "output_type": "execute_result" |
126 | 126 | } |
|
131 | 131 | }, |
132 | 132 | { |
133 | 133 | "cell_type": "code", |
134 | | - "execution_count": 8, |
| 134 | + "execution_count": 1, |
135 | 135 | "id": "0b47a4f9-a195-4155-b4ce-1ae67dfb16af", |
136 | 136 | "metadata": {}, |
137 | 137 | "outputs": [ |
138 | 138 | { |
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 | + ] |
150 | 148 | } |
151 | 149 | ], |
152 | 150 | "source": [ |
|
155 | 153 | }, |
156 | 154 | { |
157 | 155 | "cell_type": "code", |
158 | | - "execution_count": 10, |
| 156 | + "execution_count": 9, |
159 | 157 | "id": "c6521f61-9de8-4b7f-a5d7-d6e8673e6e8c", |
160 | 158 | "metadata": {}, |
161 | 159 | "outputs": [ |
162 | 160 | { |
163 | 161 | "name": "stdout", |
164 | 162 | "output_type": "stream", |
165 | 163 | "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: " |
167 | 177 | ] |
168 | 178 | } |
169 | 179 | ], |
|
192 | 202 | }, |
193 | 203 | { |
194 | 204 | "cell_type": "code", |
195 | | - "execution_count": 11, |
| 205 | + "execution_count": 12, |
196 | 206 | "id": "0a775518-1577-4430-b80f-d580218526ea", |
197 | 207 | "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": [], |
207 | 209 | "source": [ |
208 | 210 | "input_text = 'Steve jobs is the [MASK] of Apple.'\n", |
209 | 211 | "prediction = client.predict(model_version_id=response.id, model_input=input_text)" |
210 | 212 | ] |
211 | 213 | }, |
212 | 214 | { |
213 | 215 | "cell_type": "code", |
214 | | - "execution_count": 13, |
| 216 | + "execution_count": null, |
215 | 217 | "id": "17947dfb-ac77-473e-a758-515d5cd324d4", |
216 | 218 | "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": [], |
248 | 220 | "source": [ |
249 | 221 | "prediction['model_response']['predictions']" |
250 | 222 | ] |
|
0 commit comments