Instructions to use x180/macbert4csc-scalarmix-base-chinese with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use x180/macbert4csc-scalarmix-base-chinese with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="x180/macbert4csc-scalarmix-base-chinese")# Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("x180/macbert4csc-scalarmix-base-chinese") model = AutoModelForMaskedLM.from_pretrained("x180/macbert4csc-scalarmix-base-chinese") - Notebooks
- Google Colab
- Kaggle
介绍
基于macbert对mask language model微调,进行错字修改。
这个是在shibing624/macbert4csc-base-chinese的基础上进行修改, 其对应的 源码位置。
使用
可参考shibing624/macbert4csc-base-chinese。
改动
主要改动两个地方:
- MLM和错字检测二分类超参改成0.9和0.1(当然不一定是最优参数)。
- 对错字检测二分类引入一个ScalarMix layer,原代码使用hidden_states最后一层,个人觉得稍微有点深以及学习起来可能更复杂。
思考
整体下来错字检测二分类对整体模型效果影响并没有很突出,以及整体模型效果并没有超出原作者多少,所以上传这个代码以及模型更多是为了学习记录与思考。 其以pycorrector 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
- Downloads last month
- 10