edumunozsala
commited on
Commit
•
dcc378b
1
Parent(s):
a8c160a
Upload README.md
Browse filesMore content and descriptios
README.md
CHANGED
@@ -1,84 +1,96 @@
|
|
1 |
-
---
|
2 |
-
language: es
|
3 |
-
|
4 |
-
|
5 |
-
-
|
6 |
-
-
|
7 |
-
-
|
8 |
-
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
## Hyperparameters
|
55 |
-
|
56 |
-
|
57 |
-
"
|
58 |
-
"eval_batch_size": "8",
|
59 |
-
"fp16": "true",
|
60 |
-
"learning_rate": "3e-05",
|
61 |
-
"model_name": "\"mrm8488/RuPERTa-base\"",
|
62 |
-
"sagemaker_container_log_level": "20",
|
63 |
-
"
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
##
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: es
|
3 |
+
tags:
|
4 |
+
- sagemaker
|
5 |
+
- ruperta
|
6 |
+
- TextClassification
|
7 |
+
- SentimentAnalysis
|
8 |
+
license: apache-2.0
|
9 |
+
datasets:
|
10 |
+
- IMDbreviews_es
|
11 |
+
model-index:
|
12 |
+
name: RuPERTa_base_sentiment_analysis_es
|
13 |
+
results:
|
14 |
+
- task:
|
15 |
+
name: Sentiment Analysis
|
16 |
+
type: sentiment-analysis
|
17 |
+
- dataset:
|
18 |
+
name: "IMDb Reviews in Spanish"
|
19 |
+
type: IMDbreviews_es
|
20 |
+
- metrics:
|
21 |
+
- name: Accuracy,
|
22 |
+
type: accuracy,
|
23 |
+
value: 0.881866
|
24 |
+
- name: F1 Score,
|
25 |
+
type: f1,
|
26 |
+
value: 0.008272
|
27 |
+
- name: Precision,
|
28 |
+
type: precision,
|
29 |
+
value: 0.858605
|
30 |
+
- name: Recall,
|
31 |
+
type: recall,
|
32 |
+
value: 0.920062
|
33 |
+
widget:
|
34 |
+
- text: "Se trata de una película interesante, con un solido argumento y un gran interpretación de su actor principal"
|
35 |
+
---
|
36 |
+
|
37 |
+
## Model `RuPERTa_base_sentiment_analysis_es`
|
38 |
+
|
39 |
+
### **A finetuned model for Sentiment analysis in Spanish**
|
40 |
+
|
41 |
+
This model was trained using Amazon SageMaker and the new Hugging Face Deep Learning container,
|
42 |
+
The base model is **RuPERTa-base (uncased)** which is a RoBERTa model trained on a uncased version of big Spanish corpus.
|
43 |
+
It was trained by mrm8488, Manuel Romero.[Link to base model](https://huggingface.co/mrm8488/RuPERTa-base)
|
44 |
+
|
45 |
+
## Dataset
|
46 |
+
The dataset is a collection of movie reviews in Spanish, about 50,000 reviews. The dataset is balanced and provides every review in english, in spanish and the label in both languages.
|
47 |
+
|
48 |
+
Sizes of datasets:
|
49 |
+
- Train dataset: 42,500
|
50 |
+
- Validation dataset: 3,750
|
51 |
+
- Test dataset: 3,750
|
52 |
+
|
53 |
+
|
54 |
+
## Hyperparameters
|
55 |
+
{
|
56 |
+
"epochs": "4",
|
57 |
+
"train_batch_size": "32",
|
58 |
+
"eval_batch_size": "8",
|
59 |
+
"fp16": "true",
|
60 |
+
"learning_rate": "3e-05",
|
61 |
+
"model_name": "\"mrm8488/RuPERTa-base\"",
|
62 |
+
"sagemaker_container_log_level": "20",
|
63 |
+
"sagemaker_program": "\"train.py\"",
|
64 |
+
}
|
65 |
+
|
66 |
+
## Evaluation results
|
67 |
+
Accuracy = 0.8629333333333333
|
68 |
+
F1 Score = 0.8648790746582545
|
69 |
+
Precision = 0.8479381443298969
|
70 |
+
Recall = 0.8825107296137339
|
71 |
+
|
72 |
+
## Test results
|
73 |
+
Accuracy = 0.8066666666666666
|
74 |
+
F1 Score = 0.8057862309134743
|
75 |
+
Precision = 0.7928307854507116
|
76 |
+
Recall = 0.8191721132897604
|
77 |
+
|
78 |
+
## Model in action
|
79 |
+
|
80 |
+
### Usage for Sentiment Analysis
|
81 |
+
|
82 |
+
```python
|
83 |
+
import torch
|
84 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
85 |
+
|
86 |
+
tokenizer = AutoTokenizer.from_pretrained("edumunozsala/RuPERTa_base_sentiment_analysis_es")
|
87 |
+
model = AutoModelForSequenceClassification.from_pretrained("edumunozsala/RuPERTa_base_sentiment_analysis_es")
|
88 |
+
|
89 |
+
text ="Se trata de una película interesante, con un solido argumento y un gran interpretación de su actor principal"
|
90 |
+
|
91 |
+
input_ids = torch.tensor(tokenizer.encode(text)).unsqueeze(0)
|
92 |
+
outputs = model(input_ids)
|
93 |
+
output = outputs.logits.argmax(1)
|
94 |
+
```
|
95 |
+
|
96 |
+
Created by [Eduardo Muñoz/@edumunozsala](https://github.com/edumunozsala)
|