Model Card
#3
by
Ezi
- opened
README.md
CHANGED
@@ -7,20 +7,55 @@ datasets:
|
|
7 |
|
8 |
# DistilBERT base uncased finetuned SST-2
|
9 |
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
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).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
|
14 |
|
15 |
-
|
|
|
|
|
|
|
|
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
22 |
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
Based on a few experimentations, we observed that this model could produce biased predictions that target underrepresented populations.
|
26 |
|
@@ -29,3 +64,26 @@ For instance, for sentences like `This film was filmed in COUNTRY`, this binary
|
|
29 |
<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"/>
|
30 |
|
31 |
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).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
# DistilBERT base uncased finetuned SST-2
|
9 |
|
10 |
+
## Table of Contents
|
11 |
+
- [Model Details](#model-details)
|
12 |
+
- [How to Get Started With the Model](#how-to-get-started-with-the-model)
|
13 |
+
- [Uses](#uses)
|
14 |
+
- [Risks, Limitations and Biases](#risks-limitations-and-biases)
|
15 |
+
- [Training](#training)
|
16 |
+
|
17 |
+
## Model Details
|
18 |
+
**Model Description:** This model is a fine-tune checkpoint of [DistilBERT-base-uncased](https://huggingface.co/distilbert-base-uncased), fine-tuned on SST-2.
|
19 |
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).
|
20 |
+
- **Developed by:** Hugging Face
|
21 |
+
- **Model Type:** Text Classification
|
22 |
+
- **Language(s):** English
|
23 |
+
- **License:** Apache-2.0
|
24 |
+
- **Parent Model:** For more details about DistilBERT, we encourage users to check out [this model card](https://huggingface.co/distilbert-base-uncased).
|
25 |
+
- **Resources for more information:**
|
26 |
+
- [Model Documentation](https://huggingface.co/docs/transformers/main/en/model_doc/distilbert#transformers.DistilBertForSequenceClassification)
|
27 |
|
28 |
+
## How to Get Started With the Model
|
29 |
|
30 |
+
Example of single-label classification:
|
31 |
+
|
32 |
+
```python
|
33 |
+
import torch
|
34 |
+
from transformers import DistilBertTokenizer, DistilBertForSequenceClassification
|
35 |
|
36 |
+
tokenizer = DistilBertTokenizer.from_pretrained("distilbert-base-uncased")
|
37 |
+
model = DistilBertForSequenceClassification.from_pretrained("distilbert-base-uncased")
|
38 |
+
|
39 |
+
inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
|
40 |
+
with torch.no_grad():
|
41 |
+
logits = model(**inputs).logits
|
42 |
+
|
43 |
+
predicted_class_id = logits.argmax().item()
|
44 |
+
model.config.id2label[predicted_class_id]
|
45 |
|
46 |
+
```
|
47 |
+
|
48 |
+
## Uses
|
49 |
+
|
50 |
+
#### Direct Use
|
51 |
+
|
52 |
+
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.
|
53 |
+
|
54 |
+
#### Misuse and Out-of-scope Use
|
55 |
+
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.
|
56 |
+
|
57 |
+
|
58 |
+
## Risks, Limitations and Biases
|
59 |
|
60 |
Based on a few experimentations, we observed that this model could produce biased predictions that target underrepresented populations.
|
61 |
|
|
|
64 |
<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"/>
|
65 |
|
66 |
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).
|
67 |
+
|
68 |
+
|
69 |
+
|
70 |
+
# Training
|
71 |
+
|
72 |
+
|
73 |
+
#### Training Data
|
74 |
+
|
75 |
+
|
76 |
+
The authors use the following Stanford Sentiment Treebank([sst2](https://huggingface.co/datasets/sst2)) corpora for the model.
|
77 |
+
|
78 |
+
#### Training Procedure
|
79 |
+
|
80 |
+
###### Fine-tuning hyper-parameters
|
81 |
+
|
82 |
+
|
83 |
+
- learning_rate = 1e-5
|
84 |
+
- batch_size = 32
|
85 |
+
- warmup = 600
|
86 |
+
- max_seq_length = 128
|
87 |
+
- num_train_epochs = 3.0
|
88 |
+
|
89 |
+
|