Compare commits
No commits in common. "d38ef7b8626347c12363d3058a8db28fe6dbcdb4" and "856553beaaaf559c029023df1e1af05a35723b77" have entirely different histories.
d38ef7b862
...
856553beaa
17
README.md
17
README.md
|
@ -1,23 +1,21 @@
|
||||||
---
|
---
|
||||||
language: multilingual
|
language: multilingual
|
||||||
widget:
|
widget:
|
||||||
- text: "🤗"
|
- text: "T'estimo!"
|
||||||
- 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 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).
|
This is a XLM-roBERTa-base model trained on ~198M tweets and finetuned for sentiment analysis in
|
||||||
|
|
||||||
- Paper: [XLM-T: A Multilingual Language Model Toolkit for Twitter](https://arxiv.org/abs/2104.12250).
|
- Paper: [XLM-T: A Multilingual Language Model Toolkit for Twitter](https://...).
|
||||||
- Git Repo: [XLM-T official repository](https://github.com/cardiffnlp/xlm-t).
|
- Git Repo: [Tweeteval official repository](https://github.com/cardiffnlp/xlm-t).
|
||||||
|
|
||||||
## Example Pipeline
|
## Example Pipeline
|
||||||
```python
|
```python
|
||||||
|
@ -26,8 +24,9 @@ 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': 'Positive', 'score': 0.6600581407546997}]
|
[{'label': 'LABEL_2', 'score': 0.6600581407546997}]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Full classification example
|
## Full classification example
|
||||||
|
@ -35,7 +34,7 @@ sentiment_task("T'estimo!")
|
||||||
```python
|
```python
|
||||||
from transformers import AutoModelForSequenceClassification
|
from transformers import AutoModelForSequenceClassification
|
||||||
from transformers import TFAutoModelForSequenceClassification
|
from transformers import TFAutoModelForSequenceClassification
|
||||||
from transformers import AutoTokenizer, AutoConfig
|
from transformers import AutoTokenizer
|
||||||
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