diff --git a/README.md b/README.md index f7fbcbc..18c60ec 100644 --- a/README.md +++ b/README.md @@ -44,20 +44,55 @@ model-index: # DistilBERT base uncased finetuned SST-2 -This model is a fine-tune checkpoint of [DistilBERT-base-uncased](https://huggingface.co/distilbert-base-uncased), fine-tuned on SST-2. +## Table of Contents +- [Model Details](#model-details) +- [How to Get Started With the Model](#how-to-get-started-with-the-model) +- [Uses](#uses) +- [Risks, Limitations and Biases](#risks-limitations-and-biases) +- [Training](#training) + +## Model Details +**Model Description:** This model is a fine-tune checkpoint of [DistilBERT-base-uncased](https://huggingface.co/distilbert-base-uncased), fine-tuned on SST-2. 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). +- **Developed by:** Hugging Face +- **Model Type:** Text Classification +- **Language(s):** English +- **License:** Apache-2.0 +- **Parent Model:** For more details about DistilBERT, we encourage users to check out [this model card](https://huggingface.co/distilbert-base-uncased). +- **Resources for more information:** + - [Model Documentation](https://huggingface.co/docs/transformers/main/en/model_doc/distilbert#transformers.DistilBertForSequenceClassification) -For more details about DistilBERT, we encourage users to check out [this model card](https://huggingface.co/distilbert-base-uncased). +## How to Get Started With the Model -# Fine-tuning hyper-parameters +Example of single-label classification: +​​ +```python +import torch +from transformers import DistilBertTokenizer, DistilBertForSequenceClassification -- learning_rate = 1e-5 -- batch_size = 32 -- warmup = 600 -- max_seq_length = 128 -- num_train_epochs = 3.0 +tokenizer = DistilBertTokenizer.from_pretrained("distilbert-base-uncased") +model = DistilBertForSequenceClassification.from_pretrained("distilbert-base-uncased") -# Bias +inputs = tokenizer("Hello, my dog is cute", return_tensors="pt") +with torch.no_grad(): + logits = model(**inputs).logits + +predicted_class_id = logits.argmax().item() +model.config.id2label[predicted_class_id] + +``` + +## Uses + +#### Direct Use + +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. + +#### Misuse and Out-of-scope Use +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. + + +## Risks, Limitations and Biases Based on a few experimentations, we observed that this model could produce biased predictions that target underrepresented populations. @@ -66,3 +101,26 @@ For instance, for sentences like `This film was filmed in COUNTRY`, this binary Map of positive probabilities per country. 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). + + + +# Training + + +#### Training Data + + +The authors use the following Stanford Sentiment Treebank([sst2](https://huggingface.co/datasets/sst2)) corpora for the model. + +#### Training Procedure + +###### Fine-tuning hyper-parameters + + +- learning_rate = 1e-5 +- batch_size = 32 +- warmup = 600 +- max_seq_length = 128 +- num_train_epochs = 3.0 + +