Compare commits
10 Commits
856553beaa
...
d38ef7b862
Author | SHA1 | Date |
---|---|---|
|
d38ef7b862 | |
|
f3e34b6c30 | |
|
88a0007355 | |
|
083e90c883 | |
|
54186b74b2 | |
|
968fc69b26 | |
|
34227e9348 | |
|
806cad138d | |
|
b8a60461af | |
|
d80dae4ef8 |
17
README.md
17
README.md
|
@ -1,21 +1,23 @@
|
||||||
---
|
---
|
||||||
language: multilingual
|
language: multilingual
|
||||||
widget:
|
widget:
|
||||||
- text: "T'estimo!"
|
- text: "🤗"
|
||||||
|
- text: "T'estimo! ❤️"
|
||||||
- text: "I love you!"
|
- text: "I love you!"
|
||||||
- text: "I hate you"
|
- text: "I hate you 🤮"
|
||||||
- text: "Mahal kita!"
|
- text: "Mahal kita!"
|
||||||
- text: "사랑해!"
|
- text: "사랑해!"
|
||||||
- text: "난 너가 싫어"
|
- text: "난 너가 싫어"
|
||||||
|
- text: "😍😍😍"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
# twitter-XLM-roBERTa-base for Sentiment Analysis
|
# twitter-XLM-roBERTa-base for Sentiment Analysis
|
||||||
|
|
||||||
This is a XLM-roBERTa-base model trained on ~198M tweets and finetuned for sentiment analysis in
|
This is a multilingual XLM-roBERTa-base model trained on ~198M tweets and finetuned for sentiment analysis. The sentiment fine-tuning was done on 8 languages (Ar, En, Fr, De, Hi, It, Sp, Pt) but it can be used for more languages (see paper for details).
|
||||||
|
|
||||||
- Paper: [XLM-T: A Multilingual Language Model Toolkit for Twitter](https://...).
|
- Paper: [XLM-T: A Multilingual Language Model Toolkit for Twitter](https://arxiv.org/abs/2104.12250).
|
||||||
- Git Repo: [Tweeteval official repository](https://github.com/cardiffnlp/xlm-t).
|
- Git Repo: [XLM-T official repository](https://github.com/cardiffnlp/xlm-t).
|
||||||
|
|
||||||
## Example Pipeline
|
## Example Pipeline
|
||||||
```python
|
```python
|
||||||
|
@ -24,9 +26,8 @@ model_path = "cardiffnlp/twitter-xlm-roberta-base-sentiment"
|
||||||
sentiment_task = pipeline("sentiment-analysis", model=model_path, tokenizer=model_path)
|
sentiment_task = pipeline("sentiment-analysis", model=model_path, tokenizer=model_path)
|
||||||
sentiment_task("T'estimo!")
|
sentiment_task("T'estimo!")
|
||||||
```
|
```
|
||||||
Output:
|
|
||||||
```
|
```
|
||||||
[{'label': 'LABEL_2', 'score': 0.6600581407546997}]
|
[{'label': 'Positive', 'score': 0.6600581407546997}]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Full classification example
|
## Full classification example
|
||||||
|
@ -34,7 +35,7 @@ Output:
|
||||||
```python
|
```python
|
||||||
from transformers import AutoModelForSequenceClassification
|
from transformers import AutoModelForSequenceClassification
|
||||||
from transformers import TFAutoModelForSequenceClassification
|
from transformers import TFAutoModelForSequenceClassification
|
||||||
from transformers import AutoTokenizer
|
from transformers import AutoTokenizer, AutoConfig
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from scipy.special import softmax
|
from scipy.special import softmax
|
||||||
|
|
||||||
|
|
12
config.json
12
config.json
|
@ -11,16 +11,16 @@
|
||||||
"hidden_dropout_prob": 0.1,
|
"hidden_dropout_prob": 0.1,
|
||||||
"hidden_size": 768,
|
"hidden_size": 768,
|
||||||
"id2label": {
|
"id2label": {
|
||||||
"0": "Negative",
|
"0": "negative",
|
||||||
"1": "Neutral",
|
"1": "neutral",
|
||||||
"2": "Positive"
|
"2": "positive"
|
||||||
},
|
},
|
||||||
"initializer_range": 0.02,
|
"initializer_range": 0.02,
|
||||||
"intermediate_size": 3072,
|
"intermediate_size": 3072,
|
||||||
"label2id": {
|
"label2id": {
|
||||||
"Negative": 0,
|
"negative": 0,
|
||||||
"Neutral": 1,
|
"neutral": 1,
|
||||||
"Positive": 2
|
"positive": 2
|
||||||
},
|
},
|
||||||
"layer_norm_eps": 1e-05,
|
"layer_norm_eps": 1e-05,
|
||||||
"max_position_embeddings": 514,
|
"max_position_embeddings": 514,
|
||||||
|
|
Loading…
Reference in New Issue