Migrate model card from transformers-repo
Browse filesRead announcement at https://discuss.huggingface.co/t/announcement-all-model-cards-will-be-migrated-to-hf-co-model-repos/2755
Original file history: https://github.com/huggingface/transformers/commits/master/model_cards/rohanrajpal/bert-base-en-es-codemix-cased/README.md
README.md
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- es
|
4 |
+
- en
|
5 |
+
tags:
|
6 |
+
- es
|
7 |
+
- en
|
8 |
+
- codemix
|
9 |
+
license: "apache-2.0"
|
10 |
+
datasets:
|
11 |
+
- SAIL 2017
|
12 |
+
metrics:
|
13 |
+
- fscore
|
14 |
+
- accuracy
|
15 |
+
- precision
|
16 |
+
- recall
|
17 |
+
---
|
18 |
+
|
19 |
+
# BERT codemixed base model for spanglish (cased)
|
20 |
+
|
21 |
+
This model was built using [lingualytics](https://github.com/lingualytics/py-lingualytics), an open-source library that supports code-mixed analytics.
|
22 |
+
|
23 |
+
## Model description
|
24 |
+
|
25 |
+
Input for the model: Any codemixed spanglish text
|
26 |
+
Output for the model: Sentiment. (0 - Negative, 1 - Neutral, 2 - Positive)
|
27 |
+
|
28 |
+
I took a bert-base-multilingual-cased model from Huggingface and finetuned it on [CS-EN-ES-CORPUS](http://www.grupolys.org/software/CS-CORPORA/cs-en-es-corpus-wassa2015.txt) dataset.
|
29 |
+
|
30 |
+
Performance of this model on the dataset
|
31 |
+
|
32 |
+
| metric | score |
|
33 |
+
|------------|----------|
|
34 |
+
| acc | 0.718615 |
|
35 |
+
| f1 | 0.71759 |
|
36 |
+
| acc_and_f1 | 0.718103 |
|
37 |
+
| precision | 0.719302 |
|
38 |
+
| recall | 0.718615 |
|
39 |
+
|
40 |
+
## Intended uses & limitations
|
41 |
+
|
42 |
+
Make sure to preprocess your data using [these methods](https://github.com/microsoft/GLUECoS/blob/master/Data/Preprocess_Scripts/preprocess_sent_en_es.py) before using this model.
|
43 |
+
|
44 |
+
#### How to use
|
45 |
+
|
46 |
+
Here is how to use this model to get the features of a given text in *PyTorch*:
|
47 |
+
|
48 |
+
```python
|
49 |
+
# You can include sample code which will be formatted
|
50 |
+
from transformers import BertTokenizer, BertModelForSequenceClassification
|
51 |
+
tokenizer = AutoTokenizer.from_pretrained('rohanrajpal/bert-base-en-es-codemix-cased')
|
52 |
+
model = AutoModelForSequenceClassification.from_pretrained('rohanrajpal/bert-base-en-es-codemix-cased')
|
53 |
+
text = "Replace me by any text you'd like."
|
54 |
+
encoded_input = tokenizer(text, return_tensors='pt')
|
55 |
+
output = model(**encoded_input)
|
56 |
+
```
|
57 |
+
|
58 |
+
and in *TensorFlow*:
|
59 |
+
|
60 |
+
```python
|
61 |
+
from transformers import BertTokenizer, TFBertModel
|
62 |
+
tokenizer = BertTokenizer.from_pretrained('rohanrajpal/bert-base-en-es-codemix-cased')
|
63 |
+
model = TFBertModel.from_pretrained('rohanrajpal/bert-base-en-es-codemix-cased')
|
64 |
+
text = "Replace me by any text you'd like."
|
65 |
+
encoded_input = tokenizer(text, return_tensors='tf')
|
66 |
+
output = model(encoded_input)
|
67 |
+
```
|
68 |
+
|
69 |
+
#### Limitations and bias
|
70 |
+
|
71 |
+
Since I dont know spanish, I cant verify the quality of annotations or the dataset itself. This is a very simple transfer learning approach and I'm open to discussions to improve upon this.
|
72 |
+
|
73 |
+
## Training data
|
74 |
+
|
75 |
+
I trained on the dataset on the [bert-base-multilingual-cased model](https://huggingface.co/bert-base-multilingual-cased).
|
76 |
+
|
77 |
+
## Training procedure
|
78 |
+
|
79 |
+
Followed the preprocessing techniques followed [here](https://github.com/microsoft/GLUECoS/blob/master/Data/Preprocess_Scripts/preprocess_sent_en_es.py)
|
80 |
+
|
81 |
+
## Eval results
|
82 |
+
|
83 |
+
### BibTeX entry and citation info
|
84 |
+
|
85 |
+
```bibtex
|
86 |
+
@inproceedings{khanuja-etal-2020-gluecos,
|
87 |
+
title = "{GLUEC}o{S}: An Evaluation Benchmark for Code-Switched {NLP}",
|
88 |
+
author = "Khanuja, Simran and
|
89 |
+
Dandapat, Sandipan and
|
90 |
+
Srinivasan, Anirudh and
|
91 |
+
Sitaram, Sunayana and
|
92 |
+
Choudhury, Monojit",
|
93 |
+
booktitle = "Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics",
|
94 |
+
month = jul,
|
95 |
+
year = "2020",
|
96 |
+
address = "Online",
|
97 |
+
publisher = "Association for Computational Linguistics",
|
98 |
+
url = "https://www.aclweb.org/anthology/2020.acl-main.329",
|
99 |
+
pages = "3575--3585"
|
100 |
+
}
|
101 |
+
```
|