Commit
Β·
78e4106
1
Parent(s):
16e56fb
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,56 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
+
language: en
|
4 |
+
datasets:
|
5 |
+
- sst2
|
6 |
+
metrics:
|
7 |
+
- precision
|
8 |
+
- recall
|
9 |
+
- f1
|
10 |
+
tags:
|
11 |
+
- text-classification
|
12 |
---
|
13 |
+
|
14 |
+
# T5-base fine-tuned for Sentiment Analysis ππ
|
15 |
+
|
16 |
+
|
17 |
+
[OpenAI's GPT-2](https://openai.com/blog/tags/gpt-2/) medium fine-tuned on [SST-2](https://huggingface.co/datasets/st2) dataset for **Sentiment Analysis** downstream task.
|
18 |
+
|
19 |
+
## Details of T5
|
20 |
+
|
21 |
+
The **GPT-2** model was presented in [Language Models are Unsupervised Multitask Learners](https://d4mucfpksywv.cloudfront.net/better-language-models/language-models.pdf) by *Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever*
|
22 |
+
|
23 |
+
## Model fine-tuning ποΈβ
|
24 |
+
|
25 |
+
The model has been finetuned for 10 epochs on standard hyperparameters
|
26 |
+
|
27 |
+
|
28 |
+
## Val set metrics π§Ύ
|
29 |
+
|
30 |
+
|precision | recall | f1-score |support|
|
31 |
+
|----------|----------|---------|----------|-------|
|
32 |
+
|negative | 0.92 | 0.92| 0.92| 428 |
|
33 |
+
|positive | 0.92 | 0.93| 0.92| 444 |
|
34 |
+
|----------|----------|---------|----------|-------|
|
35 |
+
|accuracy| | | 0.92| 872 |
|
36 |
+
|macro avg| 0.92| 0.92| 0.92| 872 |
|
37 |
+
|weighted avg| 0.92| 0.92| 0.92| 872 |
|
38 |
+
|
39 |
+
|
40 |
+
## Model in Action π
|
41 |
+
|
42 |
+
```python
|
43 |
+
from transformers import GPT2Tokenizer, GPT2ForSequenceClassification
|
44 |
+
|
45 |
+
tokenizer = GPT2Tokenizer.from_pretrained("michelecafagna26/gpt2-medium-finetuned-sst2-sentiment")
|
46 |
+
model = GPT2ForSequenceClassification.from_pretrained("michelecafagna26/gpt2-medium-finetuned-sst2-sentiment")
|
47 |
+
|
48 |
+
inputs = tokenizer("I love it", return_tensors="pt")
|
49 |
+
|
50 |
+
model(**inputs).logits.argmax(axis=1)
|
51 |
+
|
52 |
+
# 1: Positive, 0: Negative
|
53 |
+
# Output: tensor([1])
|
54 |
+
```
|
55 |
+
|
56 |
+
> This model card is based on "mrm8488/t5-base-finetuned-imdb-sentiment" by Manuel Romero/@mrm8488
|