Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,52 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
datasets:
|
4 |
+
- Alienmaster/SB10k
|
5 |
+
- cardiffnlp/tweet_sentiment_multilingual
|
6 |
+
- legacy-datasets/wikipedia
|
7 |
+
- community-datasets/gnad10
|
8 |
+
language:
|
9 |
+
- de
|
10 |
+
base_model: dbmdz/bert-base-german-uncased
|
11 |
+
pipeline_tag: text-classification
|
12 |
+
---
|
13 |
+
|
14 |
+
## Tweet Style Classifier (German)
|
15 |
+
|
16 |
+
|
17 |
+
This model is a fine-tuned bert-base-uncased on a binary classification task to determine whether a German text is a tweet or not.
|
18 |
+
|
19 |
+
The dataset contained about 20K instances, with a 50/50 distribution between the two classes. It was shuffled with a random seed of 42 and split into 80/20 for training/testing.
|
20 |
+
The NVIDIA RTX A6000 GPU was used for training three epochs with a batch size of 8. Other hyperparameters were default values from the HuggingFace Trainer.
|
21 |
+
|
22 |
+
The model was trained in order to evaluate a text style transfer task, converting formal-language texts to tweets.
|
23 |
+
|
24 |
+
### How to use
|
25 |
+
|
26 |
+
```python
|
27 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer, TextClassificationPipeline
|
28 |
+
|
29 |
+
model_name = "rabuahmad/tweet-style-classifier-de"
|
30 |
+
|
31 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
32 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name, max_len=512)
|
33 |
+
|
34 |
+
classifier = TextClassificationPipeline(model=model, tokenizer=tokenizer, truncation=True, max_length=512)
|
35 |
+
|
36 |
+
text = "Gestern war ein schöner Tag!"
|
37 |
+
|
38 |
+
result = classifier(text)
|
39 |
+
|
40 |
+
```
|
41 |
+
Label 1 indicates that the text is predicted to be a tweet.
|
42 |
+
|
43 |
+
### Evaluation
|
44 |
+
|
45 |
+
Evaluation results on the test set:
|
46 |
+
|
47 |
+
| Metric |Score |
|
48 |
+
|----------|-----------|
|
49 |
+
| Accuracy | 0.99988 |
|
50 |
+
| Precision| 0.99901 |
|
51 |
+
| Recall | 0.99901 |
|
52 |
+
| F1 | 0.99901 |
|