Nicole-M commited on
Commit
70e9b9c
·
verified ·
1 Parent(s): 83bd9ad

VIT-fineTuned

Browse files
README.md ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: VIT
3
+ tags:
4
+ - image-classification
5
+ - breast cancer
6
+ - generated_from_trainer
7
+ metrics:
8
+ - accuracy
9
+ - precision
10
+ - recall
11
+ - f1
12
+ model-index:
13
+ - name: Vit-CBIS
14
+ results: []
15
+ ---
16
+
17
+ <!-- This model card has been generated automatically according to the information the Trainer had access to. You
18
+ should probably proofread and complete it, then remove this comment. -->
19
+
20
+ # Vit-CBIS
21
+
22
+ This model is a fine-tuned version of [VIT](https://huggingface.co/VIT) on the CBIS-DDSM dataset.
23
+ It achieves the following results on the evaluation set:
24
+ - Loss: 0.6894
25
+ - Accuracy: 0.6032
26
+ - Precision: 0.6313
27
+ - Recall: 0.6032
28
+ - F1: 0.6083
29
+
30
+ ## Model description
31
+
32
+ More information needed
33
+
34
+ ## Intended uses & limitations
35
+
36
+ More information needed
37
+
38
+ ## Training and evaluation data
39
+
40
+ More information needed
41
+
42
+ ## Training procedure
43
+
44
+ ### Training hyperparameters
45
+
46
+ The following hyperparameters were used during training:
47
+ - learning_rate: 5e-05
48
+ - train_batch_size: 8
49
+ - eval_batch_size: 8
50
+ - seed: 42
51
+ - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
52
+ - lr_scheduler_type: linear
53
+ - num_epochs: 3
54
+ - mixed_precision_training: Native AMP
55
+
56
+ ### Training results
57
+
58
+ | Training Loss | Epoch | Step | Validation Loss | Accuracy | Precision | Recall | F1 |
59
+ |:-------------:|:-----:|:----:|:---------------:|:--------:|:---------:|:------:|:------:|
60
+ | 0.698 | 1.0 | 165 | 0.7030 | 0.4550 | 0.5327 | 0.4550 | 0.4356 |
61
+ | 0.692 | 2.0 | 330 | 0.6853 | 0.5714 | 0.5532 | 0.5714 | 0.5578 |
62
+ | 0.6999 | 3.0 | 495 | 0.6894 | 0.6032 | 0.6313 | 0.6032 | 0.6083 |
63
+
64
+
65
+ ### Framework versions
66
+
67
+ - Transformers 4.42.4
68
+ - Pytorch 2.3.1+cu121
69
+ - Datasets 2.21.0
70
+ - Tokenizers 0.19.1
all_results.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "epoch": 3.0,
3
+ "total_flos": 3.064033269360968e+17,
4
+ "train_loss": 0.6929814497629802,
5
+ "train_runtime": 561.8993,
6
+ "train_samples_per_second": 7.037,
7
+ "train_steps_per_second": 0.881
8
+ }
config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "google/vit-base-patch16-224-in21k",
3
+ "architectures": [
4
+ "ViTForImageClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.0,
7
+ "encoder_stride": 16,
8
+ "hidden_act": "gelu",
9
+ "hidden_dropout_prob": 0.0,
10
+ "hidden_size": 768,
11
+ "id2label": {
12
+ "0": "Benign",
13
+ "1": "Malignant"
14
+ },
15
+ "image_size": 224,
16
+ "initializer_range": 0.02,
17
+ "intermediate_size": 3072,
18
+ "label2id": {
19
+ "Benign": 0,
20
+ "Malignant": 1
21
+ },
22
+ "layer_norm_eps": 1e-12,
23
+ "model_type": "vit",
24
+ "num_attention_heads": 12,
25
+ "num_channels": 3,
26
+ "num_hidden_layers": 12,
27
+ "patch_size": 16,
28
+ "problem_type": "single_label_classification",
29
+ "qkv_bias": true,
30
+ "torch_dtype": "float32",
31
+ "transformers_version": "4.42.4"
32
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:38f8e156ea107a12ac14ca818c6d9bbf705efb536d87cdf4c1cf31282078ca5f
3
+ size 343223968
preprocessor_config.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_normalize": true,
3
+ "do_rescale": true,
4
+ "do_resize": true,
5
+ "image_mean": [
6
+ 0.5,
7
+ 0.5,
8
+ 0.5
9
+ ],
10
+ "image_processor_type": "ViTImageProcessor",
11
+ "image_std": [
12
+ 0.5,
13
+ 0.5,
14
+ 0.5
15
+ ],
16
+ "resample": 2,
17
+ "rescale_factor": 0.00392156862745098,
18
+ "size": {
19
+ "height": 224,
20
+ "width": 224
21
+ }
22
+ }
train_results.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "epoch": 3.0,
3
+ "total_flos": 3.064033269360968e+17,
4
+ "train_loss": 0.6929814497629802,
5
+ "train_runtime": 561.8993,
6
+ "train_samples_per_second": 7.037,
7
+ "train_steps_per_second": 0.881
8
+ }
trainer_state.json ADDED
@@ -0,0 +1,412 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": 0.5740740740740741,
3
+ "best_model_checkpoint": "./results/Vit-CBIS/checkpoint-330",
4
+ "epoch": 3.0,
5
+ "eval_steps": 500,
6
+ "global_step": 495,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [
11
+ {
12
+ "epoch": 0.06060606060606061,
13
+ "grad_norm": 0.9134721755981445,
14
+ "learning_rate": 2.9393939393939394e-05,
15
+ "loss": 0.6735,
16
+ "step": 10
17
+ },
18
+ {
19
+ "epoch": 0.12121212121212122,
20
+ "grad_norm": 0.41935786604881287,
21
+ "learning_rate": 2.8787878787878788e-05,
22
+ "loss": 0.7149,
23
+ "step": 20
24
+ },
25
+ {
26
+ "epoch": 0.18181818181818182,
27
+ "grad_norm": 2.244313955307007,
28
+ "learning_rate": 2.8181818181818185e-05,
29
+ "loss": 0.6885,
30
+ "step": 30
31
+ },
32
+ {
33
+ "epoch": 0.24242424242424243,
34
+ "grad_norm": 0.9235630035400391,
35
+ "learning_rate": 2.7575757575757578e-05,
36
+ "loss": 0.6889,
37
+ "step": 40
38
+ },
39
+ {
40
+ "epoch": 0.30303030303030304,
41
+ "grad_norm": 0.14859230816364288,
42
+ "learning_rate": 2.696969696969697e-05,
43
+ "loss": 0.697,
44
+ "step": 50
45
+ },
46
+ {
47
+ "epoch": 0.36363636363636365,
48
+ "grad_norm": 1.2009950876235962,
49
+ "learning_rate": 2.6363636363636365e-05,
50
+ "loss": 0.6882,
51
+ "step": 60
52
+ },
53
+ {
54
+ "epoch": 0.42424242424242425,
55
+ "grad_norm": 0.5788372159004211,
56
+ "learning_rate": 2.575757575757576e-05,
57
+ "loss": 0.6862,
58
+ "step": 70
59
+ },
60
+ {
61
+ "epoch": 0.48484848484848486,
62
+ "grad_norm": 0.324853777885437,
63
+ "learning_rate": 2.5151515151515152e-05,
64
+ "loss": 0.6898,
65
+ "step": 80
66
+ },
67
+ {
68
+ "epoch": 0.5454545454545454,
69
+ "grad_norm": 0.8690597414970398,
70
+ "learning_rate": 2.454545454545455e-05,
71
+ "loss": 0.6813,
72
+ "step": 90
73
+ },
74
+ {
75
+ "epoch": 0.6060606060606061,
76
+ "grad_norm": 0.9127840995788574,
77
+ "learning_rate": 2.3939393939393942e-05,
78
+ "loss": 0.7099,
79
+ "step": 100
80
+ },
81
+ {
82
+ "epoch": 0.6666666666666666,
83
+ "grad_norm": 0.8866621851921082,
84
+ "learning_rate": 2.3333333333333336e-05,
85
+ "loss": 0.6999,
86
+ "step": 110
87
+ },
88
+ {
89
+ "epoch": 0.7272727272727273,
90
+ "grad_norm": 0.705461323261261,
91
+ "learning_rate": 2.272727272727273e-05,
92
+ "loss": 0.6943,
93
+ "step": 120
94
+ },
95
+ {
96
+ "epoch": 0.7878787878787878,
97
+ "grad_norm": 1.2404519319534302,
98
+ "learning_rate": 2.212121212121212e-05,
99
+ "loss": 0.6866,
100
+ "step": 130
101
+ },
102
+ {
103
+ "epoch": 0.8484848484848485,
104
+ "grad_norm": 0.7197526693344116,
105
+ "learning_rate": 2.1515151515151513e-05,
106
+ "loss": 0.6921,
107
+ "step": 140
108
+ },
109
+ {
110
+ "epoch": 0.9090909090909091,
111
+ "grad_norm": 0.5975974798202515,
112
+ "learning_rate": 2.090909090909091e-05,
113
+ "loss": 0.6876,
114
+ "step": 150
115
+ },
116
+ {
117
+ "epoch": 0.9696969696969697,
118
+ "grad_norm": 0.814386248588562,
119
+ "learning_rate": 2.0303030303030303e-05,
120
+ "loss": 0.7022,
121
+ "step": 160
122
+ },
123
+ {
124
+ "epoch": 1.0,
125
+ "eval_accuracy": 0.4470899470899471,
126
+ "eval_loss": 0.6970731616020203,
127
+ "eval_runtime": 35.3817,
128
+ "eval_samples_per_second": 10.683,
129
+ "eval_steps_per_second": 1.357,
130
+ "step": 165
131
+ },
132
+ {
133
+ "epoch": 1.0303030303030303,
134
+ "grad_norm": 0.6936383843421936,
135
+ "learning_rate": 1.9696969696969697e-05,
136
+ "loss": 0.6918,
137
+ "step": 170
138
+ },
139
+ {
140
+ "epoch": 1.0909090909090908,
141
+ "grad_norm": 0.5651612281799316,
142
+ "learning_rate": 1.909090909090909e-05,
143
+ "loss": 0.6903,
144
+ "step": 180
145
+ },
146
+ {
147
+ "epoch": 1.1515151515151516,
148
+ "grad_norm": 0.1796492338180542,
149
+ "learning_rate": 1.8484848484848484e-05,
150
+ "loss": 0.7095,
151
+ "step": 190
152
+ },
153
+ {
154
+ "epoch": 1.2121212121212122,
155
+ "grad_norm": 0.6916122436523438,
156
+ "learning_rate": 1.7878787878787877e-05,
157
+ "loss": 0.6983,
158
+ "step": 200
159
+ },
160
+ {
161
+ "epoch": 1.2727272727272727,
162
+ "grad_norm": 1.9430723190307617,
163
+ "learning_rate": 1.7272727272727274e-05,
164
+ "loss": 0.6975,
165
+ "step": 210
166
+ },
167
+ {
168
+ "epoch": 1.3333333333333333,
169
+ "grad_norm": 0.5348889827728271,
170
+ "learning_rate": 1.6666666666666667e-05,
171
+ "loss": 0.6886,
172
+ "step": 220
173
+ },
174
+ {
175
+ "epoch": 1.393939393939394,
176
+ "grad_norm": 0.644706130027771,
177
+ "learning_rate": 1.606060606060606e-05,
178
+ "loss": 0.6841,
179
+ "step": 230
180
+ },
181
+ {
182
+ "epoch": 1.4545454545454546,
183
+ "grad_norm": 2.1170523166656494,
184
+ "learning_rate": 1.5454545454545454e-05,
185
+ "loss": 0.7109,
186
+ "step": 240
187
+ },
188
+ {
189
+ "epoch": 1.5151515151515151,
190
+ "grad_norm": 0.6115465760231018,
191
+ "learning_rate": 1.484848484848485e-05,
192
+ "loss": 0.6882,
193
+ "step": 250
194
+ },
195
+ {
196
+ "epoch": 1.5757575757575757,
197
+ "grad_norm": 0.8241686820983887,
198
+ "learning_rate": 1.4242424242424243e-05,
199
+ "loss": 0.6981,
200
+ "step": 260
201
+ },
202
+ {
203
+ "epoch": 1.6363636363636362,
204
+ "grad_norm": 1.836000680923462,
205
+ "learning_rate": 1.3636363636363637e-05,
206
+ "loss": 0.6897,
207
+ "step": 270
208
+ },
209
+ {
210
+ "epoch": 1.696969696969697,
211
+ "grad_norm": 0.6261163949966431,
212
+ "learning_rate": 1.3030303030303032e-05,
213
+ "loss": 0.6932,
214
+ "step": 280
215
+ },
216
+ {
217
+ "epoch": 1.7575757575757576,
218
+ "grad_norm": 0.7731136679649353,
219
+ "learning_rate": 1.2424242424242425e-05,
220
+ "loss": 0.6859,
221
+ "step": 290
222
+ },
223
+ {
224
+ "epoch": 1.8181818181818183,
225
+ "grad_norm": 0.28496983647346497,
226
+ "learning_rate": 1.1818181818181819e-05,
227
+ "loss": 0.6845,
228
+ "step": 300
229
+ },
230
+ {
231
+ "epoch": 1.878787878787879,
232
+ "grad_norm": 0.30313462018966675,
233
+ "learning_rate": 1.1212121212121212e-05,
234
+ "loss": 0.6861,
235
+ "step": 310
236
+ },
237
+ {
238
+ "epoch": 1.9393939393939394,
239
+ "grad_norm": 0.7996814846992493,
240
+ "learning_rate": 1.0606060606060606e-05,
241
+ "loss": 0.6988,
242
+ "step": 320
243
+ },
244
+ {
245
+ "epoch": 2.0,
246
+ "grad_norm": 1.020075798034668,
247
+ "learning_rate": 9.999999999999999e-06,
248
+ "loss": 0.6895,
249
+ "step": 330
250
+ },
251
+ {
252
+ "epoch": 2.0,
253
+ "eval_accuracy": 0.5740740740740741,
254
+ "eval_loss": 0.6877079606056213,
255
+ "eval_runtime": 35.5495,
256
+ "eval_samples_per_second": 10.633,
257
+ "eval_steps_per_second": 1.35,
258
+ "step": 330
259
+ },
260
+ {
261
+ "epoch": 2.0606060606060606,
262
+ "grad_norm": 0.3215593695640564,
263
+ "learning_rate": 9.393939393939394e-06,
264
+ "loss": 0.7026,
265
+ "step": 340
266
+ },
267
+ {
268
+ "epoch": 2.121212121212121,
269
+ "grad_norm": 0.6477654576301575,
270
+ "learning_rate": 8.787878787878788e-06,
271
+ "loss": 0.6873,
272
+ "step": 350
273
+ },
274
+ {
275
+ "epoch": 2.1818181818181817,
276
+ "grad_norm": 0.27149632573127747,
277
+ "learning_rate": 8.181818181818181e-06,
278
+ "loss": 0.6823,
279
+ "step": 360
280
+ },
281
+ {
282
+ "epoch": 2.242424242424242,
283
+ "grad_norm": 0.7159335017204285,
284
+ "learning_rate": 7.5757575757575764e-06,
285
+ "loss": 0.7014,
286
+ "step": 370
287
+ },
288
+ {
289
+ "epoch": 2.303030303030303,
290
+ "grad_norm": 0.2240850031375885,
291
+ "learning_rate": 6.96969696969697e-06,
292
+ "loss": 0.6903,
293
+ "step": 380
294
+ },
295
+ {
296
+ "epoch": 2.3636363636363638,
297
+ "grad_norm": 1.4085216522216797,
298
+ "learning_rate": 6.363636363636364e-06,
299
+ "loss": 0.7011,
300
+ "step": 390
301
+ },
302
+ {
303
+ "epoch": 2.4242424242424243,
304
+ "grad_norm": 0.6638109087944031,
305
+ "learning_rate": 5.757575757575758e-06,
306
+ "loss": 0.6842,
307
+ "step": 400
308
+ },
309
+ {
310
+ "epoch": 2.484848484848485,
311
+ "grad_norm": 0.7225008606910706,
312
+ "learning_rate": 5.151515151515151e-06,
313
+ "loss": 0.6887,
314
+ "step": 410
315
+ },
316
+ {
317
+ "epoch": 2.5454545454545454,
318
+ "grad_norm": 0.23257039487361908,
319
+ "learning_rate": 4.5454545454545455e-06,
320
+ "loss": 0.6993,
321
+ "step": 420
322
+ },
323
+ {
324
+ "epoch": 2.606060606060606,
325
+ "grad_norm": 0.1906505525112152,
326
+ "learning_rate": 3.93939393939394e-06,
327
+ "loss": 0.6972,
328
+ "step": 430
329
+ },
330
+ {
331
+ "epoch": 2.6666666666666665,
332
+ "grad_norm": 0.487804651260376,
333
+ "learning_rate": 3.3333333333333333e-06,
334
+ "loss": 0.6879,
335
+ "step": 440
336
+ },
337
+ {
338
+ "epoch": 2.7272727272727275,
339
+ "grad_norm": 0.8791880011558533,
340
+ "learning_rate": 2.7272727272727272e-06,
341
+ "loss": 0.6917,
342
+ "step": 450
343
+ },
344
+ {
345
+ "epoch": 2.787878787878788,
346
+ "grad_norm": 0.1857946664094925,
347
+ "learning_rate": 2.121212121212121e-06,
348
+ "loss": 0.6911,
349
+ "step": 460
350
+ },
351
+ {
352
+ "epoch": 2.8484848484848486,
353
+ "grad_norm": 1.3687998056411743,
354
+ "learning_rate": 1.5151515151515152e-06,
355
+ "loss": 0.6889,
356
+ "step": 470
357
+ },
358
+ {
359
+ "epoch": 2.909090909090909,
360
+ "grad_norm": 0.6968662738800049,
361
+ "learning_rate": 9.090909090909091e-07,
362
+ "loss": 0.6969,
363
+ "step": 480
364
+ },
365
+ {
366
+ "epoch": 2.9696969696969697,
367
+ "grad_norm": 0.19741572439670563,
368
+ "learning_rate": 3.0303030303030305e-07,
369
+ "loss": 0.6969,
370
+ "step": 490
371
+ },
372
+ {
373
+ "epoch": 3.0,
374
+ "eval_accuracy": 0.5264550264550265,
375
+ "eval_loss": 0.6918376684188843,
376
+ "eval_runtime": 35.4925,
377
+ "eval_samples_per_second": 10.65,
378
+ "eval_steps_per_second": 1.352,
379
+ "step": 495
380
+ },
381
+ {
382
+ "epoch": 3.0,
383
+ "step": 495,
384
+ "total_flos": 3.064033269360968e+17,
385
+ "train_loss": 0.6929814497629802,
386
+ "train_runtime": 561.8993,
387
+ "train_samples_per_second": 7.037,
388
+ "train_steps_per_second": 0.881
389
+ }
390
+ ],
391
+ "logging_steps": 10,
392
+ "max_steps": 495,
393
+ "num_input_tokens_seen": 0,
394
+ "num_train_epochs": 3,
395
+ "save_steps": 500,
396
+ "stateful_callbacks": {
397
+ "TrainerControl": {
398
+ "args": {
399
+ "should_epoch_stop": false,
400
+ "should_evaluate": false,
401
+ "should_log": false,
402
+ "should_save": true,
403
+ "should_training_stop": true
404
+ },
405
+ "attributes": {}
406
+ }
407
+ },
408
+ "total_flos": 3.064033269360968e+17,
409
+ "train_batch_size": 8,
410
+ "trial_name": null,
411
+ "trial_params": null
412
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4fc3ebc3cd9b86df5e7827888e0132ac392b382147df72a26c162dc391b5da04
3
+ size 5112