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+
- glue
|
7 |
+
model-index:
|
8 |
+
- name: distilbert-base-uncased-finetuned-sst-2-english
|
9 |
+
results:
|
10 |
+
- task:
|
11 |
+
type: text-classification
|
12 |
+
name: Text Classification
|
13 |
+
dataset:
|
14 |
+
name: glue
|
15 |
+
type: glue
|
16 |
+
config: sst2
|
17 |
+
split: validation
|
18 |
+
metrics:
|
19 |
+
- type: accuracy
|
20 |
+
value: 0.9105504587155964
|
21 |
+
name: Accuracy
|
22 |
+
verified: true
|
23 |
+
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiN2YyOGMxYjY2Y2JhMjkxNjIzN2FmMjNiNmM2ZWViNGY3MTNmNWI2YzhiYjYxZTY0ZGUyN2M1NGIxZjRiMjQwZiIsInZlcnNpb24iOjF9.uui0srxV5ZHRhxbYN6082EZdwpnBgubPJ5R2-Wk8HTWqmxYE3QHidevR9LLAhidqGw6Ih93fK0goAXncld_gBg
|
24 |
+
- type: precision
|
25 |
+
value: 0.8978260869565218
|
26 |
+
name: Precision
|
27 |
+
verified: true
|
28 |
+
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiMzgwYTYwYjA2MmM0ZTYwNDk0M2NmNTBkZmM2NGNhYzQ1OGEyN2NkNDQ3Mzc2NTQyMmZiNDJiNzBhNGVhZGUyOSIsInZlcnNpb24iOjF9.eHjLmw3K02OU69R2Au8eyuSqT3aBDHgZCn8jSzE3_urD6EUSSsLxUpiAYR4BGLD_U6-ZKcdxVo_A2rdXqvUJDA
|
29 |
+
- type: recall
|
30 |
+
value: 0.9301801801801802
|
31 |
+
name: Recall
|
32 |
+
verified: true
|
33 |
+
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiMGIzM2E3MTI2Mzc2MDYwNmU3ZTVjYmZmZDBkNjY4ZTc5MGY0Y2FkNDU3NjY1MmVkNmE3Y2QzMzAwZDZhOWY1NiIsInZlcnNpb24iOjF9.PUZlqmct13-rJWBXdHm5tdkXgETL9F82GNbbSR4hI8MB-v39KrK59cqzFC2Ac7kJe_DtOeUyosj34O_mFt_1DQ
|
34 |
+
- type: auc
|
35 |
+
value: 0.9716626673402374
|
36 |
+
name: AUC
|
37 |
+
verified: true
|
38 |
+
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiMDM0YWIwZmQ4YjUwOGZmMWU2MjI1YjIxZGQ2MzNjMzRmZmYxMzZkNGFjODhlMDcyZDM1Y2RkMWZlOWQ0MWYwNSIsInZlcnNpb24iOjF9.E7GRlAXmmpEkTHlXheVkuL1W4WNjv4JO3qY_WCVsTVKiO7bUu0UVjPIyQ6g-J1OxsfqZmW3Leli1wY8vPBNNCQ
|
39 |
+
- type: f1
|
40 |
+
value: 0.9137168141592922
|
41 |
+
name: F1
|
42 |
+
verified: true
|
43 |
+
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiMGU4MjNmOGYwZjZjMDQ1ZTkyZTA4YTc1MWYwOTM0NDM4ZWY1ZGVkNDY5MzNhYTQyZGFlNzIyZmUwMDg3NDU0NyIsInZlcnNpb24iOjF9.mW5ftkq50Se58M-jm6a2Pu93QeKa3MfV7xcBwvG3PSB_KNJxZWTCpfMQp-Cmx_EMlmI2siKOyd8akYjJUrzJCA
|
44 |
+
- type: loss
|
45 |
+
value: 0.39013850688934326
|
46 |
+
name: loss
|
47 |
+
verified: true
|
48 |
+
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiMTZiNzAyZDc0MzUzMmE1MGJiN2JlYzFiODE5ZTNlNGE4MmI4YzRiMTc2ODEzMTUwZmEzOTgxNzc4YjJjZTRmNiIsInZlcnNpb24iOjF9.VqIC7uYC-ZZ8ss9zQOlRV39YVOOLc5R36sIzCcVz8lolh61ux_5djm2XjpP6ARc6KqEnXC4ZtfNXsX2HZfrtCQ
|
49 |
+
- task:
|
50 |
+
type: text-classification
|
51 |
+
name: Text Classification
|
52 |
+
dataset:
|
53 |
+
name: sst2
|
54 |
+
type: sst2
|
55 |
+
config: default
|
56 |
+
split: train
|
57 |
+
metrics:
|
58 |
+
- type: accuracy
|
59 |
+
value: 0.9885521685548412
|
60 |
+
name: Accuracy
|
61 |
+
verified: true
|
62 |
+
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiY2I3NzU3YzhmMDkxZTViY2M3OTY1NmI0ZTdmMDQxNjNjYzJiZmQxNzczM2E4YmExYTY5ODY0NDBkY2I4ZjNkOCIsInZlcnNpb24iOjF9.4Gtk3FeVc9sPWSqZIaeUXJ9oVlPzm-NmujnWpK2y5s1Vhp1l6Y1pK5_78wW0-NxSvQqV6qd5KQf_OAEpVAkQDA
|
63 |
+
- type: precision
|
64 |
+
value: 0.9881965062029833
|
65 |
+
name: Precision Macro
|
66 |
+
verified: true
|
67 |
+
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiZDdlZDMzY2I3MTAwYTljNmM4MGMyMzU2YjAzZDg1NDYwN2ZmM2Y5OWZhMjUyMGJiNjY1YmZiMzFhMDI2ODFhNyIsInZlcnNpb24iOjF9.cqmv6yBxu4St2mykRWrZ07tDsiSLdtLTz2hbqQ7Gm1rMzq9tdlkZ8MyJRxtME_Y8UaOG9rs68pV-gKVUs8wABw
|
68 |
+
- type: precision
|
69 |
+
value: 0.9885521685548412
|
70 |
+
name: Precision Micro
|
71 |
+
verified: true
|
72 |
+
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiZjFlYzAzNmE1YjljNjUwNzBjZjEzZDY0ZDQyMmY5ZWM2OTBhNzNjYjYzYTk1YWE1NjU3YTMxZDQwOTE1Y2FkNyIsInZlcnNpb24iOjF9.jnCHOkUHuAOZZ_ZMVOnetx__OVJCS6LOno4caWECAmfrUaIPnPNV9iJ6izRO3sqkHRmxYpWBb-27GJ4N3LU-BQ
|
73 |
+
- type: precision
|
74 |
+
value: 0.9885639626373408
|
75 |
+
name: Precision Weighted
|
76 |
+
verified: true
|
77 |
+
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiZGUyODFjNjBlNTE2MTY3ZDAxOGU1N2U0YjUyY2NiZjhkOGVmYThjYjBkNGU3NTRkYzkzNDQ2MmMwMjkwMWNiMyIsInZlcnNpb24iOjF9.zTNabMwApiZyXdr76QUn7WgGB7D7lP-iqS3bn35piqVTNsv3wnKjZOaKFVLIUvtBXq4gKw7N2oWxvWc4OcSNDg
|
78 |
+
- type: recall
|
79 |
+
value: 0.9886145346602994
|
80 |
+
name: Recall Macro
|
81 |
+
verified: true
|
82 |
+
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiNTU1YjlhODU3YTkyNTdiZDcwZGFlZDBiYjY0N2NjMGM2NTRiNjQ3MDNjNGMxOWY2ZGQ4NWU1YmMzY2UwZTI3YSIsInZlcnNpb24iOjF9.xaLPY7U-wHsJ3DDui1yyyM-xWjL0Jz5puRThy7fczal9x05eKEQ9s0a_WD-iLmapvJs0caXpV70hDe2NLcs-DA
|
83 |
+
- type: recall
|
84 |
+
value: 0.9885521685548412
|
85 |
+
name: Recall Micro
|
86 |
+
verified: true
|
87 |
+
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiODE0YTU0MDBlOGY4YzU0MjY5MzA3OTk2OGNhOGVkMmU5OGRjZmFiZWI2ZjY5ODEzZTQzMTI0N2NiOTVkNDliYiIsInZlcnNpb24iOjF9.SOt1baTBbuZRrsvGcak2sUwoTrQzmNCbyV2m1_yjGsU48SBH0NcKXicidNBSnJ6ihM5jf_Lv_B5_eOBkLfNWDQ
|
88 |
+
- type: recall
|
89 |
+
value: 0.9885521685548412
|
90 |
+
name: Recall Weighted
|
91 |
+
verified: true
|
92 |
+
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiZWNkNmM0ZGRlNmYxYzIwNDk4OTI5MzIwZWU1NzZjZDVhMDcyNDFlMjBhNDQxODU5OWMwMWNhNGEzNjY3ZGUyOSIsInZlcnNpb24iOjF9.b15Fh70GwtlG3cSqPW-8VEZT2oy0CtgvgEOtWiYonOovjkIQ4RSLFVzVG-YfslaIyfg9RzMWzjhLnMY7Bpn2Aw
|
93 |
+
- type: f1
|
94 |
+
value: 0.9884019815052447
|
95 |
+
name: F1 Macro
|
96 |
+
verified: true
|
97 |
+
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiYmM4NjQ5Yjk5ODRhYTU1MTY3MmRhZDBmODM1NTg3OTFiNWM4NDRmYjI0MzZkNmQ1MzE3MzcxODZlYzBkYTMyYSIsInZlcnNpb24iOjF9.74RaDK8nBVuGRl2Se_-hwQvP6c4lvVxGHpcCWB4uZUCf2_HoC9NT9u7P3pMJfH_tK2cpV7U3VWGgSDhQDi-UBQ
|
98 |
+
- type: f1
|
99 |
+
value: 0.9885521685548412
|
100 |
+
name: F1 Micro
|
101 |
+
verified: true
|
102 |
+
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiZDRmYWRmMmQ0YjViZmQxMzhhYTUyOTE1MTc0ZDU1ZjQyZjFhMDYzYzMzZDE0NzZlYzQyOTBhMTBhNmM5NTlkMiIsInZlcnNpb24iOjF9.VMn_psdAHIZTlW6GbjERZDe8MHhwzJ0rbjV_VJyuMrsdOh5QDmko-wEvaBWNEdT0cEKsbggm-6jd3Gh81PfHAQ
|
103 |
+
- type: f1
|
104 |
+
value: 0.9885546181087554
|
105 |
+
name: F1 Weighted
|
106 |
+
verified: true
|
107 |
+
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiMjUyZWFhZDZhMGQ3MzBmYmRiNDVmN2FkZDBjMjk3ODk0OTAxNGZkMWE0NzU5ZjI0NzE0NGZiNzM0N2Y2NDYyOSIsInZlcnNpb24iOjF9.YsXBhnzEEFEW6jw3mQlFUuIrW7Gabad2Ils-iunYJr-myg0heF8NEnEWABKFE1SnvCWt-69jkLza6SupeyLVCA
|
108 |
+
- type: loss
|
109 |
+
value: 0.040652573108673096
|
110 |
+
name: loss
|
111 |
+
verified: true
|
112 |
+
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiZTc3YjU3MjdjMzkxODA5MjU5NGUyY2NkMGVhZDg3ZWEzMmU1YWVjMmI0NmU2OWEyZTkzMTVjNDZiYTc0YjIyNCIsInZlcnNpb24iOjF9.lA90qXZVYiILHMFlr6t6H81Oe8a-4KmeX-vyCC1BDia2ofudegv6Vb46-4RzmbtuKeV6yy6YNNXxXxqVak1pAg
|
113 |
---
|
114 |
|
115 |
+
# DistilBERT base uncased finetuned SST-2
|
116 |
+
|
117 |
+
## Table of Contents
|
118 |
+
- [Model Details](#model-details)
|
119 |
+
- [How to Get Started With the Model](#how-to-get-started-with-the-model)
|
120 |
+
- [Uses](#uses)
|
121 |
+
- [Risks, Limitations and Biases](#risks-limitations-and-biases)
|
122 |
+
- [Training](#training)
|
123 |
+
|
124 |
+
## Model Details
|
125 |
+
**Model Description:** This model is a fine-tune checkpoint of [DistilBERT-base-uncased](https://huggingface.co/distilbert-base-uncased), fine-tuned on SST-2.
|
126 |
+
This model reaches an accuracy of 91.3 on the dev set (for comparison, Bert bert-base-uncased version reaches an accuracy of 92.7).
|
127 |
+
- **Developed by:** Hugging Face
|
128 |
+
- **Model Type:** Text Classification
|
129 |
+
- **Language(s):** English
|
130 |
+
- **License:** Apache-2.0
|
131 |
+
- **Parent Model:** For more details about DistilBERT, we encourage users to check out [this model card](https://huggingface.co/distilbert-base-uncased).
|
132 |
+
- **Resources for more information:**
|
133 |
+
- [Model Documentation](https://huggingface.co/docs/transformers/main/en/model_doc/distilbert#transformers.DistilBertForSequenceClassification)
|
134 |
+
- [DistilBERT paper](https://arxiv.org/abs/1910.01108)
|
135 |
+
|
136 |
+
## How to Get Started With the Model
|
137 |
+
|
138 |
+
Example of single-label classification:
|
139 |
+
|
140 |
+
```python
|
141 |
+
import torch
|
142 |
+
from transformers import DistilBertTokenizer, DistilBertForSequenceClassification
|
143 |
+
|
144 |
+
tokenizer = DistilBertTokenizer.from_pretrained("distilbert-base-uncased")
|
145 |
+
model = DistilBertForSequenceClassification.from_pretrained("distilbert-base-uncased")
|
146 |
+
|
147 |
+
inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
|
148 |
+
with torch.no_grad():
|
149 |
+
logits = model(**inputs).logits
|
150 |
+
|
151 |
+
predicted_class_id = logits.argmax().item()
|
152 |
+
model.config.id2label[predicted_class_id]
|
153 |
|
154 |
```
|
155 |
+
|
156 |
+
## Uses
|
157 |
+
|
158 |
+
#### Direct Use
|
159 |
+
|
160 |
+
This model can be used for topic classification. You can use the raw model for either masked language modeling or next sentence prediction, but it's mostly intended to be fine-tuned on a downstream task. See the model hub to look for fine-tuned versions on a task that interests you.
|
161 |
+
|
162 |
+
#### Misuse and Out-of-scope Use
|
163 |
+
The model should not be used to intentionally create hostile or alienating environments for people. In addition, the model was not trained to be factual or true representations of people or events, and therefore using the model to generate such content is out-of-scope for the abilities of this model.
|
164 |
+
|
165 |
+
|
166 |
+
## Risks, Limitations and Biases
|
167 |
+
|
168 |
+
Based on a few experimentations, we observed that this model could produce biased predictions that target underrepresented populations.
|
169 |
+
|
170 |
+
For instance, for sentences like `This film was filmed in COUNTRY`, this binary classification model will give radically different probabilities for the positive label depending on the country (0.89 if the country is France, but 0.08 if the country is Afghanistan) when nothing in the input indicates such a strong semantic shift. In this [colab](https://colab.research.google.com/gist/ageron/fb2f64fb145b4bc7c49efc97e5f114d3/biasmap.ipynb), [Aurélien Géron](https://twitter.com/aureliengeron) made an interesting map plotting these probabilities for each country.
|
171 |
+
|
172 |
+
<img src="https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english/resolve/main/map.jpeg" alt="Map of positive probabilities per country." width="500"/>
|
173 |
+
|
174 |
+
We strongly advise users to thoroughly probe these aspects on their use-cases in order to evaluate the risks of this model. We recommend looking at the following bias evaluation datasets as a place to start: [WinoBias](https://huggingface.co/datasets/wino_bias), [WinoGender](https://huggingface.co/datasets/super_glue), [Stereoset](https://huggingface.co/datasets/stereoset).
|
175 |
+
|
176 |
+
|
177 |
+
|
178 |
+
# Training
|
179 |
+
|
180 |
+
|
181 |
+
#### Training Data
|
182 |
+
|
183 |
+
|
184 |
+
The authors use the following Stanford Sentiment Treebank([sst2](https://huggingface.co/datasets/sst2)) corpora for the model.
|
185 |
+
|
186 |
+
#### Training Procedure
|
187 |
+
|
188 |
+
###### Fine-tuning hyper-parameters
|
189 |
+
|
190 |
+
|
191 |
+
- learning_rate = 1e-5
|
192 |
+
- batch_size = 32
|
193 |
+
- warmup = 600
|
194 |
+
- max_seq_length = 128
|
195 |
+
- num_train_epochs = 3.0
|
196 |
+
|
197 |
+
|