hassan4830 commited on
Commit
86d4036
1 Parent(s): 774b5a0

Delete hugging face text classifier.ipynb

Browse files
Files changed (1) hide show
  1. hugging face text classifier.ipynb +0 -1114
hugging face text classifier.ipynb DELETED
@@ -1,1114 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": 1,
6
- "id": "fcb5ed0e",
7
- "metadata": {},
8
- "outputs": [
9
- {
10
- "name": "stderr",
11
- "output_type": "stream",
12
- "text": [
13
- "/home/administrator/.local/lib/python3.8/site-packages/tqdm/auto.py:22: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
14
- " from .autonotebook import tqdm as notebook_tqdm\n"
15
- ]
16
- }
17
- ],
18
- "source": [
19
- "#!pip install torch\n",
20
- "import torch\n",
21
- "device = torch.device('cuda')"
22
- ]
23
- },
24
- {
25
- "cell_type": "code",
26
- "execution_count": 2,
27
- "id": "0f8058d5",
28
- "metadata": {},
29
- "outputs": [
30
- {
31
- "data": {
32
- "text/plain": [
33
- "device(type='cuda')"
34
- ]
35
- },
36
- "execution_count": 2,
37
- "metadata": {},
38
- "output_type": "execute_result"
39
- }
40
- ],
41
- "source": [
42
- "device"
43
- ]
44
- },
45
- {
46
- "cell_type": "code",
47
- "execution_count": 3,
48
- "id": "1b13da51",
49
- "metadata": {},
50
- "outputs": [
51
- {
52
- "name": "stdout",
53
- "output_type": "stream",
54
- "text": [
55
- "Mon Jul 18 14:47:09 2022 \r\n",
56
- "+-----------------------------------------------------------------------------+\r\n",
57
- "| NVIDIA-SMI 510.47.03 Driver Version: 510.47.03 CUDA Version: 11.6 |\r\n",
58
- "|-------------------------------+----------------------+----------------------+\r\n",
59
- "| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\r\n",
60
- "| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\r\n",
61
- "| | | MIG M. |\r\n",
62
- "|===============================+======================+======================|\r\n",
63
- "| 0 NVIDIA GeForce ... On | 00000000:01:00.0 On | N/A |\r\n",
64
- "| 0% 42C P8 31W / 320W | 3209MiB / 10240MiB | 11% Default |\r\n",
65
- "| | | N/A |\r\n",
66
- "+-------------------------------+----------------------+----------------------+\r\n",
67
- " \r\n",
68
- "+-----------------------------------------------------------------------------+\r\n",
69
- "| Processes: |\r\n",
70
- "| GPU GI CI PID Type Process name GPU Memory |\r\n",
71
- "| ID ID Usage |\r\n",
72
- "|=============================================================================|\r\n",
73
- "| 0 N/A N/A 1061 G /usr/lib/xorg/Xorg 171MiB |\r\n",
74
- "| 0 N/A N/A 1510 G cinnamon 35MiB |\r\n",
75
- "| 0 N/A N/A 2542 G /usr/lib/firefox/firefox 150MiB |\r\n",
76
- "| 0 N/A N/A 2899 C /usr/bin/python3 2843MiB |\r\n",
77
- "| 0 N/A N/A 3957 G /usr/lib/firefox/firefox-bin 3MiB |\r\n",
78
- "+-----------------------------------------------------------------------------+\r\n"
79
- ]
80
- }
81
- ],
82
- "source": [
83
- "!nvidia-smi"
84
- ]
85
- },
86
- {
87
- "cell_type": "code",
88
- "execution_count": 4,
89
- "id": "1513fee7",
90
- "metadata": {},
91
- "outputs": [],
92
- "source": [
93
- "#!pip install pandas\n",
94
- "import numpy as np \n",
95
- "import pandas as pd"
96
- ]
97
- },
98
- {
99
- "cell_type": "code",
100
- "execution_count": 5,
101
- "id": "d33202d1",
102
- "metadata": {},
103
- "outputs": [
104
- {
105
- "name": "stderr",
106
- "output_type": "stream",
107
- "text": [
108
- "/usr/lib/python3/dist-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.10) or chardet (3.0.4) doesn't match a supported version!\n",
109
- " warnings.warn(\"urllib3 ({}) or chardet ({}) doesn't match a supported \"\n",
110
- "Reusing dataset imdb (/home/administrator/.cache/huggingface/datasets/imdb/plain_text/1.0.0/2fdd8b9bcadd6e7055e742a706876ba43f19faee861df134affd7a3f60fc38a1)\n",
111
- "100%|███████████████████████████████████████████| 3/3 [00:00<00:00, 1113.04it/s]\n"
112
- ]
113
- }
114
- ],
115
- "source": [
116
- "#!pip install datasets\n",
117
- "from datasets import load_dataset\n",
118
- "imdb = load_dataset(\"imdb\")"
119
- ]
120
- },
121
- {
122
- "cell_type": "code",
123
- "execution_count": 6,
124
- "id": "5624c9e3",
125
- "metadata": {},
126
- "outputs": [],
127
- "source": [
128
- "#!pip install transformers\n",
129
- "from transformers import AutoTokenizer\n",
130
- "tokenizer = AutoTokenizer.from_pretrained(\"distilbert-base-uncased\")"
131
- ]
132
- },
133
- {
134
- "cell_type": "code",
135
- "execution_count": 7,
136
- "id": "8af0934e",
137
- "metadata": {},
138
- "outputs": [],
139
- "source": [
140
- "def preprocess_function(examples):\n",
141
- " return tokenizer(examples[\"text\"], truncation=True)"
142
- ]
143
- },
144
- {
145
- "cell_type": "code",
146
- "execution_count": 8,
147
- "id": "dec51d8c",
148
- "metadata": {},
149
- "outputs": [
150
- {
151
- "name": "stderr",
152
- "output_type": "stream",
153
- "text": [
154
- "Parameter 'function'=<function preprocess_function at 0x7f49ee534d30> of the transform datasets.arrow_dataset.Dataset._map_single couldn't be hashed properly, a random hash was used instead. Make sure your transforms and parameters are serializable with pickle or dill for the dataset fingerprinting and caching to work. If you reuse this transform, the caching mechanism will consider it to be different from the previous calls and recompute everything. This warning is only showed once. Subsequent hashing failures won't be showed.\n",
155
- "100%|███████████████████████████████████████████| 25/25 [00:02<00:00, 9.68ba/s]\n",
156
- "100%|███████████████████████████████████████████| 25/25 [00:02<00:00, 9.94ba/s]\n",
157
- "100%|███████████████████████████████████████████| 50/50 [00:05<00:00, 9.56ba/s]\n"
158
- ]
159
- }
160
- ],
161
- "source": [
162
- "tokenized_imdb = imdb.map(preprocess_function, batched=True)"
163
- ]
164
- },
165
- {
166
- "cell_type": "code",
167
- "execution_count": 9,
168
- "id": "b8665b3c",
169
- "metadata": {},
170
- "outputs": [
171
- {
172
- "data": {
173
- "text/plain": [
174
- "{'text': 'I love sci-fi and am willing to put up with a lot. Sci-fi movies/TV are usually underfunded, under-appreciated and misunderstood. I tried to like this, I really did, but it is to good TV sci-fi as Babylon 5 is to Star Trek (the original). Silly prosthetics, cheap cardboard sets, stilted dialogues, CG that doesn\\'t match the background, and painfully one-dimensional characters cannot be overcome with a \\'sci-fi\\' setting. (I\\'m sure there are those of you out there who think Babylon 5 is good sci-fi TV. It\\'s not. It\\'s clichéd and uninspiring.) While US viewers might like emotion and character development, sci-fi is a genre that does not take itself seriously (cf. Star Trek). It may treat important issues, yet not as a serious philosophy. It\\'s really difficult to care about the characters here as they are not simply foolish, just missing a spark of life. Their actions and reactions are wooden and predictable, often painful to watch. The makers of Earth KNOW it\\'s rubbish as they have to always say \"Gene Roddenberry\\'s Earth...\" otherwise people would not continue watching. Roddenberry\\'s ashes must be turning in their orbit as this dull, cheap, poorly edited (watching it without advert breaks really brings this home) trudging Trabant of a show lumbers into space. Spoiler. So, kill off a main character. And then bring him back as another actor. Jeeez! Dallas all over again.',\n",
175
- " 'label': 0}"
176
- ]
177
- },
178
- "execution_count": 9,
179
- "metadata": {},
180
- "output_type": "execute_result"
181
- }
182
- ],
183
- "source": [
184
- "imdb['test'][0]"
185
- ]
186
- },
187
- {
188
- "cell_type": "code",
189
- "execution_count": 10,
190
- "id": "3c916b03",
191
- "metadata": {},
192
- "outputs": [],
193
- "source": [
194
- "from transformers import DataCollatorWithPadding\n",
195
- "data_collator = DataCollatorWithPadding(tokenizer=tokenizer)"
196
- ]
197
- },
198
- {
199
- "cell_type": "code",
200
- "execution_count": 11,
201
- "id": "4c8e9902",
202
- "metadata": {},
203
- "outputs": [
204
- {
205
- "name": "stderr",
206
- "output_type": "stream",
207
- "text": [
208
- "Some weights of the model checkpoint at distilbert-base-uncased were not used when initializing DistilBertForSequenceClassification: ['vocab_projector.weight', 'vocab_transform.weight', 'vocab_layer_norm.bias', 'vocab_transform.bias', 'vocab_layer_norm.weight', 'vocab_projector.bias']\n",
209
- "- This IS expected if you are initializing DistilBertForSequenceClassification 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",
210
- "- This IS NOT expected if you are initializing DistilBertForSequenceClassification from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).\n",
211
- "Some weights of DistilBertForSequenceClassification were not initialized from the model checkpoint at distilbert-base-uncased and are newly initialized: ['classifier.weight', 'pre_classifier.weight', 'classifier.bias', 'pre_classifier.bias']\n",
212
- "You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.\n"
213
- ]
214
- }
215
- ],
216
- "source": [
217
- "from transformers import AutoModelForSequenceClassification, TrainingArguments, Trainer\n",
218
- "model = AutoModelForSequenceClassification.from_pretrained(\"distilbert-base-uncased\", num_labels=2)"
219
- ]
220
- },
221
- {
222
- "cell_type": "code",
223
- "execution_count": 12,
224
- "id": "0d162112",
225
- "metadata": {},
226
- "outputs": [],
227
- "source": [
228
- "import pickle\n",
229
- "pickle.dump(model, open(\"dist_bert_uncased.pkl\",\"wb\"))"
230
- ]
231
- },
232
- {
233
- "cell_type": "code",
234
- "execution_count": 13,
235
- "id": "25c57b94",
236
- "metadata": {},
237
- "outputs": [],
238
- "source": [
239
- "#!pip3 install --upgrade tensorflow-gpu"
240
- ]
241
- },
242
- {
243
- "cell_type": "code",
244
- "execution_count": 14,
245
- "id": "fe48e099",
246
- "metadata": {},
247
- "outputs": [
248
- {
249
- "name": "stdout",
250
- "output_type": "stream",
251
- "text": [
252
- "Num GPUs Available: 0\n"
253
- ]
254
- },
255
- {
256
- "name": "stderr",
257
- "output_type": "stream",
258
- "text": [
259
- "2022-07-18 14:47:35.224460: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
260
- "2022-07-18 14:47:35.321191: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudnn.so.8'; dlerror: libcudnn.so.8: cannot open shared object file: No such file or directory\n",
261
- "2022-07-18 14:47:35.321211: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1850] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.\n",
262
- "Skipping registering GPU devices...\n"
263
- ]
264
- }
265
- ],
266
- "source": [
267
- "#!pip install tensorflow\n",
268
- "import tensorflow as tf\n",
269
- "print(\"Num GPUs Available: \", len(tf.config.list_physical_devices('GPU')))"
270
- ]
271
- },
272
- {
273
- "cell_type": "code",
274
- "execution_count": 15,
275
- "id": "23929dda",
276
- "metadata": {},
277
- "outputs": [],
278
- "source": [
279
- "import gc\n",
280
- "gc.collect()\n",
281
- "torch.cuda.empty_cache()"
282
- ]
283
- },
284
- {
285
- "cell_type": "code",
286
- "execution_count": 16,
287
- "id": "7adddbb6",
288
- "metadata": {},
289
- "outputs": [
290
- {
291
- "data": {
292
- "text/plain": [
293
- "'|===========================================================================|\\n| PyTorch CUDA memory summary, device ID 0 |\\n|---------------------------------------------------------------------------|\\n| CUDA OOMs: 0 | cudaMalloc retries: 0 |\\n|===========================================================================|\\n| Metric | Cur Usage | Peak Usage | Tot Alloc | Tot Freed |\\n|---------------------------------------------------------------------------|\\n| Allocated memory | 0 B | 0 B | 0 B | 0 B |\\n| from large pool | 0 B | 0 B | 0 B | 0 B |\\n| from small pool | 0 B | 0 B | 0 B | 0 B |\\n|---------------------------------------------------------------------------|\\n| Active memory | 0 B | 0 B | 0 B | 0 B |\\n| from large pool | 0 B | 0 B | 0 B | 0 B |\\n| from small pool | 0 B | 0 B | 0 B | 0 B |\\n|---------------------------------------------------------------------------|\\n| GPU reserved memory | 0 B | 0 B | 0 B | 0 B |\\n| from large pool | 0 B | 0 B | 0 B | 0 B |\\n| from small pool | 0 B | 0 B | 0 B | 0 B |\\n|---------------------------------------------------------------------------|\\n| Non-releasable memory | 0 B | 0 B | 0 B | 0 B |\\n| from large pool | 0 B | 0 B | 0 B | 0 B |\\n| from small pool | 0 B | 0 B | 0 B | 0 B |\\n|---------------------------------------------------------------------------|\\n| Allocations | 0 | 0 | 0 | 0 |\\n| from large pool | 0 | 0 | 0 | 0 |\\n| from small pool | 0 | 0 | 0 | 0 |\\n|---------------------------------------------------------------------------|\\n| Active allocs | 0 | 0 | 0 | 0 |\\n| from large pool | 0 | 0 | 0 | 0 |\\n| from small pool | 0 | 0 | 0 | 0 |\\n|---------------------------------------------------------------------------|\\n| GPU reserved segments | 0 | 0 | 0 | 0 |\\n| from large pool | 0 | 0 | 0 | 0 |\\n| from small pool | 0 | 0 | 0 | 0 |\\n|---------------------------------------------------------------------------|\\n| Non-releasable allocs | 0 | 0 | 0 | 0 |\\n| from large pool | 0 | 0 | 0 | 0 |\\n| from small pool | 0 | 0 | 0 | 0 |\\n|---------------------------------------------------------------------------|\\n| Oversize allocations | 0 | 0 | 0 | 0 |\\n|---------------------------------------------------------------------------|\\n| Oversize GPU segments | 0 | 0 | 0 | 0 |\\n|===========================================================================|\\n'"
294
- ]
295
- },
296
- "execution_count": 16,
297
- "metadata": {},
298
- "output_type": "execute_result"
299
- }
300
- ],
301
- "source": [
302
- "torch.cuda.memory_summary(device=None, abbreviated=False)"
303
- ]
304
- },
305
- {
306
- "cell_type": "code",
307
- "execution_count": 17,
308
- "id": "f6e1ca9d",
309
- "metadata": {},
310
- "outputs": [
311
- {
312
- "name": "stderr",
313
- "output_type": "stream",
314
- "text": [
315
- "The following columns in the training set don't have a corresponding argument in `DistilBertForSequenceClassification.forward` and have been ignored: text. If text are not expected by `DistilBertForSequenceClassification.forward`, you can safely ignore this message.\n",
316
- "/home/administrator/.local/lib/python3.8/site-packages/transformers/optimization.py:306: FutureWarning: This implementation of AdamW is deprecated and will be removed in a future version. Use the PyTorch implementation torch.optim.AdamW instead, or set `no_deprecation_warning=True` to disable this warning\n",
317
- " warnings.warn(\n",
318
- "***** Running training *****\n",
319
- " Num examples = 25000\n",
320
- " Num Epochs = 5\n",
321
- " Instantaneous batch size per device = 4\n",
322
- " Total train batch size (w. parallel, distributed & accumulation) = 4\n",
323
- " Gradient Accumulation steps = 1\n",
324
- " Total optimization steps = 31250\n"
325
- ]
326
- },
327
- {
328
- "data": {
329
- "text/html": [
330
- "\n",
331
- " <div>\n",
332
- " \n",
333
- " <progress value='31250' max='31250' style='width:300px; height:20px; vertical-align: middle;'></progress>\n",
334
- " [31250/31250 28:05, Epoch 5/5]\n",
335
- " </div>\n",
336
- " <table border=\"1\" class=\"dataframe\">\n",
337
- " <thead>\n",
338
- " <tr style=\"text-align: left;\">\n",
339
- " <th>Step</th>\n",
340
- " <th>Training Loss</th>\n",
341
- " </tr>\n",
342
- " </thead>\n",
343
- " <tbody>\n",
344
- " <tr>\n",
345
- " <td>500</td>\n",
346
- " <td>0.444300</td>\n",
347
- " </tr>\n",
348
- " <tr>\n",
349
- " <td>1000</td>\n",
350
- " <td>0.400200</td>\n",
351
- " </tr>\n",
352
- " <tr>\n",
353
- " <td>1500</td>\n",
354
- " <td>0.415500</td>\n",
355
- " </tr>\n",
356
- " <tr>\n",
357
- " <td>2000</td>\n",
358
- " <td>0.388900</td>\n",
359
- " </tr>\n",
360
- " <tr>\n",
361
- " <td>2500</td>\n",
362
- " <td>0.379600</td>\n",
363
- " </tr>\n",
364
- " <tr>\n",
365
- " <td>3000</td>\n",
366
- " <td>0.396100</td>\n",
367
- " </tr>\n",
368
- " <tr>\n",
369
- " <td>3500</td>\n",
370
- " <td>0.356700</td>\n",
371
- " </tr>\n",
372
- " <tr>\n",
373
- " <td>4000</td>\n",
374
- " <td>0.388000</td>\n",
375
- " </tr>\n",
376
- " <tr>\n",
377
- " <td>4500</td>\n",
378
- " <td>0.317500</td>\n",
379
- " </tr>\n",
380
- " <tr>\n",
381
- " <td>5000</td>\n",
382
- " <td>0.364600</td>\n",
383
- " </tr>\n",
384
- " <tr>\n",
385
- " <td>5500</td>\n",
386
- " <td>0.353900</td>\n",
387
- " </tr>\n",
388
- " <tr>\n",
389
- " <td>6000</td>\n",
390
- " <td>0.349500</td>\n",
391
- " </tr>\n",
392
- " <tr>\n",
393
- " <td>6500</td>\n",
394
- " <td>0.299400</td>\n",
395
- " </tr>\n",
396
- " <tr>\n",
397
- " <td>7000</td>\n",
398
- " <td>0.237400</td>\n",
399
- " </tr>\n",
400
- " <tr>\n",
401
- " <td>7500</td>\n",
402
- " <td>0.223600</td>\n",
403
- " </tr>\n",
404
- " <tr>\n",
405
- " <td>8000</td>\n",
406
- " <td>0.206500</td>\n",
407
- " </tr>\n",
408
- " <tr>\n",
409
- " <td>8500</td>\n",
410
- " <td>0.268500</td>\n",
411
- " </tr>\n",
412
- " <tr>\n",
413
- " <td>9000</td>\n",
414
- " <td>0.192800</td>\n",
415
- " </tr>\n",
416
- " <tr>\n",
417
- " <td>9500</td>\n",
418
- " <td>0.235800</td>\n",
419
- " </tr>\n",
420
- " <tr>\n",
421
- " <td>10000</td>\n",
422
- " <td>0.237400</td>\n",
423
- " </tr>\n",
424
- " <tr>\n",
425
- " <td>10500</td>\n",
426
- " <td>0.197800</td>\n",
427
- " </tr>\n",
428
- " <tr>\n",
429
- " <td>11000</td>\n",
430
- " <td>0.251500</td>\n",
431
- " </tr>\n",
432
- " <tr>\n",
433
- " <td>11500</td>\n",
434
- " <td>0.217100</td>\n",
435
- " </tr>\n",
436
- " <tr>\n",
437
- " <td>12000</td>\n",
438
- " <td>0.201600</td>\n",
439
- " </tr>\n",
440
- " <tr>\n",
441
- " <td>12500</td>\n",
442
- " <td>0.223200</td>\n",
443
- " </tr>\n",
444
- " <tr>\n",
445
- " <td>13000</td>\n",
446
- " <td>0.095300</td>\n",
447
- " </tr>\n",
448
- " <tr>\n",
449
- " <td>13500</td>\n",
450
- " <td>0.116100</td>\n",
451
- " </tr>\n",
452
- " <tr>\n",
453
- " <td>14000</td>\n",
454
- " <td>0.101100</td>\n",
455
- " </tr>\n",
456
- " <tr>\n",
457
- " <td>14500</td>\n",
458
- " <td>0.092600</td>\n",
459
- " </tr>\n",
460
- " <tr>\n",
461
- " <td>15000</td>\n",
462
- " <td>0.118600</td>\n",
463
- " </tr>\n",
464
- " <tr>\n",
465
- " <td>15500</td>\n",
466
- " <td>0.114800</td>\n",
467
- " </tr>\n",
468
- " <tr>\n",
469
- " <td>16000</td>\n",
470
- " <td>0.096000</td>\n",
471
- " </tr>\n",
472
- " <tr>\n",
473
- " <td>16500</td>\n",
474
- " <td>0.105600</td>\n",
475
- " </tr>\n",
476
- " <tr>\n",
477
- " <td>17000</td>\n",
478
- " <td>0.088300</td>\n",
479
- " </tr>\n",
480
- " <tr>\n",
481
- " <td>17500</td>\n",
482
- " <td>0.136200</td>\n",
483
- " </tr>\n",
484
- " <tr>\n",
485
- " <td>18000</td>\n",
486
- " <td>0.111900</td>\n",
487
- " </tr>\n",
488
- " <tr>\n",
489
- " <td>18500</td>\n",
490
- " <td>0.135800</td>\n",
491
- " </tr>\n",
492
- " <tr>\n",
493
- " <td>19000</td>\n",
494
- " <td>0.081800</td>\n",
495
- " </tr>\n",
496
- " <tr>\n",
497
- " <td>19500</td>\n",
498
- " <td>0.041100</td>\n",
499
- " </tr>\n",
500
- " <tr>\n",
501
- " <td>20000</td>\n",
502
- " <td>0.058100</td>\n",
503
- " </tr>\n",
504
- " <tr>\n",
505
- " <td>20500</td>\n",
506
- " <td>0.043600</td>\n",
507
- " </tr>\n",
508
- " <tr>\n",
509
- " <td>21000</td>\n",
510
- " <td>0.051800</td>\n",
511
- " </tr>\n",
512
- " <tr>\n",
513
- " <td>21500</td>\n",
514
- " <td>0.019900</td>\n",
515
- " </tr>\n",
516
- " <tr>\n",
517
- " <td>22000</td>\n",
518
- " <td>0.064000</td>\n",
519
- " </tr>\n",
520
- " <tr>\n",
521
- " <td>22500</td>\n",
522
- " <td>0.041500</td>\n",
523
- " </tr>\n",
524
- " <tr>\n",
525
- " <td>23000</td>\n",
526
- " <td>0.051200</td>\n",
527
- " </tr>\n",
528
- " <tr>\n",
529
- " <td>23500</td>\n",
530
- " <td>0.059900</td>\n",
531
- " </tr>\n",
532
- " <tr>\n",
533
- " <td>24000</td>\n",
534
- " <td>0.044900</td>\n",
535
- " </tr>\n",
536
- " <tr>\n",
537
- " <td>24500</td>\n",
538
- " <td>0.043300</td>\n",
539
- " </tr>\n",
540
- " <tr>\n",
541
- " <td>25000</td>\n",
542
- " <td>0.038700</td>\n",
543
- " </tr>\n",
544
- " <tr>\n",
545
- " <td>25500</td>\n",
546
- " <td>0.016400</td>\n",
547
- " </tr>\n",
548
- " <tr>\n",
549
- " <td>26000</td>\n",
550
- " <td>0.016100</td>\n",
551
- " </tr>\n",
552
- " <tr>\n",
553
- " <td>26500</td>\n",
554
- " <td>0.017300</td>\n",
555
- " </tr>\n",
556
- " <tr>\n",
557
- " <td>27000</td>\n",
558
- " <td>0.035000</td>\n",
559
- " </tr>\n",
560
- " <tr>\n",
561
- " <td>27500</td>\n",
562
- " <td>0.017800</td>\n",
563
- " </tr>\n",
564
- " <tr>\n",
565
- " <td>28000</td>\n",
566
- " <td>0.025900</td>\n",
567
- " </tr>\n",
568
- " <tr>\n",
569
- " <td>28500</td>\n",
570
- " <td>0.023900</td>\n",
571
- " </tr>\n",
572
- " <tr>\n",
573
- " <td>29000</td>\n",
574
- " <td>0.008400</td>\n",
575
- " </tr>\n",
576
- " <tr>\n",
577
- " <td>29500</td>\n",
578
- " <td>0.034100</td>\n",
579
- " </tr>\n",
580
- " <tr>\n",
581
- " <td>30000</td>\n",
582
- " <td>0.009600</td>\n",
583
- " </tr>\n",
584
- " <tr>\n",
585
- " <td>30500</td>\n",
586
- " <td>0.007300</td>\n",
587
- " </tr>\n",
588
- " <tr>\n",
589
- " <td>31000</td>\n",
590
- " <td>0.009600</td>\n",
591
- " </tr>\n",
592
- " </tbody>\n",
593
- "</table><p>"
594
- ],
595
- "text/plain": [
596
- "<IPython.core.display.HTML object>"
597
- ]
598
- },
599
- "metadata": {},
600
- "output_type": "display_data"
601
- },
602
- {
603
- "name": "stderr",
604
- "output_type": "stream",
605
- "text": [
606
- "Saving model checkpoint to ./results/checkpoint-500\n",
607
- "Configuration saved in ./results/checkpoint-500/config.json\n",
608
- "Model weights saved in ./results/checkpoint-500/pytorch_model.bin\n",
609
- "tokenizer config file saved in ./results/checkpoint-500/tokenizer_config.json\n",
610
- "Special tokens file saved in ./results/checkpoint-500/special_tokens_map.json\n",
611
- "Saving model checkpoint to ./results/checkpoint-1000\n",
612
- "Configuration saved in ./results/checkpoint-1000/config.json\n",
613
- "Model weights saved in ./results/checkpoint-1000/pytorch_model.bin\n",
614
- "tokenizer config file saved in ./results/checkpoint-1000/tokenizer_config.json\n",
615
- "Special tokens file saved in ./results/checkpoint-1000/special_tokens_map.json\n",
616
- "Saving model checkpoint to ./results/checkpoint-1500\n",
617
- "Configuration saved in ./results/checkpoint-1500/config.json\n",
618
- "Model weights saved in ./results/checkpoint-1500/pytorch_model.bin\n",
619
- "tokenizer config file saved in ./results/checkpoint-1500/tokenizer_config.json\n",
620
- "Special tokens file saved in ./results/checkpoint-1500/special_tokens_map.json\n",
621
- "Saving model checkpoint to ./results/checkpoint-2000\n",
622
- "Configuration saved in ./results/checkpoint-2000/config.json\n",
623
- "Model weights saved in ./results/checkpoint-2000/pytorch_model.bin\n",
624
- "tokenizer config file saved in ./results/checkpoint-2000/tokenizer_config.json\n",
625
- "Special tokens file saved in ./results/checkpoint-2000/special_tokens_map.json\n",
626
- "Saving model checkpoint to ./results/checkpoint-2500\n",
627
- "Configuration saved in ./results/checkpoint-2500/config.json\n",
628
- "Model weights saved in ./results/checkpoint-2500/pytorch_model.bin\n",
629
- "tokenizer config file saved in ./results/checkpoint-2500/tokenizer_config.json\n",
630
- "Special tokens file saved in ./results/checkpoint-2500/special_tokens_map.json\n",
631
- "Saving model checkpoint to ./results/checkpoint-3000\n",
632
- "Configuration saved in ./results/checkpoint-3000/config.json\n",
633
- "Model weights saved in ./results/checkpoint-3000/pytorch_model.bin\n",
634
- "tokenizer config file saved in ./results/checkpoint-3000/tokenizer_config.json\n",
635
- "Special tokens file saved in ./results/checkpoint-3000/special_tokens_map.json\n",
636
- "Saving model checkpoint to ./results/checkpoint-3500\n",
637
- "Configuration saved in ./results/checkpoint-3500/config.json\n",
638
- "Model weights saved in ./results/checkpoint-3500/pytorch_model.bin\n",
639
- "tokenizer config file saved in ./results/checkpoint-3500/tokenizer_config.json\n",
640
- "Special tokens file saved in ./results/checkpoint-3500/special_tokens_map.json\n",
641
- "Saving model checkpoint to ./results/checkpoint-4000\n",
642
- "Configuration saved in ./results/checkpoint-4000/config.json\n",
643
- "Model weights saved in ./results/checkpoint-4000/pytorch_model.bin\n",
644
- "tokenizer config file saved in ./results/checkpoint-4000/tokenizer_config.json\n",
645
- "Special tokens file saved in ./results/checkpoint-4000/special_tokens_map.json\n",
646
- "Saving model checkpoint to ./results/checkpoint-4500\n",
647
- "Configuration saved in ./results/checkpoint-4500/config.json\n",
648
- "Model weights saved in ./results/checkpoint-4500/pytorch_model.bin\n",
649
- "tokenizer config file saved in ./results/checkpoint-4500/tokenizer_config.json\n",
650
- "Special tokens file saved in ./results/checkpoint-4500/special_tokens_map.json\n",
651
- "Saving model checkpoint to ./results/checkpoint-5000\n",
652
- "Configuration saved in ./results/checkpoint-5000/config.json\n",
653
- "Model weights saved in ./results/checkpoint-5000/pytorch_model.bin\n",
654
- "tokenizer config file saved in ./results/checkpoint-5000/tokenizer_config.json\n",
655
- "Special tokens file saved in ./results/checkpoint-5000/special_tokens_map.json\n",
656
- "Saving model checkpoint to ./results/checkpoint-5500\n",
657
- "Configuration saved in ./results/checkpoint-5500/config.json\n",
658
- "Model weights saved in ./results/checkpoint-5500/pytorch_model.bin\n",
659
- "tokenizer config file saved in ./results/checkpoint-5500/tokenizer_config.json\n",
660
- "Special tokens file saved in ./results/checkpoint-5500/special_tokens_map.json\n",
661
- "Saving model checkpoint to ./results/checkpoint-6000\n",
662
- "Configuration saved in ./results/checkpoint-6000/config.json\n",
663
- "Model weights saved in ./results/checkpoint-6000/pytorch_model.bin\n",
664
- "tokenizer config file saved in ./results/checkpoint-6000/tokenizer_config.json\n",
665
- "Special tokens file saved in ./results/checkpoint-6000/special_tokens_map.json\n",
666
- "Saving model checkpoint to ./results/checkpoint-6500\n",
667
- "Configuration saved in ./results/checkpoint-6500/config.json\n",
668
- "Model weights saved in ./results/checkpoint-6500/pytorch_model.bin\n",
669
- "tokenizer config file saved in ./results/checkpoint-6500/tokenizer_config.json\n",
670
- "Special tokens file saved in ./results/checkpoint-6500/special_tokens_map.json\n",
671
- "Saving model checkpoint to ./results/checkpoint-7000\n",
672
- "Configuration saved in ./results/checkpoint-7000/config.json\n",
673
- "Model weights saved in ./results/checkpoint-7000/pytorch_model.bin\n",
674
- "tokenizer config file saved in ./results/checkpoint-7000/tokenizer_config.json\n",
675
- "Special tokens file saved in ./results/checkpoint-7000/special_tokens_map.json\n",
676
- "Saving model checkpoint to ./results/checkpoint-7500\n",
677
- "Configuration saved in ./results/checkpoint-7500/config.json\n",
678
- "Model weights saved in ./results/checkpoint-7500/pytorch_model.bin\n",
679
- "tokenizer config file saved in ./results/checkpoint-7500/tokenizer_config.json\n",
680
- "Special tokens file saved in ./results/checkpoint-7500/special_tokens_map.json\n",
681
- "Saving model checkpoint to ./results/checkpoint-8000\n",
682
- "Configuration saved in ./results/checkpoint-8000/config.json\n",
683
- "Model weights saved in ./results/checkpoint-8000/pytorch_model.bin\n",
684
- "tokenizer config file saved in ./results/checkpoint-8000/tokenizer_config.json\n",
685
- "Special tokens file saved in ./results/checkpoint-8000/special_tokens_map.json\n",
686
- "Saving model checkpoint to ./results/checkpoint-8500\n",
687
- "Configuration saved in ./results/checkpoint-8500/config.json\n",
688
- "Model weights saved in ./results/checkpoint-8500/pytorch_model.bin\n",
689
- "tokenizer config file saved in ./results/checkpoint-8500/tokenizer_config.json\n",
690
- "Special tokens file saved in ./results/checkpoint-8500/special_tokens_map.json\n",
691
- "Saving model checkpoint to ./results/checkpoint-9000\n",
692
- "Configuration saved in ./results/checkpoint-9000/config.json\n",
693
- "Model weights saved in ./results/checkpoint-9000/pytorch_model.bin\n",
694
- "tokenizer config file saved in ./results/checkpoint-9000/tokenizer_config.json\n",
695
- "Special tokens file saved in ./results/checkpoint-9000/special_tokens_map.json\n",
696
- "Saving model checkpoint to ./results/checkpoint-9500\n",
697
- "Configuration saved in ./results/checkpoint-9500/config.json\n",
698
- "Model weights saved in ./results/checkpoint-9500/pytorch_model.bin\n",
699
- "tokenizer config file saved in ./results/checkpoint-9500/tokenizer_config.json\n",
700
- "Special tokens file saved in ./results/checkpoint-9500/special_tokens_map.json\n",
701
- "Saving model checkpoint to ./results/checkpoint-10000\n",
702
- "Configuration saved in ./results/checkpoint-10000/config.json\n",
703
- "Model weights saved in ./results/checkpoint-10000/pytorch_model.bin\n",
704
- "tokenizer config file saved in ./results/checkpoint-10000/tokenizer_config.json\n",
705
- "Special tokens file saved in ./results/checkpoint-10000/special_tokens_map.json\n",
706
- "Saving model checkpoint to ./results/checkpoint-10500\n",
707
- "Configuration saved in ./results/checkpoint-10500/config.json\n",
708
- "Model weights saved in ./results/checkpoint-10500/pytorch_model.bin\n",
709
- "tokenizer config file saved in ./results/checkpoint-10500/tokenizer_config.json\n",
710
- "Special tokens file saved in ./results/checkpoint-10500/special_tokens_map.json\n",
711
- "Saving model checkpoint to ./results/checkpoint-11000\n",
712
- "Configuration saved in ./results/checkpoint-11000/config.json\n",
713
- "Model weights saved in ./results/checkpoint-11000/pytorch_model.bin\n",
714
- "tokenizer config file saved in ./results/checkpoint-11000/tokenizer_config.json\n",
715
- "Special tokens file saved in ./results/checkpoint-11000/special_tokens_map.json\n",
716
- "Saving model checkpoint to ./results/checkpoint-11500\n",
717
- "Configuration saved in ./results/checkpoint-11500/config.json\n",
718
- "Model weights saved in ./results/checkpoint-11500/pytorch_model.bin\n",
719
- "tokenizer config file saved in ./results/checkpoint-11500/tokenizer_config.json\n",
720
- "Special tokens file saved in ./results/checkpoint-11500/special_tokens_map.json\n",
721
- "Saving model checkpoint to ./results/checkpoint-12000\n",
722
- "Configuration saved in ./results/checkpoint-12000/config.json\n",
723
- "Model weights saved in ./results/checkpoint-12000/pytorch_model.bin\n",
724
- "tokenizer config file saved in ./results/checkpoint-12000/tokenizer_config.json\n",
725
- "Special tokens file saved in ./results/checkpoint-12000/special_tokens_map.json\n",
726
- "Saving model checkpoint to ./results/checkpoint-12500\n"
727
- ]
728
- },
729
- {
730
- "name": "stderr",
731
- "output_type": "stream",
732
- "text": [
733
- "Configuration saved in ./results/checkpoint-12500/config.json\n",
734
- "Model weights saved in ./results/checkpoint-12500/pytorch_model.bin\n",
735
- "tokenizer config file saved in ./results/checkpoint-12500/tokenizer_config.json\n",
736
- "Special tokens file saved in ./results/checkpoint-12500/special_tokens_map.json\n",
737
- "Saving model checkpoint to ./results/checkpoint-13000\n",
738
- "Configuration saved in ./results/checkpoint-13000/config.json\n",
739
- "Model weights saved in ./results/checkpoint-13000/pytorch_model.bin\n",
740
- "tokenizer config file saved in ./results/checkpoint-13000/tokenizer_config.json\n",
741
- "Special tokens file saved in ./results/checkpoint-13000/special_tokens_map.json\n",
742
- "Saving model checkpoint to ./results/checkpoint-13500\n",
743
- "Configuration saved in ./results/checkpoint-13500/config.json\n",
744
- "Model weights saved in ./results/checkpoint-13500/pytorch_model.bin\n",
745
- "tokenizer config file saved in ./results/checkpoint-13500/tokenizer_config.json\n",
746
- "Special tokens file saved in ./results/checkpoint-13500/special_tokens_map.json\n",
747
- "Saving model checkpoint to ./results/checkpoint-14000\n",
748
- "Configuration saved in ./results/checkpoint-14000/config.json\n",
749
- "Model weights saved in ./results/checkpoint-14000/pytorch_model.bin\n",
750
- "tokenizer config file saved in ./results/checkpoint-14000/tokenizer_config.json\n",
751
- "Special tokens file saved in ./results/checkpoint-14000/special_tokens_map.json\n",
752
- "Saving model checkpoint to ./results/checkpoint-14500\n",
753
- "Configuration saved in ./results/checkpoint-14500/config.json\n",
754
- "Model weights saved in ./results/checkpoint-14500/pytorch_model.bin\n",
755
- "tokenizer config file saved in ./results/checkpoint-14500/tokenizer_config.json\n",
756
- "Special tokens file saved in ./results/checkpoint-14500/special_tokens_map.json\n",
757
- "Saving model checkpoint to ./results/checkpoint-15000\n",
758
- "Configuration saved in ./results/checkpoint-15000/config.json\n",
759
- "Model weights saved in ./results/checkpoint-15000/pytorch_model.bin\n",
760
- "tokenizer config file saved in ./results/checkpoint-15000/tokenizer_config.json\n",
761
- "Special tokens file saved in ./results/checkpoint-15000/special_tokens_map.json\n",
762
- "Saving model checkpoint to ./results/checkpoint-15500\n",
763
- "Configuration saved in ./results/checkpoint-15500/config.json\n",
764
- "Model weights saved in ./results/checkpoint-15500/pytorch_model.bin\n",
765
- "tokenizer config file saved in ./results/checkpoint-15500/tokenizer_config.json\n",
766
- "Special tokens file saved in ./results/checkpoint-15500/special_tokens_map.json\n",
767
- "Saving model checkpoint to ./results/checkpoint-16000\n",
768
- "Configuration saved in ./results/checkpoint-16000/config.json\n",
769
- "Model weights saved in ./results/checkpoint-16000/pytorch_model.bin\n",
770
- "tokenizer config file saved in ./results/checkpoint-16000/tokenizer_config.json\n",
771
- "Special tokens file saved in ./results/checkpoint-16000/special_tokens_map.json\n",
772
- "Saving model checkpoint to ./results/checkpoint-16500\n",
773
- "Configuration saved in ./results/checkpoint-16500/config.json\n",
774
- "Model weights saved in ./results/checkpoint-16500/pytorch_model.bin\n",
775
- "tokenizer config file saved in ./results/checkpoint-16500/tokenizer_config.json\n",
776
- "Special tokens file saved in ./results/checkpoint-16500/special_tokens_map.json\n",
777
- "Saving model checkpoint to ./results/checkpoint-17000\n",
778
- "Configuration saved in ./results/checkpoint-17000/config.json\n",
779
- "Model weights saved in ./results/checkpoint-17000/pytorch_model.bin\n",
780
- "tokenizer config file saved in ./results/checkpoint-17000/tokenizer_config.json\n",
781
- "Special tokens file saved in ./results/checkpoint-17000/special_tokens_map.json\n",
782
- "Saving model checkpoint to ./results/checkpoint-17500\n",
783
- "Configuration saved in ./results/checkpoint-17500/config.json\n",
784
- "Model weights saved in ./results/checkpoint-17500/pytorch_model.bin\n",
785
- "tokenizer config file saved in ./results/checkpoint-17500/tokenizer_config.json\n",
786
- "Special tokens file saved in ./results/checkpoint-17500/special_tokens_map.json\n",
787
- "Saving model checkpoint to ./results/checkpoint-18000\n",
788
- "Configuration saved in ./results/checkpoint-18000/config.json\n",
789
- "Model weights saved in ./results/checkpoint-18000/pytorch_model.bin\n",
790
- "tokenizer config file saved in ./results/checkpoint-18000/tokenizer_config.json\n",
791
- "Special tokens file saved in ./results/checkpoint-18000/special_tokens_map.json\n",
792
- "Saving model checkpoint to ./results/checkpoint-18500\n",
793
- "Configuration saved in ./results/checkpoint-18500/config.json\n",
794
- "Model weights saved in ./results/checkpoint-18500/pytorch_model.bin\n",
795
- "tokenizer config file saved in ./results/checkpoint-18500/tokenizer_config.json\n",
796
- "Special tokens file saved in ./results/checkpoint-18500/special_tokens_map.json\n",
797
- "Saving model checkpoint to ./results/checkpoint-19000\n",
798
- "Configuration saved in ./results/checkpoint-19000/config.json\n",
799
- "Model weights saved in ./results/checkpoint-19000/pytorch_model.bin\n",
800
- "tokenizer config file saved in ./results/checkpoint-19000/tokenizer_config.json\n",
801
- "Special tokens file saved in ./results/checkpoint-19000/special_tokens_map.json\n",
802
- "Saving model checkpoint to ./results/checkpoint-19500\n",
803
- "Configuration saved in ./results/checkpoint-19500/config.json\n",
804
- "Model weights saved in ./results/checkpoint-19500/pytorch_model.bin\n",
805
- "tokenizer config file saved in ./results/checkpoint-19500/tokenizer_config.json\n",
806
- "Special tokens file saved in ./results/checkpoint-19500/special_tokens_map.json\n",
807
- "Saving model checkpoint to ./results/checkpoint-20000\n",
808
- "Configuration saved in ./results/checkpoint-20000/config.json\n",
809
- "Model weights saved in ./results/checkpoint-20000/pytorch_model.bin\n",
810
- "tokenizer config file saved in ./results/checkpoint-20000/tokenizer_config.json\n",
811
- "Special tokens file saved in ./results/checkpoint-20000/special_tokens_map.json\n",
812
- "Saving model checkpoint to ./results/checkpoint-20500\n",
813
- "Configuration saved in ./results/checkpoint-20500/config.json\n",
814
- "Model weights saved in ./results/checkpoint-20500/pytorch_model.bin\n",
815
- "tokenizer config file saved in ./results/checkpoint-20500/tokenizer_config.json\n",
816
- "Special tokens file saved in ./results/checkpoint-20500/special_tokens_map.json\n",
817
- "Saving model checkpoint to ./results/checkpoint-21000\n",
818
- "Configuration saved in ./results/checkpoint-21000/config.json\n",
819
- "Model weights saved in ./results/checkpoint-21000/pytorch_model.bin\n",
820
- "tokenizer config file saved in ./results/checkpoint-21000/tokenizer_config.json\n",
821
- "Special tokens file saved in ./results/checkpoint-21000/special_tokens_map.json\n",
822
- "Saving model checkpoint to ./results/checkpoint-21500\n",
823
- "Configuration saved in ./results/checkpoint-21500/config.json\n",
824
- "Model weights saved in ./results/checkpoint-21500/pytorch_model.bin\n",
825
- "tokenizer config file saved in ./results/checkpoint-21500/tokenizer_config.json\n",
826
- "Special tokens file saved in ./results/checkpoint-21500/special_tokens_map.json\n",
827
- "Saving model checkpoint to ./results/checkpoint-22000\n",
828
- "Configuration saved in ./results/checkpoint-22000/config.json\n",
829
- "Model weights saved in ./results/checkpoint-22000/pytorch_model.bin\n",
830
- "tokenizer config file saved in ./results/checkpoint-22000/tokenizer_config.json\n",
831
- "Special tokens file saved in ./results/checkpoint-22000/special_tokens_map.json\n",
832
- "Saving model checkpoint to ./results/checkpoint-22500\n",
833
- "Configuration saved in ./results/checkpoint-22500/config.json\n",
834
- "Model weights saved in ./results/checkpoint-22500/pytorch_model.bin\n",
835
- "tokenizer config file saved in ./results/checkpoint-22500/tokenizer_config.json\n",
836
- "Special tokens file saved in ./results/checkpoint-22500/special_tokens_map.json\n",
837
- "Saving model checkpoint to ./results/checkpoint-23000\n",
838
- "Configuration saved in ./results/checkpoint-23000/config.json\n",
839
- "Model weights saved in ./results/checkpoint-23000/pytorch_model.bin\n",
840
- "tokenizer config file saved in ./results/checkpoint-23000/tokenizer_config.json\n",
841
- "Special tokens file saved in ./results/checkpoint-23000/special_tokens_map.json\n",
842
- "Saving model checkpoint to ./results/checkpoint-23500\n",
843
- "Configuration saved in ./results/checkpoint-23500/config.json\n",
844
- "Model weights saved in ./results/checkpoint-23500/pytorch_model.bin\n",
845
- "tokenizer config file saved in ./results/checkpoint-23500/tokenizer_config.json\n",
846
- "Special tokens file saved in ./results/checkpoint-23500/special_tokens_map.json\n",
847
- "Saving model checkpoint to ./results/checkpoint-24000\n",
848
- "Configuration saved in ./results/checkpoint-24000/config.json\n",
849
- "Model weights saved in ./results/checkpoint-24000/pytorch_model.bin\n",
850
- "tokenizer config file saved in ./results/checkpoint-24000/tokenizer_config.json\n",
851
- "Special tokens file saved in ./results/checkpoint-24000/special_tokens_map.json\n"
852
- ]
853
- },
854
- {
855
- "name": "stderr",
856
- "output_type": "stream",
857
- "text": [
858
- "Saving model checkpoint to ./results/checkpoint-24500\n",
859
- "Configuration saved in ./results/checkpoint-24500/config.json\n",
860
- "Model weights saved in ./results/checkpoint-24500/pytorch_model.bin\n",
861
- "tokenizer config file saved in ./results/checkpoint-24500/tokenizer_config.json\n",
862
- "Special tokens file saved in ./results/checkpoint-24500/special_tokens_map.json\n",
863
- "Saving model checkpoint to ./results/checkpoint-25000\n",
864
- "Configuration saved in ./results/checkpoint-25000/config.json\n",
865
- "Model weights saved in ./results/checkpoint-25000/pytorch_model.bin\n",
866
- "tokenizer config file saved in ./results/checkpoint-25000/tokenizer_config.json\n",
867
- "Special tokens file saved in ./results/checkpoint-25000/special_tokens_map.json\n",
868
- "Saving model checkpoint to ./results/checkpoint-25500\n",
869
- "Configuration saved in ./results/checkpoint-25500/config.json\n",
870
- "Model weights saved in ./results/checkpoint-25500/pytorch_model.bin\n",
871
- "tokenizer config file saved in ./results/checkpoint-25500/tokenizer_config.json\n",
872
- "Special tokens file saved in ./results/checkpoint-25500/special_tokens_map.json\n",
873
- "Saving model checkpoint to ./results/checkpoint-26000\n",
874
- "Configuration saved in ./results/checkpoint-26000/config.json\n",
875
- "Model weights saved in ./results/checkpoint-26000/pytorch_model.bin\n",
876
- "tokenizer config file saved in ./results/checkpoint-26000/tokenizer_config.json\n",
877
- "Special tokens file saved in ./results/checkpoint-26000/special_tokens_map.json\n",
878
- "Saving model checkpoint to ./results/checkpoint-26500\n",
879
- "Configuration saved in ./results/checkpoint-26500/config.json\n",
880
- "Model weights saved in ./results/checkpoint-26500/pytorch_model.bin\n",
881
- "tokenizer config file saved in ./results/checkpoint-26500/tokenizer_config.json\n",
882
- "Special tokens file saved in ./results/checkpoint-26500/special_tokens_map.json\n",
883
- "Saving model checkpoint to ./results/checkpoint-27000\n",
884
- "Configuration saved in ./results/checkpoint-27000/config.json\n",
885
- "Model weights saved in ./results/checkpoint-27000/pytorch_model.bin\n",
886
- "tokenizer config file saved in ./results/checkpoint-27000/tokenizer_config.json\n",
887
- "Special tokens file saved in ./results/checkpoint-27000/special_tokens_map.json\n",
888
- "Saving model checkpoint to ./results/checkpoint-27500\n",
889
- "Configuration saved in ./results/checkpoint-27500/config.json\n",
890
- "Model weights saved in ./results/checkpoint-27500/pytorch_model.bin\n",
891
- "tokenizer config file saved in ./results/checkpoint-27500/tokenizer_config.json\n",
892
- "Special tokens file saved in ./results/checkpoint-27500/special_tokens_map.json\n",
893
- "Saving model checkpoint to ./results/checkpoint-28000\n",
894
- "Configuration saved in ./results/checkpoint-28000/config.json\n",
895
- "Model weights saved in ./results/checkpoint-28000/pytorch_model.bin\n",
896
- "tokenizer config file saved in ./results/checkpoint-28000/tokenizer_config.json\n",
897
- "Special tokens file saved in ./results/checkpoint-28000/special_tokens_map.json\n",
898
- "Saving model checkpoint to ./results/checkpoint-28500\n",
899
- "Configuration saved in ./results/checkpoint-28500/config.json\n",
900
- "Model weights saved in ./results/checkpoint-28500/pytorch_model.bin\n",
901
- "tokenizer config file saved in ./results/checkpoint-28500/tokenizer_config.json\n",
902
- "Special tokens file saved in ./results/checkpoint-28500/special_tokens_map.json\n",
903
- "Saving model checkpoint to ./results/checkpoint-29000\n",
904
- "Configuration saved in ./results/checkpoint-29000/config.json\n",
905
- "Model weights saved in ./results/checkpoint-29000/pytorch_model.bin\n",
906
- "tokenizer config file saved in ./results/checkpoint-29000/tokenizer_config.json\n",
907
- "Special tokens file saved in ./results/checkpoint-29000/special_tokens_map.json\n",
908
- "Saving model checkpoint to ./results/checkpoint-29500\n",
909
- "Configuration saved in ./results/checkpoint-29500/config.json\n",
910
- "Model weights saved in ./results/checkpoint-29500/pytorch_model.bin\n",
911
- "tokenizer config file saved in ./results/checkpoint-29500/tokenizer_config.json\n",
912
- "Special tokens file saved in ./results/checkpoint-29500/special_tokens_map.json\n",
913
- "Saving model checkpoint to ./results/checkpoint-30000\n",
914
- "Configuration saved in ./results/checkpoint-30000/config.json\n",
915
- "Model weights saved in ./results/checkpoint-30000/pytorch_model.bin\n",
916
- "tokenizer config file saved in ./results/checkpoint-30000/tokenizer_config.json\n",
917
- "Special tokens file saved in ./results/checkpoint-30000/special_tokens_map.json\n",
918
- "Saving model checkpoint to ./results/checkpoint-30500\n",
919
- "Configuration saved in ./results/checkpoint-30500/config.json\n",
920
- "Model weights saved in ./results/checkpoint-30500/pytorch_model.bin\n",
921
- "tokenizer config file saved in ./results/checkpoint-30500/tokenizer_config.json\n",
922
- "Special tokens file saved in ./results/checkpoint-30500/special_tokens_map.json\n",
923
- "Saving model checkpoint to ./results/checkpoint-31000\n",
924
- "Configuration saved in ./results/checkpoint-31000/config.json\n",
925
- "Model weights saved in ./results/checkpoint-31000/pytorch_model.bin\n",
926
- "tokenizer config file saved in ./results/checkpoint-31000/tokenizer_config.json\n",
927
- "Special tokens file saved in ./results/checkpoint-31000/special_tokens_map.json\n",
928
- "\n",
929
- "\n",
930
- "Training completed. Do not forget to share your model on huggingface.co/models =)\n",
931
- "\n",
932
- "\n"
933
- ]
934
- },
935
- {
936
- "data": {
937
- "text/plain": [
938
- "TrainOutput(global_step=31250, training_loss=0.155623394241333, metrics={'train_runtime': 1685.1863, 'train_samples_per_second': 74.176, 'train_steps_per_second': 18.544, 'total_flos': 1.3845206874696768e+16, 'train_loss': 0.155623394241333, 'epoch': 5.0})"
939
- ]
940
- },
941
- "execution_count": 17,
942
- "metadata": {},
943
- "output_type": "execute_result"
944
- }
945
- ],
946
- "source": [
947
- "training_args = TrainingArguments(\n",
948
- " output_dir=\"./results\",\n",
949
- " learning_rate=2e-5,\n",
950
- " per_device_train_batch_size=4,\n",
951
- " per_device_eval_batch_size=4,\n",
952
- " num_train_epochs=5,\n",
953
- " weight_decay=0.01,\n",
954
- ")\n",
955
- "\n",
956
- "trainer = Trainer(\n",
957
- " model=model,\n",
958
- " args=training_args,\n",
959
- " train_dataset=tokenized_imdb[\"train\"],\n",
960
- " eval_dataset=tokenized_imdb[\"test\"],\n",
961
- " tokenizer=tokenizer,\n",
962
- " data_collator=data_collator,\n",
963
- ")\n",
964
- "\n",
965
- "trainer.train()"
966
- ]
967
- },
968
- {
969
- "cell_type": "code",
970
- "execution_count": 18,
971
- "id": "bdf45691",
972
- "metadata": {},
973
- "outputs": [
974
- {
975
- "data": {
976
- "text/plain": [
977
- "Dataset({\n",
978
- " features: ['text', 'label', 'input_ids', 'attention_mask'],\n",
979
- " num_rows: 25000\n",
980
- "})"
981
- ]
982
- },
983
- "execution_count": 18,
984
- "metadata": {},
985
- "output_type": "execute_result"
986
- }
987
- ],
988
- "source": [
989
- "df = pd.DataFrame()\n",
990
- "tokenized_imdb['test']"
991
- ]
992
- },
993
- {
994
- "cell_type": "code",
995
- "execution_count": null,
996
- "id": "e2409c78",
997
- "metadata": {},
998
- "outputs": [
999
- {
1000
- "name": "stderr",
1001
- "output_type": "stream",
1002
- "text": [
1003
- "The following columns in the test set don't have a corresponding argument in `DistilBertForSequenceClassification.forward` and have been ignored: text. If text are not expected by `DistilBertForSequenceClassification.forward`, you can safely ignore this message.\n",
1004
- "***** Running Prediction *****\n",
1005
- " Num examples = 25000\n",
1006
- " Batch size = 4\n"
1007
- ]
1008
- },
1009
- {
1010
- "data": {
1011
- "text/html": [
1012
- "\n",
1013
- " <div>\n",
1014
- " \n",
1015
- " <progress value='2987' max='6250' style='width:300px; height:20px; vertical-align: middle;'></progress>\n",
1016
- " [2987/6250 00:40 < 00:43, 74.22 it/s]\n",
1017
- " </div>\n",
1018
- " "
1019
- ],
1020
- "text/plain": [
1021
- "<IPython.core.display.HTML object>"
1022
- ]
1023
- },
1024
- "metadata": {},
1025
- "output_type": "display_data"
1026
- }
1027
- ],
1028
- "source": [
1029
- "trainer.predict(tokenized_imdb[\"test\"])"
1030
- ]
1031
- },
1032
- {
1033
- "cell_type": "code",
1034
- "execution_count": null,
1035
- "id": "958d92c2",
1036
- "metadata": {},
1037
- "outputs": [],
1038
- "source": [
1039
- "from transformers import TextClassificationPipeline"
1040
- ]
1041
- },
1042
- {
1043
- "cell_type": "code",
1044
- "execution_count": null,
1045
- "id": "a6eca3fe",
1046
- "metadata": {},
1047
- "outputs": [],
1048
- "source": [
1049
- "import os\n",
1050
- "os.environ['CUDA_LAUNCH_BLOCKING'] = \"1\""
1051
- ]
1052
- },
1053
- {
1054
- "cell_type": "code",
1055
- "execution_count": null,
1056
- "id": "e5179a95",
1057
- "metadata": {},
1058
- "outputs": [],
1059
- "source": [
1060
- "sent = 'I love sci-fi and am willing to put up with a lot. Sci-fi movies/TV are usually underfunded, under-appreciated and misunderstood. I tried to like this, I really did, but it is to good TV sci-fi as Babylon 5 is to Star Trek (the original). Silly prosthetics, cheap cardboard sets, stilted dialogues, CG that doesn\\'t match the background, and painfully one-dimensional characters cannot be overcome with a \\'sci-fi\\' setting. (I\\'m sure there are those of you out there who think Babylon 5 is good sci-fi TV. It\\'s not. It\\'s clichéd and uninspiring.) While US viewers might like emotion and character development, sci-fi is a genre that does not take itself seriously (cf. Star Trek). It may treat important issues, yet not as a serious philosophy. It\\'s really difficult to care about the characters here as they are not simply foolish, just missing a spark of life. Their actions and reactions are wooden and predictable, often painful to watch. The makers of Earth KNOW it\\'s rubbish as they have to always say \"Gene Roddenberry\\'s Earth...\" otherwise people would not continue watching. Roddenberry\\'s ashes must be turning in their orbit as this dull, cheap, poorly edited (watching it without advert breaks really brings this home) trudging Trabant of a show lumbers into space. Spoiler. So, kill off a main character. And then bring him back as another actor. Jeeez! Dallas all over again.'"
1061
- ]
1062
- },
1063
- {
1064
- "cell_type": "code",
1065
- "execution_count": null,
1066
- "id": "c600300b",
1067
- "metadata": {},
1068
- "outputs": [],
1069
- "source": [
1070
- "pipe = TextClassificationPipeline(model=model, tokenizer=tokenizer, return_all_scores=True, device = 0)\n",
1071
- "pipe(sent)\n",
1072
- "# outputs a list of dicts like [[{'label': 'NEGATIVE', 'score': 0.0001223755971295759}, {'label': 'POSITIVE', 'score': 0.9998776316642761}]]\n",
1073
- "# pipe(\"I love this movie!\")"
1074
- ]
1075
- },
1076
- {
1077
- "cell_type": "code",
1078
- "execution_count": null,
1079
- "id": "f36983b0",
1080
- "metadata": {},
1081
- "outputs": [],
1082
- "source": []
1083
- },
1084
- {
1085
- "cell_type": "code",
1086
- "execution_count": null,
1087
- "id": "05f21b21",
1088
- "metadata": {},
1089
- "outputs": [],
1090
- "source": []
1091
- }
1092
- ],
1093
- "metadata": {
1094
- "kernelspec": {
1095
- "display_name": "Python 3 (ipykernel)",
1096
- "language": "python",
1097
- "name": "python3"
1098
- },
1099
- "language_info": {
1100
- "codemirror_mode": {
1101
- "name": "ipython",
1102
- "version": 3
1103
- },
1104
- "file_extension": ".py",
1105
- "mimetype": "text/x-python",
1106
- "name": "python",
1107
- "nbconvert_exporter": "python",
1108
- "pygments_lexer": "ipython3",
1109
- "version": "3.8.10"
1110
- }
1111
- },
1112
- "nbformat": 4,
1113
- "nbformat_minor": 5
1114
- }