Davlan commited on
Commit
e98a2db
·
1 Parent(s): 2f3588e

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +71 -3
README.md CHANGED
@@ -1,3 +1,71 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Hugging Face's logo
2
+ ---
3
+ language:
4
+ - hau
5
+ - ibo
6
+ - pcm
7
+ - yor
8
+ - multilingual
9
+
10
+ ---
11
+ # naija-twitter-sentiment-afriberta-large
12
+ ## Model description
13
+ **naija-twitter-sentiment-afriberta-large** is the first multilingual twitter **sentiment classification** model for four (4) Nigerian languages (Hausa, Igbo, Nigerian Pidgin, and Yorùbá) based on a fine-tuned castorini/afriberta_large large model.
14
+ It achieves the **state-of-the-art performance** for the twitter sentiment classification task trained on the [NaijaSenti corpus](https://github.com/hausanlp/NaijaSenti).
15
+ The model has been trained to classify tweets into 3 sentiment classes: negative, neutral and positive
16
+ Specifically, this model is a *xlm-roberta-large* model that was fine-tuned on an aggregation of 4 Nigerian language datasets obtained from [NaijaSenti](https://github.com/hausanlp/NaijaSenti) dataset.
17
+
18
+ ## Intended uses & limitations
19
+ #### How to use
20
+ You can use this model with Transformers *pipeline* for Sentiment Classification.
21
+ ```python
22
+ from transformers import AutoModelForSequenceClassification
23
+ from transformers import AutoTokenizer
24
+ import numpy as np
25
+ from scipy.special import softmax
26
+
27
+ MODEL = "Davlan/naija-twitter-sentiment-afriberta-large"
28
+ tokenizer = AutoTokenizer.from_pretrained(MODEL)
29
+
30
+ # PT
31
+ model = AutoModelForSequenceClassification.from_pretrained(MODEL)
32
+
33
+ text = "I like you"
34
+ encoded_input = tokenizer(text, return_tensors='pt')
35
+ output = model(**encoded_input)
36
+ scores = output[0][0].detach().numpy()
37
+ scores = softmax(scores)
38
+
39
+ id2label = {0:"positive", 1:"neutral", 2:"negative"}
40
+
41
+ ranking = np.argsort(scores)
42
+ ranking = ranking[::-1]
43
+ for i in range(scores.shape[0]):
44
+ l = id2label[ranking[i]]
45
+ s = scores[ranking[i]]
46
+ print(f"{i+1}) {l} {np.round(float(s), 4)}")
47
+ ```
48
+ #### Limitations and bias
49
+ This model is limited by its training dataset and domain i.e Twitter. This may not generalize well for all use cases in different domains.
50
+
51
+
52
+ ## Training procedure
53
+ This model was trained on a single Nvidia RTX 2080 GPU with recommended hyperparameters from the [original NaijaSenti paper](https://arxiv.org/abs/2201.08277).
54
+ ## Eval results on Test set (F-score), average over 5 runs.
55
+ language|F1-score
56
+ -|-
57
+ hau |81.2
58
+ ibo |80.8
59
+ pcm |74.5
60
+ yor |80.4
61
+
62
+ ### BibTeX entry and citation info
63
+ ```
64
+ @inproceedings{Muhammad2022NaijaSentiAN,
65
+ title={NaijaSenti: A Nigerian Twitter Sentiment Corpus for Multilingual Sentiment Analysis},
66
+ author={Shamsuddeen Hassan Muhammad and David Ifeoluwa Adelani and Sebastian Ruder and Ibrahim Said Ahmad and Idris Abdulmumin and Bello Shehu Bello and Monojit Choudhury and Chris C. Emezue and Saheed Salahudeen Abdullahi and Anuoluwapo Aremu and Alipio Jeorge and Pavel B. Brazdil},
67
+ year={2022}
68
+ }
69
+ ```
70
+
71
+