tae898 commited on
Commit
6432b49
·
1 Parent(s): 1de62d8

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +161 -0
README.md ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ tags:
4
+ - emoberta
5
+ - roberta
6
+ license: mit
7
+ datasets:
8
+ - MELD
9
+ - IEMOCAP
10
+ ---
11
+
12
+ # Emotion Recognition in Coversation (ERC)
13
+
14
+ [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/emoberta-speaker-aware-emotion-recognition-in/emotion-recognition-in-conversation-on)](https://paperswithcode.com/sota/emotion-recognition-in-conversation-on?p=emoberta-speaker-aware-emotion-recognition-in)<br>
15
+ [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/emoberta-speaker-aware-emotion-recognition-in/emotion-recognition-in-conversation-on-meld)](https://paperswithcode.com/sota/emotion-recognition-in-conversation-on-meld?p=emoberta-speaker-aware-emotion-recognition-in)<br>
16
+
17
+ At the moment, we only use the text modality to correctly classify the emotion of the utterances.The experiments were carried out on two datasets (i.e. MELD and IEMOCAP)
18
+
19
+ ## Prerequisites
20
+
21
+ 1. An x86-64 Unix or Unix-like machine
22
+ 1. Python 3.8 or higher
23
+ 1. Running in a virtual environment (e.g., conda, virtualenv, etc.) is highly recommended so that you don't mess up with the system python.
24
+ 1. [`multimodal-datasets` repo](https://github.com/tae898/multimodal-datasets) (submodule)
25
+ 1. pip install -r requirements.txt
26
+
27
+ ## EmoBERTa training
28
+
29
+ First configure the hyper parameters and the dataset in `train-erc-text.yaml` and then,
30
+ In this directory run the below commands. I recommend you to run this in a virtualenv.
31
+
32
+ ```sh
33
+ python train-erc-text.py
34
+ ```
35
+
36
+ This will subsequently call `train-erc-text-hp.py` and `train-erc-text-full.py`.
37
+
38
+ ## Results on the test split (weighted f1 scores)
39
+
40
+ | Model | | MELD | IEMOCAP |
41
+ | -------- | ------------------------------- | :-------: | :-------: |
42
+ | EmoBERTa | No past and future utterances | 63.46 | 56.09 |
43
+ | | Only past utterances | 64.55 | **68.57** |
44
+ | | Only future utterances | 64.23 | 66.56 |
45
+ | | Both past and future utterances | **65.61** | 67.42 |
46
+ | | → *without speaker names* | 65.07 | 64.02 |
47
+
48
+ Above numbers are the mean values of five random seed runs.
49
+
50
+ If you want to see more training test details, check out `./results/`
51
+
52
+ If you want to download the trained checkpoints and stuff, then [here](https://surfdrive.surf.nl/files/index.php/s/khREwk4MUI7MSnO/download) is where you can download them. It's a pretty big zip file.
53
+
54
+ ## Deployment
55
+
56
+ ### Huggingface
57
+
58
+ We have released our models on huggingface:
59
+
60
+ - [emoberta-base](https://huggingface.co/tae898/emoberta-base)
61
+ - [emoberta-large](https://huggingface.co/tae898/emoberta-large)
62
+
63
+ They are based on [RoBERTa-base](https://huggingface.co/roberta-base) and [RoBERTa-large](https://huggingface.co/roberta-large), respectively. They were trained on [both MELD and IEMOCAP datasets](utterance-ordered-MELD_IEMOCAP.json). Our deployed models are neither speaker-aware nor take previous utterances into account, meaning that it only classifies one utterance at a time without the speaker information (e.g., "I love you").
64
+
65
+ ### Flask app
66
+
67
+ You can either run the Flask RESTful server app as a docker container or just as a python script.
68
+
69
+ 1. Running the app as a docker container **(recommended)**.
70
+
71
+ There are four images. Take what you need:
72
+
73
+ - `docker run -it --rm -p 10006:10006 tae898/emoberta-base`
74
+ - `docker run -it --rm -p 10006:10006 --gpus all tae898/emoberta-base-cuda`
75
+ - `docker run -it --rm -p 10006:10006 tae898/emoberta-large`
76
+ - `docker run -it --rm -p 10006:10006 --gpus all tae898/emoberta-large-cuda`
77
+
78
+ 1. Running the app in your python environment:
79
+
80
+ This method is less recommended than the docker one.
81
+
82
+ Run `pip install -r requirements-deploy.txt` first.<br>
83
+ The [`app.py`](app.py) is a flask RESTful server. The usage is below:
84
+
85
+ ```console
86
+ app.py [-h] [--host HOST] [--port PORT] [--device DEVICE] [--model-type MODEL_TYPE]
87
+ ```
88
+
89
+ For example:
90
+
91
+ ```sh
92
+ python app.py --host 0.0.0.0 --port 10006 --device cpu --model-type emoberta-base
93
+ ```
94
+
95
+ ### Client
96
+
97
+ Once the app is running, you can send a text to the server. You can do so with a [client.py](client.py). The usage is elow:
98
+
99
+ ```console
100
+ client.py [-h] [--url-emoberta URL_EMOBERTA] --text TEXT
101
+ ```
102
+
103
+ For example:
104
+
105
+ ```sh
106
+ python client.py --text "Emotion recognition is so cool\!"
107
+ ```
108
+
109
+ will give you:
110
+
111
+ ```json
112
+ {
113
+ "neutral": 0.0049800905,
114
+ "joy": 0.96399665,
115
+ "surprise": 0.018937444,
116
+ "anger": 0.0071516023,
117
+ "sadness": 0.002021492,
118
+ "disgust": 0.001495996,
119
+ "fear": 0.0014167271
120
+ }
121
+ ```
122
+
123
+ ## Troubleshooting
124
+
125
+ The best way to find and solve your problems is to see in the github issue tab. If you can't find what you want, feel free to raise an issue. We are pretty responsive.
126
+
127
+ ## Contributing
128
+
129
+ Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.
130
+
131
+ 1. Fork the Project
132
+ 1. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
133
+ 1. Run `make style && quality` in the root repo directory, to ensure code quality.
134
+ 1. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
135
+ 1. Push to the Branch (`git push origin feature/AmazingFeature`)
136
+ 1. Open a Pull Request
137
+
138
+ ## Cite our work
139
+
140
+ Check out the [paper](https://arxiv.org/abs/2108.12009).
141
+
142
+ ```bibtex
143
+ @misc{kim2021emoberta,
144
+ title={EmoBERTa: Speaker-Aware Emotion Recognition in Conversation with RoBERTa},
145
+ author={Taewoon Kim and Piek Vossen},
146
+ year={2021},
147
+ eprint={2108.12009},
148
+ archivePrefix={arXiv},
149
+ primaryClass={cs.CL}
150
+ }
151
+ ```
152
+
153
+ [![DOI](https://zenodo.org/badge/328375452.svg)](https://zenodo.org/badge/latestdoi/328375452)<br>
154
+
155
+ ## Authors
156
+
157
+ - [Taewoon Kim](https://taewoonkim.com/)
158
+
159
+ ## License
160
+
161
+ [MIT](https://choosealicense.com/licenses/mit/)