hplisiecki
commited on
Commit
•
bae0f76
1
Parent(s):
54e2bbb
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,66 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
---
|
4 |
+
# Affective Norms Extrapolation Model for Spanish Language
|
5 |
+
|
6 |
+
## Model Description
|
7 |
+
|
8 |
+
This transformer-based model is designed to extrapolate affective norms for Spanish words, including metrics such as valence, arousal, concreteness, imageability, and familiarity. It has been finetuned from the "bert-base-spanish-wwm-cased" model (https://huggingface.co/dccuchile/bert-base-spanish-wwm-cased), enhanced with additional layers to predict the affective dimensions. This model was first released as a part of the publication: "Extrapolation of affective norms using transformer-based neural networks and its application to experimental stimuli selection."
|
9 |
+
|
10 |
+
|
11 |
+
## Training Data
|
12 |
+
|
13 |
+
The model was trained on the Spanish affective norms dataset by Redondo et al. (2007) [https://doi.org/10.3758/BF03193031], which includes 1400 words rated by participants on various emotional and semantic dimensions. The dataset was split into training, validation, and test sets in an 8:1:1 ratio.
|
14 |
+
|
15 |
+
## Performance
|
16 |
+
|
17 |
+
The model achieved the following Pearson correlations with human judgments on the test set:
|
18 |
+
|
19 |
+
- Valence: 0.89
|
20 |
+
- Arousal: 0.80
|
21 |
+
- Concreteness: 0.89
|
22 |
+
- Imageability: 0.86
|
23 |
+
- Familiarity: 0.71
|
24 |
+
|
25 |
+
|
26 |
+
## Usage
|
27 |
+
|
28 |
+
You can use the model and tokenizer as follows:
|
29 |
+
|
30 |
+
First run the bash code below to clone the repository (this will take some time). Because of the custom model class, this model cannot be run with the usual huggingface Model setups.
|
31 |
+
|
32 |
+
```bash
|
33 |
+
git clone https://huggingface.co/hplisiecki/word2affect_spanish
|
34 |
+
```
|
35 |
+
|
36 |
+
Proceed as follows:
|
37 |
+
|
38 |
+
```python
|
39 |
+
from word2affect_spanish.model_script import CustomModel # importing the custom model class
|
40 |
+
from transformers import PreTrainedTokenizerFast
|
41 |
+
|
42 |
+
model_directory = "word2affect_spanish" # path to the cloned repository
|
43 |
+
model = CustomModel.from_pretrained('word2affect_spanish')
|
44 |
+
tokenizer = PreTrainedTokenizerFast.from_pretrained('word2affect_spanish')
|
45 |
+
inputs = tokenizer("This is a test input.", return_tensors="pt")
|
46 |
+
outputs = model(inputs['input_ids'], inputs['attention_mask'])
|
47 |
+
|
48 |
+
# Print out the emotion ratings
|
49 |
+
for emotion, rating in zip(['Valence', 'Arousal', 'Concreteness', 'Imageability', 'Familiarity'], outputs):
|
50 |
+
print(f"{emotion}: {rating.item()}")
|
51 |
+
```
|
52 |
+
|
53 |
+
## Citation
|
54 |
+
|
55 |
+
If you use this model please cite the following paper.
|
56 |
+
|
57 |
+
```sql
|
58 |
+
@article{Plisiecki_Sobieszek_2023,
|
59 |
+
title={Extrapolation of affective norms using transformer-based neural networks and its application to experimental stimuli selection},
|
60 |
+
author={Plisiecki, Hubert and Sobieszek, Adam},
|
61 |
+
journal={Behavior Research Methods},
|
62 |
+
year={2023},
|
63 |
+
pages={1-16}
|
64 |
+
doi={https://doi.org/10.3758/s13428-023-02212-3}
|
65 |
+
}
|
66 |
+
```
|