File size: 6,166 Bytes
6df101e
 
 
737ca58
 
94d25a2
 
 
c8d97be
6df101e
 
061a68a
 
6df101e
061a68a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
529b3c1
061a68a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a02771e
 
 
 
fc4485d
a02771e
fc4485d
a02771e
 
fc4485d
a02771e
 
fc4485d
 
 
a02771e
 
 
bf067d2
1
2
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
---
library_name: transformers
tags: []
pipeline_tag: fill-mask
widget:
 - text: "shop làm ăn như cái <mask>"
 - text: "hag từ Quảng <mask> kực nét"
 - text: "Set xinh quá, <mask> bèo nhèo"
 - text: "đúng nhận sai <mask>"
---

# 5CD-AI/viso-twhin-bert-large
## Overview
<!-- Provide a quick summary of what the model is/does. -->
We reduce TwHIN-BERT's vocabulary size to 20k on the UIT dataset and continue pretraining for 10 epochs.

Here are the results on 4 downstream tasks on Vietnamese social media texts, including Emotion Recognition(UIT-VSMEC), Hate Speech Detection(UIT-HSD), Spam Reviews Detection(ViSpamReviews), Hate Speech Spans Detection(ViHOS):
<table>
        <tr align="center">
            <td rowspan=2><b>Model</td>
            <td rowspan=2><b>Avg</td>
            <td colspan=3><b>Emotion Recognition</td>
            <td colspan=3><b>Hate Speech Detection</td>
            <td colspan=3><b>Spam Reviews Detection</td>
            <td colspan=3><b>Hate Speech Spans Detection</td>
        </tr>
        <tr align="center">
            <td><b>Acc</td>
            <td><b>WF1</td>
            <td><b>MF1</td>
            <td><b>Acc</td>
            <td><b>WF1</td>
            <td><b>MF1</td>
            <td><b>Acc</td>
            <td><b>WF1</td>
            <td><b>MF1</td>
            <td><b>Acc</td>
            <td><b>WF1</td>
            <td><b>MF1</td>
        </tr>
        <tr align="center">
            <td align="left">viBERT</td>
            <td>78.16</td>
            <td>61.91</td>
            <td>61.98</td>
            <td>59.7</td>
            <td>85.34</td>
            <td>85.01</td>
            <td>62.07</td>
            <td>89.93</td>
            <td>89.79</td>
            <td>76.8</td>
            <td>90.42</td>
            <td>90.45</td>
            <td>84.55</td>
        </tr>
        <tr align="center">
            <td align="left">vELECTRA</td>
            <td>79.23</td>
            <td>64.79</td>
            <td>64.71</td>
            <td>61.95</td>
            <td>86.96</td>
            <td>86.37</td>
            <td>63.95</td>
            <td>89.83</td>
            <td>89.68</td>
            <td>76.23</td>
            <td>90.59</td>
            <td>90.58</td>
            <td>85.12</td>
        </tr>
        <tr align="center">
            <td align="left">PhoBERT-Base </td>
            <td>79.3</td>
            <td>63.49</td>
            <td>63.36</td>
            <td>61.41</td>
            <td>87.12</td>
            <td>86.81</td>
            <td>65.01</td>
            <td>89.83</td>
            <td>89.75</td>
            <td>76.18</td>
            <td>91.32</td>
            <td>91.38</td>
            <td>85.92</td>
        </tr>
        <tr align="center">
            <td align="left">PhoBERT-Large</td>
            <td>79.82</td>
            <td>64.71</td>
            <td>64.66</td>
            <td>62.55</td>
            <td>87.32</td>
            <td>86.98</td>
            <td>65.14</td>
            <td>90.12</td>
            <td>90.03</td>
            <td>76.88</td>
            <td>91.44</td>
            <td>91.46</td>
            <td>86.56</td>
        </tr>
        <tr align="center">
            <td align="left">ViSoBERT</td>
            <td>81.58</td>
            <td>68.1</td>
            <td>68.37</td>
            <td>65.88</td>
            <td>88.51</td>
            <td>88.31</td>
            <td>68.77</td>
            <td>90.99</td>
            <td>90.92</td>
            <td>79.06</td>
            <td>91.62</td>
            <td>91.57</td>
            <td>86.8</td>
        </tr>
        <tr align="center">
            <td align="left">visobert-14gb-corpus</td>
            <td>82.2</td>
            <td>68.69</td>
            <td>68.75</td>
            <td>66.03</td>
            <td>88.79</td>
            <td>88.6</td>
            <td>69.57</td>
            <td>91.02</td>
            <td>90.88</td>
            <td>77.13</td>
            <td>93.69</td>
            <td>93.63</td>
            <td>89.66</td>
        </tr>
        <tr align="center">
            <td align="left">viso-twhin-bert-large</td>
            <td><b>83.87</td>
            <td><b>73.45</td>
            <td><b>73.14</td>
            <td><b>70.99</td>
            <td><b>88.86</td>
            <td><b>88.8</td>
            <td><b>70.81</td>
            <td><b>91.6</td>
            <td><b>91.47</td>
            <td><b>79.07</td>
            <td><b>94.08</td>
            <td><b>93.96</td>
            <td><b>90.22</td>
        </tr>
    </div>
</table>

## Usage (HuggingFace Transformers)

Install `transformers` package:
    
    pip install transformers

Then you can use this model for fill-mask task like this:

```python
from transformers import pipeline

model_path = "5CD-AI/viso-twhin-bert-large"
mask_filler = pipeline("fill-mask", model_path)

mask_filler("đúng nhận sai <mask>", top_k=10)
```

## Fine-tune Configuration
We fine-tune `5CD-AI/viso-twhin-bert-large` on 4 downstream tasks with `transformer` library with the following configuration:
- train_batch_size: 16
- seed: 42
- gradient_accumulation_steps: 4
- weight_decay: 0.01
- optimizer: AdamW with betas=(0.9, 0.999) and epsilon=1e-08
- lr_scheduler_type: cosine
- training_epochs: 30
- model_max_length: 128
- metric_for_best_model: wf1
- strategy: epoch
  
And different additional configurations for each task:
| Emotion Recognition                                                               | Hate Speech Detection                                                             | Spam Reviews Detection                                                            | Hate Speech Spans Detection                                                       |
| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
|\- learning_rate: 1e-5| \- learning_rate: 5e-6 | \- learning_rate: 1e-5 | \- learning_rate: 5e-6 |