File size: 6,274 Bytes
296f7bb
 
 
78c21db
 
 
201cac9
8e70cc9
78c21db
c023e8a
296f7bb
c023e8a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296f7bb
 
c023e8a
296f7bb
99a8c61
c023e8a
ac67851
c023e8a
 
 
 
 
 
 
 
 
296f7bb
c023e8a
 
 
 
a1d0acd
a96c305
201cac9
296f7bb
201cac9
 
 
 
296f7bb
ac67851
201cac9
ac67851
 
201cac9
 
 
c023e8a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bc1fc91
 
c023e8a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a1d0acd
c023e8a
 
 
 
a1d0acd
c023e8a
 
 
 
 
 
 
 
 
201cac9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
---
language: en
license: apache-2.0
tags:
- text-classfication
- int8
- neural-compressor
- Intel® Neural Compressor
- PostTrainingStatic
datasets:
- sst2
model-index:
- name: distilbert-base-uncased-finetuned-sst-2-english-int8-static
  results:
  - task:
      type: sentiment-classification
      name: Sentiment Classification
    dataset:
      type: sst2
      name: Stanford Sentiment Treebank
    metrics:
    - type: accuracy
      value: 90.37
      name: accuracy
      config: accuracy
      verified: false
---

## Model Details: INT8 DistilBERT base uncased finetuned SST-2

This model is a fine-tuned DistilBERT model for the downstream task of sentiment classification, training on the [SST-2 dataset](https://huggingface.co/datasets/sst2) and quantized to INT8 (post-training static quantization) from the original FP32 model ([distilbert-base-uncased-finetuned-sst-2-english](https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english)). 
The same model is provided in two different formats: PyTorch and ONNX. 

| Model Detail | Description |
| ----------- | ----------- | 
| Model Authors - Company | Intel | 
| Date | March 29, 2022 for PyTorch model & February 3, 2023 for ONNX model | 
| Version | 1 | 
| Type | NLP DistilBERT (INT8) - Sentiment Classification (+/-) | 
| Paper or Other Resources | [https://github.com/huggingface/optimum-intel](https://github.com/huggingface/optimum-intel) | 
| License | Apache 2.0 |
| Questions or Comments | [Community Tab](https://huggingface.co/Intel/distilbert-base-uncased-finetuned-sst-2-english-int8-static/discussions) and [Intel Developers Discord](https://discord.gg/rv2Gp55UJQ) |

| Intended Use | Description |
| ----------- | ----------- | 
| Primary intended uses | Inference for sentiment classification (classifying whether a statement is positive or negative) | 
| Primary intended users | Anyone | 
| Out-of-scope uses | This model is already fine-tuned and quantized to INT8. It is not suitable for further fine-tuning in this form. To fine-tune your own model, you can start with [distilbert-base-uncased-finetuned-sst-2-english](https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english). The model should not be used to intentionally create hostile or alienating environments for people. |

#### Load the PyTorch model with Optimum Intel
```python
from optimum.intel.neural_compressor import INCModelForSequenceClassification

model_id = "Intel/distilbert-base-uncased-finetuned-sst-2-english-int8-static"
int8_model = INCModelForSequenceClassification.from_pretrained(model_id)
```

#### Load the ONNX model with Optimum:
```python
from optimum.onnxruntime import ORTModelForSequenceClassification

model_id = "Intel/distilbert-base-uncased-finetuned-sst-2-english-int8-static"
int8_model = ORTModelForSequenceClassification.from_pretrained(model_id)
```

| Factors | Description | 
| ----------- | ----------- | 
| Groups | Movie reviewers from the internet | 
| Instrumentation | Text movie single-sentence reviews taken from 4 authors. More information can be found in the original paper by [Pang and Lee (2005)](https://arxiv.org/abs/cs/0506075) |
| Environment | - |
| Card Prompts | Model deployment on alternate hardware and software can change model performance |

| Metrics | Description | 
| ----------- | ----------- | 
| Model performance measures | Accuracy |
| Decision thresholds | - | 
| Approaches to uncertainty and variability | - | 

|  | PyTorch INT8 | ONNX INT8 | FP32 |
|---|---|---|---|
| **Accuracy (eval-accuracy)** |0.9037|0.9071|0.9106|
| **Model Size (MB)**  |65|89|255|

| Training and Evaluation Data | Description | 
| ----------- | ----------- | 
| Datasets | The dataset can be found here: [datasets/sst2](https://huggingface.co/datasets/sst2). There dataset has a total of 215,154 unique phrases, annotated by 3 human judges. |
| Motivation | Dataset was chosen to showcase the benefits of quantization on an NLP classification task with the [Optimum Intel](https://github.com/huggingface/optimum-intel) and [Intel® Neural Compressor](https://github.com/intel/neural-compressor)  |
| Preprocessing | The calibration dataloader is the train dataloader. The default calibration sampling size 100 isn't divisible exactly by batch size 8, so the real sampling size is 104.| 

| Quantitative Analyses | Description | 
| ----------- | ----------- | 
| Unitary results | The model was only evaluated on accuracy. There is no available comparison between evaluation factors. |
| Intersectional results | There is no available comparison between the intersection of evaluated factors.  |

| Ethical Considerations | Description | 
| ----------- | ----------- | 
| Data | The data that make up the model are movie reviews from authors on the internet. |
| Human life | The model is not intended to inform decisions central to human life or flourishing. It is an aggregated set of movie reviews from the internet. | 
| Mitigations | No additional risk mitigation strategies were considered during model development. |
| Risks and harms | The data are biased toward the particular reviewers' opinions and the judges (labelers) of the data. Significant research has explored bias and fairness issues with language models (see, e.g., [Sheng et al., 2021](https://aclanthology.org/2021.acl-long.330.pdf), and [Bender et al., 2021](https://dl.acm.org/doi/pdf/10.1145/3442188.3445922)). Predictions generated by the model may include disturbing and harmful stereotypes across protected classes; identity characteristics; and sensitive, social, and occupational groups. Beyond this, the extent of the risks involved by using the model remain unknown.|
| Use cases | - | 

| Caveats and Recommendations |
| ----------- | 
| Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. There are no additional caveats or recommendations for this model. |

# BibTeX Entry and Citation Info
```
@misc{distilbert-base-uncased-finetuned-sst-2-english-int8-static
  author    = {Xin He, Yu Wenz},
  title     = {distilbert-base-uncased-finetuned-sst-2-english-int8-static},
  year      = {2022},
  url       = {https://huggingface.co/Intel/distilbert-base-uncased-finetuned-sst-2-english-int8-static},
}
```