model documentation
Browse files
README.md
CHANGED
@@ -1,12 +1,114 @@
|
|
1 |
---
|
|
|
2 |
language:
|
3 |
- zh
|
4 |
-
license: "apache-2.0"
|
5 |
---
|
6 |
|
7 |
-
## Chinese MRC roberta_wwm_ext_large
|
8 |
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
* 此库发布的再训练模型,在 阅读理解/分类 等任务上均有大幅提高<br/>
|
11 |
(已有多位小伙伴在Dureader-2021等多个比赛中取得**top5**的成绩😁)
|
12 |
|
@@ -19,4 +121,97 @@ license: "apache-2.0"
|
|
19 |
| macbert-large (ours) | 70.45 / **68.13**| **83.4** |
|
20 |
| roberta-wwm-ext-large (ours) | 68.91 / 66.91 | 83.1 |
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
license: apache-2.0
|
3 |
language:
|
4 |
- zh
|
|
|
5 |
---
|
6 |
|
|
|
7 |
|
8 |
+
|
9 |
+
# Model Card for Chinese MRC roberta_wwm_ext_large
|
10 |
+
|
11 |
+
# Model Details
|
12 |
+
|
13 |
+
## Model Description
|
14 |
+
|
15 |
+
使用大量中文MRC数据训练的roberta_wwm_ext_large模型,[详情可查看](https://github.com/basketballandlearn/MRC_Competition_Dureader)
|
16 |
+
|
17 |
+
- **Developed by:** luhua-rain
|
18 |
+
- **Shared by [Optional]:** luhua-rain
|
19 |
+
- **Model type:** Question Answering
|
20 |
+
- **Language(s) (NLP):** Chinese
|
21 |
+
- **License:** Apache 2.0
|
22 |
+
- **Parent Model:** BERT
|
23 |
+
- **Resources for more information:**
|
24 |
+
- [GitHub Repo](https://github.com/basketballandlearn/MRC_Competition_Dureader)
|
25 |
+
|
26 |
+
|
27 |
+
|
28 |
+
# Uses
|
29 |
+
|
30 |
+
|
31 |
+
## Direct Use
|
32 |
+
The model authors also note in the [GitHub Repo](https://github.com/basketballandlearn/MRC_Competition_Dureader)
|
33 |
+
> 此mrc模型可直接用于open domain,点击体验
|
34 |
+
|
35 |
+
## Downstream Use [Optional]
|
36 |
+
|
37 |
+
The model authors also note in the [GitHub Repo](https://github.com/basketballandlearn/MRC_Competition_Dureader)
|
38 |
+
> 将此模型放到下游 MRC/分类 任务微调可比直接使用预训练语言模型提高2个点/1个点以上
|
39 |
+
|
40 |
+
## Out-of-Scope Use
|
41 |
+
|
42 |
+
The model should not be used to intentionally create hostile or alienating environments for people.
|
43 |
+
|
44 |
+
# Bias, Risks, and Limitations
|
45 |
+
|
46 |
+
|
47 |
+
Significant research has explored bias and fairness issues with language models (see, e.g., [Sheng et al. (2021)](https://aclanthology.org/2021.acl-long.330.pdf) and [Bender et al. (2021)](https://dl.acm.org/doi/pdf/10.1145/3442188.3445922)). Predictions generated by the model may include disturbing and harmful stereotypes across protected classes; identity characteristics; and sensitive, social, and occupational groups.
|
48 |
+
|
49 |
+
|
50 |
+
|
51 |
+
## Recommendations
|
52 |
+
|
53 |
+
|
54 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
55 |
+
|
56 |
+
|
57 |
+
# Training Details
|
58 |
+
|
59 |
+
## Training Data
|
60 |
+
|
61 |
+
The model authors also note in the [GitHub Repo](https://github.com/basketballandlearn/MRC_Competition_Dureader)
|
62 |
+
> 网上收集的大量中文MRC数据 (其中包括公开的MRC数据集以及自己爬取的网页数据等, 囊括了医疗、教育、娱乐、百科、军事、法律、等领域。)
|
63 |
+
|
64 |
+
## Training Procedure
|
65 |
+
|
66 |
+
|
67 |
+
### Preprocessing
|
68 |
+
The model authors also note in the [GitHub Repo](https://github.com/basketballandlearn/MRC_Competition_Dureader):
|
69 |
+
>**清洗**
|
70 |
+
舍弃:context>1024的舍弃、question>64的舍弃、网页标签占比超过30%的舍弃。
|
71 |
+
重新标注:若answer>64且不完全出现在文档中,则采用模糊匹配: 计算所有片段与answer的相似度(F1值),取相似度最高的且高于阈值(0.8)
|
72 |
+
**数据标注**
|
73 |
+
收集的数据有一部分是不包含的位置标签的,仅仅是(问题-文章-答案)的三元组形式。 所以,对于只有答案而没有位置标签的数据通过正则匹配进行位置标注:
|
74 |
+
若答案片段多次出现在文章中,选择上下文与问题最相似的答案片段作为标准答案(使用F1值计算相似度,答案片段的上文48和下文48个字符作为上下文);
|
75 |
+
若答案片段只出现一次,则默认该答案为标准答案。
|
76 |
+
采用滑动窗口将长文档切分为多个重叠的子文档,故一个文档可能会生成多个有答案的子文档。
|
77 |
+
**无答案数据构造**
|
78 |
+
在跨领域数据上训练可以增加数据的领域多样性,进而提高模型的泛化能力,而负样本的引入恰好能使得模型编码尽可能多的数据,加强模型对难样本的识别能力:
|
79 |
+
1.) 对于每一个问题,随机从数据中捞取context,并保留对应的title作为负样本;(50%)
|
80 |
+
2.) 对于每一个问题,将其正样本中答案出现的句子删除,以此作为负样本;(20%)
|
81 |
+
3.) 对于每一个问题,使用BM25算法召回得分最高的前十个文档,然后根据得分采样出一个context作为负样本, 对于非实体类答案,剔除得分最高的context(30%)
|
82 |
+
|
83 |
+
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
|
88 |
+
### Speeds, Sizes, Times
|
89 |
+
More information needed
|
90 |
+
|
91 |
+
|
92 |
+
# Evaluation
|
93 |
+
|
94 |
+
|
95 |
+
## Testing Data, Factors & Metrics
|
96 |
+
|
97 |
+
### Testing Data
|
98 |
+
|
99 |
+
More information needed
|
100 |
+
|
101 |
+
|
102 |
+
### Factors
|
103 |
+
More information needed
|
104 |
+
|
105 |
+
### Metrics
|
106 |
+
|
107 |
+
More information needed
|
108 |
+
|
109 |
+
|
110 |
+
## Results
|
111 |
+
|
112 |
* 此库发布的再训练模型,在 阅读理解/分类 等任务上均有大幅提高<br/>
|
113 |
(已有多位小伙伴在Dureader-2021等多个比赛中取得**top5**的成绩😁)
|
114 |
|
|
|
121 |
| macbert-large (ours) | 70.45 / **68.13**| **83.4** |
|
122 |
| roberta-wwm-ext-large (ours) | 68.91 / 66.91 | 83.1 |
|
123 |
|
124 |
+
| 68.91 / 66.91 | 83.1 |
|
125 |
+
|
126 |
+
|
127 |
+
|
128 |
+
|
129 |
+
|
130 |
+
# Model Examination
|
131 |
+
|
132 |
+
More information needed
|
133 |
+
|
134 |
+
# Environmental Impact
|
135 |
+
|
136 |
+
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
137 |
+
|
138 |
+
- **Hardware Type:** More information needed
|
139 |
+
- **Hours used:** More information needed
|
140 |
+
- **Cloud Provider:** More information needed
|
141 |
+
- **Compute Region:** More information needed
|
142 |
+
- **Carbon Emitted:** More information needed
|
143 |
+
|
144 |
+
# Technical Specifications [optional]
|
145 |
+
|
146 |
+
## Model Architecture and Objective
|
147 |
+
|
148 |
+
More information needed
|
149 |
+
|
150 |
+
## Compute Infrastructure
|
151 |
+
|
152 |
+
More information needed
|
153 |
+
|
154 |
+
### Hardware
|
155 |
+
|
156 |
+
|
157 |
+
More information needed
|
158 |
+
|
159 |
+
### Software
|
160 |
+
|
161 |
+
More information needed.
|
162 |
+
|
163 |
+
# Citation
|
164 |
+
|
165 |
+
|
166 |
+
**BibTeX:**
|
167 |
+
|
168 |
+
|
169 |
+
More information needed
|
170 |
+
|
171 |
+
|
172 |
+
|
173 |
+
|
174 |
+
# Glossary [optional]
|
175 |
+
More information needed
|
176 |
+
|
177 |
+
# More Information [optional]
|
178 |
+
The model authors also note in the [GitHub Repo](https://github.com/basketballandlearn/MRC_Competition_Dureader)
|
179 |
+
> 代码上传前已经跑通。文件不多,所以如果碰到报错之类的信息,可能是代码路径不对、缺少安装包等问题,一步步解决,可以提issue
|
180 |
+
环境
|
181 |
+
|
182 |
+
|
183 |
+
|
184 |
+
# Model Card Authors [optional]
|
185 |
+
|
186 |
+
Luhua-rain in collaboration with Ezi Ozoani and the Hugging Face team
|
187 |
+
|
188 |
+
|
189 |
+
# Model Card Contact
|
190 |
+
|
191 |
+
The model authors also note in the [GitHub Repo](https://github.com/basketballandlearn/MRC_Competition_Dureader)
|
192 |
+
> 合作
|
193 |
+
相关训练数据以及使用更多数据训练的模型/一起打比赛 可邮箱联系(luhua98@foxmail.com)~
|
194 |
+
|
195 |
+
|
196 |
+
# How to Get Started with the Model
|
197 |
+
|
198 |
+
Use the code below to get started with the model.
|
199 |
+
|
200 |
+
<details>
|
201 |
+
<summary> Click to expand </summary>
|
202 |
+
|
203 |
+
```python
|
204 |
+
----- 使用方法 -----
|
205 |
+
from transformers import AutoTokenizer, AutoModelForQuestionAnswering
|
206 |
+
|
207 |
+
model_name = "chinese_pretrain_mrc_roberta_wwm_ext_large" # "chinese_pretrain_mrc_macbert_large"
|
208 |
+
|
209 |
+
# Use in Transformers
|
210 |
+
tokenizer = AutoTokenizer.from_pretrained(f"luhua/{model_name}")
|
211 |
+
model = AutoModelForQuestionAnswering.from_pretrained(f"luhua/{model_name}")
|
212 |
|
213 |
+
# Use locally(通过 https://huggingface.co/luhua 下载模型及配置文件)
|
214 |
+
tokenizer = BertTokenizer.from_pretrained(f'./{model_name}')
|
215 |
+
model = AutoModelForQuestionAnswering.from_pretrained(f'./{model_name}')
|
216 |
+
```
|
217 |
+
</details>
|