Updated README.md
Browse files- README.md +58 -7
- all_results.json +0 -9
- evaluate_results.json +0 -9
README.md
CHANGED
|
@@ -13,7 +13,16 @@ metrics:
|
|
| 13 |
- matthews_correlation
|
| 14 |
model-index:
|
| 15 |
- name: tiny-imdb
|
| 16 |
-
results:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
datasets:
|
| 18 |
- imdb
|
| 19 |
library_name: transformers
|
|
@@ -23,7 +32,7 @@ pipeline_tag: text-classification
|
|
| 23 |
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
| 24 |
should probably proofread and complete it, then remove this comment. -->
|
| 25 |
|
| 26 |
-
# tiny-imdb
|
| 27 |
|
| 28 |
This model is a fine-tuned version of [prajjwal1/bert-tiny](https://huggingface.co/prajjwal1/bert-tiny) on the imdb dataset.
|
| 29 |
It achieves the following results on the evaluation set:
|
|
@@ -33,17 +42,59 @@ It achieves the following results on the evaluation set:
|
|
| 33 |
|
| 34 |
## Model description
|
| 35 |
|
| 36 |
-
|
| 37 |
|
| 38 |
## Intended uses & limitations
|
| 39 |
|
| 40 |
-
|
| 41 |
|
| 42 |
-
|
|
|
|
| 43 |
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
-
## Training procedure
|
| 47 |
|
| 48 |
### Training hyperparameters
|
| 49 |
|
|
|
|
| 13 |
- matthews_correlation
|
| 14 |
model-index:
|
| 15 |
- name: tiny-imdb
|
| 16 |
+
results:
|
| 17 |
+
- task:
|
| 18 |
+
type: text-classification
|
| 19 |
+
metrics:
|
| 20 |
+
- type: accuracy
|
| 21 |
+
value: 0.8944
|
| 22 |
+
name: accuracy
|
| 23 |
+
- type: accuracy
|
| 24 |
+
value: 0.7888
|
| 25 |
+
name: matthews_correlation
|
| 26 |
datasets:
|
| 27 |
- imdb
|
| 28 |
library_name: transformers
|
|
|
|
| 32 |
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
| 33 |
should probably proofread and complete it, then remove this comment. -->
|
| 34 |
|
| 35 |
+
# bert-tiny-imdb
|
| 36 |
|
| 37 |
This model is a fine-tuned version of [prajjwal1/bert-tiny](https://huggingface.co/prajjwal1/bert-tiny) on the imdb dataset.
|
| 38 |
It achieves the following results on the evaluation set:
|
|
|
|
| 42 |
|
| 43 |
## Model description
|
| 44 |
|
| 45 |
+
This is the smallest version of BERT model suggested by Google in this [GitHub Repo](https://github.com/google-research/bert), this model contains 2 transformer layers and an a hidden layer output length of 128, ie __(L=2, H=128)__. There are a total 4.39 million paramteres in the model.
|
| 46 |
|
| 47 |
## Intended uses & limitations
|
| 48 |
|
| 49 |
+
This model should be used for text classification tasks specifically on movie reviews or other such text data. Also you can use this model for other downstream tasks like:
|
| 50 |
|
| 51 |
+
- Sentiment Analysis
|
| 52 |
+
- Named Entity Recognition or Token Classification
|
| 53 |
|
| 54 |
+
This model should not be used for any tasks other than the above mentioned or any language other than English.
|
| 55 |
+
|
| 56 |
+
### How to use the Model
|
| 57 |
+
|
| 58 |
+
__Pytorch Model__
|
| 59 |
+
|
| 60 |
+
```python
|
| 61 |
+
from transformers import pipeline
|
| 62 |
+
|
| 63 |
+
# load pipeline
|
| 64 |
+
tiny_bert = pipeline("text-classification", "arnabdhar/tinybert-imdb")
|
| 65 |
+
|
| 66 |
+
# perform inference
|
| 67 |
+
results = pipeline(input_text, truncation=True, max_length=128)
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
__ONNX Model__
|
| 71 |
+
|
| 72 |
+
```python
|
| 73 |
+
from transformers import AutoTokenizer, pipeline
|
| 74 |
+
from optimum.onnxruntime import ORTModelForSequenceClassification
|
| 75 |
+
|
| 76 |
+
# load tokenizer & model
|
| 77 |
+
model_name = "arnabdhar/tinybert-imdb"
|
| 78 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 79 |
+
onnx_model = ORTModelForSequenceClassification.from_pretrained(model_name)
|
| 80 |
+
|
| 81 |
+
# build pipeline
|
| 82 |
+
tiny_bert_onnx = pipeline(
|
| 83 |
+
task = "text-classification",
|
| 84 |
+
tokenizer = tokenizer,
|
| 85 |
+
model = onnx_model
|
| 86 |
+
)
|
| 87 |
+
|
| 88 |
+
# perform inference
|
| 89 |
+
results = tiny_bert_onnx(input_text, truncation=True, max_length=128)
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
## Training
|
| 93 |
+
|
| 94 |
+
The model was finetuned on Google Colab using the NVIDIA V100 GPU and was trained for 9 epochs, it took around 12 minutes to finish finetuning.
|
| 95 |
+
|
| 96 |
+
This model has been trained on the [imdb](https://huggingface.co/datasets/imdb) dataset which has 25,000 data text data for each training set and testing set, but I have combined both the partitions and then split the dataset in 80:20 ratio and used it for finetuning. This approach gave me a larger dataset to finetune the model.
|
| 97 |
|
|
|
|
| 98 |
|
| 99 |
### Training hyperparameters
|
| 100 |
|
all_results.json
DELETED
|
@@ -1,9 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"epoch": 9.0,
|
| 3 |
-
"eval_accuracy": 0.8944,
|
| 4 |
-
"eval_loss": 0.27750933170318604,
|
| 5 |
-
"eval_matthews_correlation": 0.788794543433118,
|
| 6 |
-
"eval_runtime": 12.4798,
|
| 7 |
-
"eval_samples_per_second": 801.293,
|
| 8 |
-
"eval_steps_per_second": 2.564
|
| 9 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
evaluate_results.json
DELETED
|
@@ -1,9 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"epoch": 9.0,
|
| 3 |
-
"eval_accuracy": 0.8944,
|
| 4 |
-
"eval_loss": 0.27750933170318604,
|
| 5 |
-
"eval_matthews_correlation": 0.788794543433118,
|
| 6 |
-
"eval_runtime": 12.4798,
|
| 7 |
-
"eval_samples_per_second": 801.293,
|
| 8 |
-
"eval_steps_per_second": 2.564
|
| 9 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|