Upload folder using huggingface_hub
Browse files- README.md +95 -0
- metadata.json +8 -0
- model.safetensors +3 -0
- optimizer.pt +3 -0
- rng_state.pth +3 -0
- scheduler.pt +3 -0
- trainer_state.json +0 -0
- training_args.bin +3 -0
README.md
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
base_model: google/vit-base-patch16-224
|
4 |
+
tags:
|
5 |
+
- Image Regression
|
6 |
+
datasets:
|
7 |
+
- "tonyassi/revolve-6-17-24"
|
8 |
+
metrics:
|
9 |
+
- accuracy
|
10 |
+
model-index:
|
11 |
+
- name: "tonyassi/revolve-6-17-24-prediction"
|
12 |
+
results: []
|
13 |
+
---
|
14 |
+
|
15 |
+
# tonyassi/revolve-6-17-24-prediction
|
16 |
+
## Image Regression Model
|
17 |
+
|
18 |
+
This model was trained with [Image Regression Model Trainer](https://github.com/TonyAssi/ImageRegression/tree/main). It takes an image as input and outputs a float value.
|
19 |
+
|
20 |
+
```python
|
21 |
+
from ImageRegression import predict
|
22 |
+
predict(repo_id='tonyassi/revolve-6-17-24-prediction',image_path='image.jpg')
|
23 |
+
```
|
24 |
+
|
25 |
+
---
|
26 |
+
|
27 |
+
## Dataset
|
28 |
+
Dataset: tonyassi/revolve-6-17-24\
|
29 |
+
Value Column: 'sales_index'\
|
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: 10\
|
37 |
+
Learning Rate: 0.0001
|
38 |
+
|
39 |
+
---
|
40 |
+
|
41 |
+
## Usage
|
42 |
+
|
43 |
+
### Download
|
44 |
+
```bash
|
45 |
+
git clone https://github.com/TonyAssi/ImageRegression.git
|
46 |
+
cd ImageRegression
|
47 |
+
```
|
48 |
+
|
49 |
+
### Installation
|
50 |
+
```bash
|
51 |
+
pip install -r requirements.txt
|
52 |
+
```
|
53 |
+
|
54 |
+
### Import
|
55 |
+
```python
|
56 |
+
from ImageRegression import train_model, upload_model, predict
|
57 |
+
```
|
58 |
+
|
59 |
+
### Inference (Prediction)
|
60 |
+
- **repo_id** 🤗 repo id of the model
|
61 |
+
- **image_path** path to image
|
62 |
+
```python
|
63 |
+
predict(repo_id='tonyassi/revolve-6-17-24-prediction',
|
64 |
+
image_path='image.jpg')
|
65 |
+
```
|
66 |
+
The first time this function is called it'll download the safetensor model. Subsequent function calls will run faster.
|
67 |
+
|
68 |
+
### Train Model
|
69 |
+
- **dataset_id** 🤗 dataset id
|
70 |
+
- **value_column_name** column name of prediction values in dataset
|
71 |
+
- **test_split** test split of the train/test split
|
72 |
+
- **output_dir** the directory where the checkpoints will be saved
|
73 |
+
- **num_train_epochs** training epochs
|
74 |
+
- **learning_rate** learning rate
|
75 |
+
```python
|
76 |
+
train_model(dataset_id='tonyassi/revolve-6-17-24',
|
77 |
+
value_column_name='sales_index',
|
78 |
+
test_split=0.2,
|
79 |
+
output_dir='./results',
|
80 |
+
num_train_epochs=10,
|
81 |
+
learning_rate=0.0001)
|
82 |
+
|
83 |
+
```
|
84 |
+
The trainer will save the checkpoints in the output_dir location. The model.safetensors are the trained weights you'll use for inference (predicton).
|
85 |
+
|
86 |
+
### Upload Model
|
87 |
+
This function will upload your model to the 🤗 Hub.
|
88 |
+
- **model_id** the name of the model id
|
89 |
+
- **token** go [here](https://huggingface.co/settings/tokens) to create a new 🤗 token
|
90 |
+
- **checkpoint_dir** checkpoint folder that will be uploaded
|
91 |
+
```python
|
92 |
+
upload_model(model_id='tonyassi/revolve-6-17-24-prediction',
|
93 |
+
token='YOUR_HF_TOKEN',
|
94 |
+
checkpoint_dir='./results/checkpoint-940')
|
95 |
+
```
|
metadata.json
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"dataset_id": "tonyassi/revolve-6-17-24",
|
3 |
+
"value_column_name": "sales_index",
|
4 |
+
"test_split": 0.2,
|
5 |
+
"num_train_epochs": 10,
|
6 |
+
"learning_rate": 0.0001,
|
7 |
+
"max_value": 14954
|
8 |
+
}
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2c5a76ab3445a07f9d4f6aa46e67a988bafce9c3a9fccd578831545bd68f9cdd
|
3 |
+
size 345583444
|
optimizer.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:875a54da3ff1224ecf71e153ddbfa892d770cf201fb6bf5fc5510db600dc0444
|
3 |
+
size 686557178
|
rng_state.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:da1db5c227c2000e391e1d225e13a38eda71746be2164bab198c44af9ae0882b
|
3 |
+
size 13990
|
scheduler.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c795f7641ddf11bcb947b666516063a2b7b5ecf7517e24703919e1f96977ecda
|
3 |
+
size 1064
|
trainer_state.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
training_args.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8e6f6c4db76f70b7c87c96d767deafe46bcf5e261de3d701ff35a9b7f8d06529
|
3 |
+
size 5048
|