File size: 1,380 Bytes
e465221
 
 
51f73a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: apache-2.0
---


## 介绍

> 基于macbert对mask language model微调,进行错字修改。

这个是在[shibing624/macbert4csc-base-chinese](https://huggingface.co/shibing624/macbert4csc-base-chinese/tree/main)的基础上进行修改,
其对应的 [源码位置](https://github.com/shibing624/pycorrector/tree/master/pycorrector/macbert)。

## 使用

可参考[shibing624/macbert4csc-base-chinese](https://huggingface.co/shibing624/macbert4csc-base-chinese)。

## 改动

主要改动两个地方:
1. MLM和错字检测二分类超参改成0.9和0.1(当然不一定是最优参数)。
2. 对错字检测二分类引入一个ScalarMix layer,原代码使用hidden_states最后一层,个人觉得稍微有点深以及学习起来可能更复杂。

## 思考

整体下来错字检测二分类对整体模型效果影响并没有很突出,以及整体模型效果并没有超出原作者多少,所以上传这个代码以及模型更多是为了学习记录与思考。
其以[pycorrector eval.py](https://github.com/shibing624/pycorrector/blob/master/pycorrector/utils/eval.py)跑出来的结果如下:

corpus数据集:
```
Sentence Level: acc:0.7200, precision:0.8804, recall:0.6154, f1:0.7244, cost time:5.67 s
```

sighan2015数据集:
```
Sentence Level: acc:0.7973, precision:0.8265, recall:0.7459, f1:0.7841, cost time:11.19 s
```