tonyassi commited on
Commit
70e9a78
1 Parent(s): 1a00c5c

Upload folder using huggingface_hub

Browse files
Files changed (8) hide show
  1. README.md +108 -0
  2. metadata.json +8 -0
  3. model.safetensors +3 -0
  4. optimizer.pt +3 -0
  5. rng_state.pth +3 -0
  6. scheduler.pt +3 -0
  7. trainer_state.json +344 -0
  8. training_args.bin +3 -0
README.md ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: google/vit-base-patch16-224
4
+ tags:
5
+ - Image Regression
6
+ datasets:
7
+ - "tonyassi/tony__assi-ig-ds5"
8
+ metrics:
9
+ - accuracy
10
+ model-index:
11
+ - name: "tony__assi-ig-prediction"
12
+ results: []
13
+ ---
14
+
15
+ # tony__assi-ig-prediction
16
+ ## IG Prediction
17
+
18
+ This model was trained with [IGPrediction](https://github.com/TonyAssi/IGPrediction). It predicts how many likes an image will get.
19
+
20
+ ```python
21
+ from IGPredict import predict_ig
22
+ predict_ig(repo_id='tonyassi/tony__assi-ig-prediction',image_path='image.jpg')
23
+ ```
24
+
25
+ ---
26
+
27
+ ## Dataset
28
+ Dataset: tonyassi/tony__assi-ig-ds5\
29
+ Value Column:\
30
+ Train Test Split: 0.2
31
+
32
+ ---
33
+
34
+ ## Training
35
+ Base Model: [google/vit-base-patch16-224](https://huggingface.co/google/vit-base-patch16-224)\
36
+ Epochs: 20\
37
+ Learning Rate: 0.0001
38
+
39
+ ---
40
+
41
+ ## Usage
42
+
43
+ ### Download
44
+ ```bash
45
+ git clone https://github.com/TonyAssi/IGPrediction.git
46
+ cd IGPrediction
47
+ ```
48
+
49
+ ### Installation
50
+ ```bash
51
+ pip install -r requirements.txt
52
+ ```
53
+
54
+ ### Import
55
+ ```python
56
+ from IGPredict import ig_download, upload_dataset, train_ig_model, upload_ig_model, predict_ig
57
+ ```
58
+
59
+ ### Download Instagram Images
60
+ - **username** Instagram username
61
+ - **num_images** maximum number of images to download
62
+ ```python
63
+ ig_download(username='instagarm_username', num_images=100)
64
+ ```
65
+ Instagram images will be downloaded to *'./images'* folder, each one named like so *"index-likes.jpg"*. E.g. *"3-17.jpg"* is the third image and has 17 likes.
66
+
67
+ ### Upload Dataset
68
+ - **dataset_name** name of dataset to be uploaded
69
+ - **token** go [here](https://huggingface.co/settings/tokens) to create a new 🤗 token
70
+ ```python
71
+ upload_dataset(dataset_name='tonyassi/tony__assi-ig-ds5', token='YOUR_HF_TOKEN')
72
+ ```
73
+ Go to your 🤗 profile to find your uploaded dataset, it should look similar to [tonyassi/tony__assi-ig-ds](https://huggingface.co/datasets/tonyassi/tony__assi-ig-ds).
74
+
75
+
76
+ ### Train Model
77
+ - **dataset_id** 🤗 dataset id
78
+ - **test_split** test split of the train/test split
79
+ - **num_train_epochs** training epochs
80
+ - **learning_rate** learning rate
81
+ ```python
82
+ train_ig_model(dataset_id='tonyassi/tony__assi-ig-ds5',
83
+ test_split=0.2,
84
+ num_train_epochs=20,
85
+ learning_rate=0.0001)
86
+
87
+ ```
88
+ The trainer will save the checkpoints in the 'results' folder. The model.safetensors are the trained weights you'll use for inference (predicton).
89
+
90
+ ### Upload Model
91
+ This function will upload your model to the 🤗 Hub.
92
+ - **model_id** the name of the model id
93
+ - **token** go [here](https://huggingface.co/settings/tokens) to create a new 🤗 token
94
+ - **checkpoint_dir** checkpoint folder that will be uploaded
95
+ ```python
96
+ upload_ig_model(model_id='tony__assi-ig-prediction',
97
+ token='YOUR_HF_TOKEN',
98
+ checkpoint_dir='./results/checkpoint-940')
99
+ ```
100
+
101
+ ### Inference (Prediction)
102
+ - **repo_id** 🤗 repo id of the model
103
+ - **image_path** path to image
104
+ ```python
105
+ predict_ig(repo_id='tonyassi/tony__assi-ig-prediction',
106
+ image_path='image.jpg')
107
+ ```
108
+ The first time this function is called it'll download the safetensor model. Subsequent function calls will run faster.
metadata.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "dataset_id": "tonyassi/tony__assi-ig-ds5",
3
+ "value_column_name": "likes",
4
+ "test_split": 0.2,
5
+ "num_train_epochs": 20,
6
+ "learning_rate": 0.0001,
7
+ "max_value": 106
8
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4636e1e50f250102ea55feb997a3c4546b2cc0e6e5b9dfba805daa70b7943930
3
+ size 345583444
optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:98f28ea68580bb2d79b75424d7f9c685bcbad07a26d694fb34e07d71219d9d01
3
+ size 686557178
rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8098b3ea1099554a17a75b08e08b0801f551831d4783349401defb321e1c1c1d
3
+ size 13990
scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ce9ba9b1a5074d53eac331e90e43eb33ff190d28330a99d48dfa5f8761916744
3
+ size 1064
trainer_state.json ADDED
@@ -0,0 +1,344 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 20.0,
5
+ "eval_steps": 500,
6
+ "global_step": 200,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [
11
+ {
12
+ "epoch": 1.0,
13
+ "grad_norm": 8.472058296203613,
14
+ "learning_rate": 9.5e-05,
15
+ "loss": 0.2548,
16
+ "step": 10
17
+ },
18
+ {
19
+ "epoch": 1.0,
20
+ "eval_loss": 0.20547232031822205,
21
+ "eval_mse": 0.20547235012054443,
22
+ "eval_runtime": 1.3582,
23
+ "eval_samples_per_second": 14.725,
24
+ "eval_steps_per_second": 2.209,
25
+ "step": 10
26
+ },
27
+ {
28
+ "epoch": 2.0,
29
+ "grad_norm": 16.11898422241211,
30
+ "learning_rate": 9e-05,
31
+ "loss": 0.4596,
32
+ "step": 20
33
+ },
34
+ {
35
+ "epoch": 2.0,
36
+ "eval_loss": 0.10995284467935562,
37
+ "eval_mse": 0.10995285212993622,
38
+ "eval_runtime": 0.9281,
39
+ "eval_samples_per_second": 21.551,
40
+ "eval_steps_per_second": 3.233,
41
+ "step": 20
42
+ },
43
+ {
44
+ "epoch": 3.0,
45
+ "grad_norm": 6.556423187255859,
46
+ "learning_rate": 8.5e-05,
47
+ "loss": 0.0866,
48
+ "step": 30
49
+ },
50
+ {
51
+ "epoch": 3.0,
52
+ "eval_loss": 0.12321324646472931,
53
+ "eval_mse": 0.12321324646472931,
54
+ "eval_runtime": 0.8771,
55
+ "eval_samples_per_second": 22.803,
56
+ "eval_steps_per_second": 3.42,
57
+ "step": 30
58
+ },
59
+ {
60
+ "epoch": 4.0,
61
+ "grad_norm": 10.101408958435059,
62
+ "learning_rate": 8e-05,
63
+ "loss": 0.0741,
64
+ "step": 40
65
+ },
66
+ {
67
+ "epoch": 4.0,
68
+ "eval_loss": 0.055902622640132904,
69
+ "eval_mse": 0.05590261146426201,
70
+ "eval_runtime": 0.8907,
71
+ "eval_samples_per_second": 22.455,
72
+ "eval_steps_per_second": 3.368,
73
+ "step": 40
74
+ },
75
+ {
76
+ "epoch": 5.0,
77
+ "grad_norm": 0.8052617311477661,
78
+ "learning_rate": 7.500000000000001e-05,
79
+ "loss": 0.0471,
80
+ "step": 50
81
+ },
82
+ {
83
+ "epoch": 5.0,
84
+ "eval_loss": 0.033162668347358704,
85
+ "eval_mse": 0.033162668347358704,
86
+ "eval_runtime": 0.8798,
87
+ "eval_samples_per_second": 22.732,
88
+ "eval_steps_per_second": 3.41,
89
+ "step": 50
90
+ },
91
+ {
92
+ "epoch": 6.0,
93
+ "grad_norm": 4.320048809051514,
94
+ "learning_rate": 7e-05,
95
+ "loss": 0.0206,
96
+ "step": 60
97
+ },
98
+ {
99
+ "epoch": 6.0,
100
+ "eval_loss": 0.0486394502222538,
101
+ "eval_mse": 0.0486394464969635,
102
+ "eval_runtime": 0.9146,
103
+ "eval_samples_per_second": 21.867,
104
+ "eval_steps_per_second": 3.28,
105
+ "step": 60
106
+ },
107
+ {
108
+ "epoch": 7.0,
109
+ "grad_norm": 4.353482246398926,
110
+ "learning_rate": 6.500000000000001e-05,
111
+ "loss": 0.0136,
112
+ "step": 70
113
+ },
114
+ {
115
+ "epoch": 7.0,
116
+ "eval_loss": 0.03369127959012985,
117
+ "eval_mse": 0.03369127959012985,
118
+ "eval_runtime": 0.9267,
119
+ "eval_samples_per_second": 21.582,
120
+ "eval_steps_per_second": 3.237,
121
+ "step": 70
122
+ },
123
+ {
124
+ "epoch": 8.0,
125
+ "grad_norm": 1.3020066022872925,
126
+ "learning_rate": 6e-05,
127
+ "loss": 0.0065,
128
+ "step": 80
129
+ },
130
+ {
131
+ "epoch": 8.0,
132
+ "eval_loss": 0.03295436501502991,
133
+ "eval_mse": 0.032954368740320206,
134
+ "eval_runtime": 0.8738,
135
+ "eval_samples_per_second": 22.889,
136
+ "eval_steps_per_second": 3.433,
137
+ "step": 80
138
+ },
139
+ {
140
+ "epoch": 9.0,
141
+ "grad_norm": 0.6798593997955322,
142
+ "learning_rate": 5.500000000000001e-05,
143
+ "loss": 0.0054,
144
+ "step": 90
145
+ },
146
+ {
147
+ "epoch": 9.0,
148
+ "eval_loss": 0.03235679119825363,
149
+ "eval_mse": 0.03235679119825363,
150
+ "eval_runtime": 0.911,
151
+ "eval_samples_per_second": 21.953,
152
+ "eval_steps_per_second": 3.293,
153
+ "step": 90
154
+ },
155
+ {
156
+ "epoch": 10.0,
157
+ "grad_norm": 0.5722326040267944,
158
+ "learning_rate": 5e-05,
159
+ "loss": 0.0023,
160
+ "step": 100
161
+ },
162
+ {
163
+ "epoch": 10.0,
164
+ "eval_loss": 0.03351482003927231,
165
+ "eval_mse": 0.03351482003927231,
166
+ "eval_runtime": 0.9079,
167
+ "eval_samples_per_second": 22.029,
168
+ "eval_steps_per_second": 3.304,
169
+ "step": 100
170
+ },
171
+ {
172
+ "epoch": 11.0,
173
+ "grad_norm": 1.5198137760162354,
174
+ "learning_rate": 4.5e-05,
175
+ "loss": 0.0035,
176
+ "step": 110
177
+ },
178
+ {
179
+ "epoch": 11.0,
180
+ "eval_loss": 0.03029645048081875,
181
+ "eval_mse": 0.030296454206109047,
182
+ "eval_runtime": 0.8889,
183
+ "eval_samples_per_second": 22.5,
184
+ "eval_steps_per_second": 3.375,
185
+ "step": 110
186
+ },
187
+ {
188
+ "epoch": 12.0,
189
+ "grad_norm": 2.942338705062866,
190
+ "learning_rate": 4e-05,
191
+ "loss": 0.0029,
192
+ "step": 120
193
+ },
194
+ {
195
+ "epoch": 12.0,
196
+ "eval_loss": 0.03209378570318222,
197
+ "eval_mse": 0.03209378197789192,
198
+ "eval_runtime": 0.9137,
199
+ "eval_samples_per_second": 21.889,
200
+ "eval_steps_per_second": 3.283,
201
+ "step": 120
202
+ },
203
+ {
204
+ "epoch": 13.0,
205
+ "grad_norm": 0.5375175476074219,
206
+ "learning_rate": 3.5e-05,
207
+ "loss": 0.0035,
208
+ "step": 130
209
+ },
210
+ {
211
+ "epoch": 13.0,
212
+ "eval_loss": 0.03165650740265846,
213
+ "eval_mse": 0.03165651112794876,
214
+ "eval_runtime": 0.9157,
215
+ "eval_samples_per_second": 21.84,
216
+ "eval_steps_per_second": 3.276,
217
+ "step": 130
218
+ },
219
+ {
220
+ "epoch": 14.0,
221
+ "grad_norm": 0.43184858560562134,
222
+ "learning_rate": 3e-05,
223
+ "loss": 0.0011,
224
+ "step": 140
225
+ },
226
+ {
227
+ "epoch": 14.0,
228
+ "eval_loss": 0.03108842670917511,
229
+ "eval_mse": 0.03108843043446541,
230
+ "eval_runtime": 0.889,
231
+ "eval_samples_per_second": 22.498,
232
+ "eval_steps_per_second": 3.375,
233
+ "step": 140
234
+ },
235
+ {
236
+ "epoch": 15.0,
237
+ "grad_norm": 0.3797425925731659,
238
+ "learning_rate": 2.5e-05,
239
+ "loss": 0.0007,
240
+ "step": 150
241
+ },
242
+ {
243
+ "epoch": 15.0,
244
+ "eval_loss": 0.029892250895500183,
245
+ "eval_mse": 0.029892250895500183,
246
+ "eval_runtime": 0.9199,
247
+ "eval_samples_per_second": 21.742,
248
+ "eval_steps_per_second": 3.261,
249
+ "step": 150
250
+ },
251
+ {
252
+ "epoch": 16.0,
253
+ "grad_norm": 0.3728632926940918,
254
+ "learning_rate": 2e-05,
255
+ "loss": 0.0004,
256
+ "step": 160
257
+ },
258
+ {
259
+ "epoch": 16.0,
260
+ "eval_loss": 0.029963841661810875,
261
+ "eval_mse": 0.029963845387101173,
262
+ "eval_runtime": 0.9532,
263
+ "eval_samples_per_second": 20.981,
264
+ "eval_steps_per_second": 3.147,
265
+ "step": 160
266
+ },
267
+ {
268
+ "epoch": 17.0,
269
+ "grad_norm": 0.7130188941955566,
270
+ "learning_rate": 1.5e-05,
271
+ "loss": 0.0003,
272
+ "step": 170
273
+ },
274
+ {
275
+ "epoch": 17.0,
276
+ "eval_loss": 0.03030126914381981,
277
+ "eval_mse": 0.03030126728117466,
278
+ "eval_runtime": 0.8824,
279
+ "eval_samples_per_second": 22.665,
280
+ "eval_steps_per_second": 3.4,
281
+ "step": 170
282
+ },
283
+ {
284
+ "epoch": 18.0,
285
+ "grad_norm": 0.05147755146026611,
286
+ "learning_rate": 1e-05,
287
+ "loss": 0.0001,
288
+ "step": 180
289
+ },
290
+ {
291
+ "epoch": 18.0,
292
+ "eval_loss": 0.03000779077410698,
293
+ "eval_mse": 0.03000778891146183,
294
+ "eval_runtime": 0.9309,
295
+ "eval_samples_per_second": 21.484,
296
+ "eval_steps_per_second": 3.223,
297
+ "step": 180
298
+ },
299
+ {
300
+ "epoch": 19.0,
301
+ "grad_norm": 0.17308902740478516,
302
+ "learning_rate": 5e-06,
303
+ "loss": 0.0,
304
+ "step": 190
305
+ },
306
+ {
307
+ "epoch": 19.0,
308
+ "eval_loss": 0.030044889077544212,
309
+ "eval_mse": 0.03004489280283451,
310
+ "eval_runtime": 0.8961,
311
+ "eval_samples_per_second": 22.32,
312
+ "eval_steps_per_second": 3.348,
313
+ "step": 190
314
+ },
315
+ {
316
+ "epoch": 20.0,
317
+ "grad_norm": 0.0706406906247139,
318
+ "learning_rate": 0.0,
319
+ "loss": 0.0,
320
+ "step": 200
321
+ }
322
+ ],
323
+ "logging_steps": 10,
324
+ "max_steps": 200,
325
+ "num_input_tokens_seen": 0,
326
+ "num_train_epochs": 20,
327
+ "save_steps": 10,
328
+ "stateful_callbacks": {
329
+ "TrainerControl": {
330
+ "args": {
331
+ "should_epoch_stop": false,
332
+ "should_evaluate": false,
333
+ "should_log": false,
334
+ "should_save": true,
335
+ "should_training_stop": true
336
+ },
337
+ "attributes": {}
338
+ }
339
+ },
340
+ "total_flos": 0.0,
341
+ "train_batch_size": 8,
342
+ "trial_name": null,
343
+ "trial_params": null
344
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8d5c1796317df1902e01cb29a20c763200e732f6482b5e7f7e47862ce3a0b096
3
+ size 5048