wenge-research
commited on
Commit
•
22273e9
1
Parent(s):
30c3214
Update README.md
Browse files
README.md
CHANGED
@@ -4,23 +4,28 @@ license: apache-2.0
|
|
4 |
---
|
5 |
license: apache-2.0
|
6 |
---
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
<div align="center">
|
10 |
<img src="./assets/yayi_dark_small.png" alt="YaYi" style="width: 30%; display: block; margin: auto;">
|
11 |
<br>
|
12 |
|
13 |
-
[[🤗
|
14 |
[[🔗网页端](https://yayi.wenge.com)]
|
15 |
|
16 |
</div>
|
17 |
|
18 |
-
|
19 |
## 介绍/Introduction
|
20 |
雅意信息抽取统一大模型 (YAYI-UIE)在百万级人工构造的高质量信息抽取数据上进行指令微调,统一训练信息抽取任务包括命名实体识别(NER),关系抽取(RE)和事件抽取(EE),实现通用、安全、金融、生物、医疗、商业、
|
21 |
个人、车辆、电影、工业、餐厅、科学等场景下结构化抽取。
|
22 |
|
23 |
-
通过雅意IE
|
24 |
|
25 |
模型下载地址是 https://huggingface.co/wenge-research/yayi-uie
|
26 |
|
@@ -28,7 +33,7 @@ The YAYI Unified Information Extraction Large Language Model (YAYI UIE), fine-tu
|
|
28 |
Recognition (NER), Relation Extraction (RE), and Event Extraction (EE). The model is able to extract structured outputs across diverse fields including general, security,
|
29 |
finance, biology, medicine, business, personal, automotive, film, industry, restaurant, and science.
|
30 |
|
31 |
-
The open-source of YAYI-UIE aims to foster the growth of the Chinese PLM open-source community. We can't wait to collaborate with our partners to develop the YAYI Large Models ecosystem!
|
32 |
|
33 |
![instruction](./assets/YAYI-UIE-1.png)
|
34 |
|
@@ -36,18 +41,18 @@ The downloand link is https://huggingface.co/wenge-research/yayi-uie
|
|
36 |
|
37 |
#### 模型推理/Model Inference
|
38 |
```python
|
39 |
-
import torch
|
40 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
41 |
-
from transformers.generation.utils import GenerationConfig
|
42 |
-
tokenizer = AutoTokenizer.from_pretrained("wenge-research/yayi-uie", use_fast=False, trust_remote_code=True)
|
43 |
-
model = AutoModelForCausalLM.from_pretrained("wenge-research/yayi-uie", device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True)
|
44 |
-
generation_config = GenerationConfig.from_pretrained("wenge-research/yayi-uie")
|
45 |
-
prompt = "文本:氧化锆陶瓷以其卓越的物理和化学特性在多个行业中发挥着关键作用。这种材料因其高强度、高硬度和优异的耐磨性,广泛应用于医疗器械、切削工具、磨具以及高端珠宝制品。在制造这种高性能陶瓷时,必须遵循严格的制造标准,以确保其最终性能。这些标准涵盖了从原材料选择到成品加工的全过程,保障产品的一致性和可靠性。氧化锆的制造过程通常包括粉末合成、成型、烧结和后处理等步骤。原材料通常是高纯度的氧化锆粉末,通过精确控制的烧结工艺,这些粉末被转化成具有特定微观结构的坚硬陶瓷。这种独特的微观结构赋予氧化锆陶瓷其显著的抗断裂韧性和耐腐蚀性。此外,氧化锆陶瓷的热膨胀系数与铁类似,使其在高温应用中展现出良好的热稳定性。因此,氧化锆陶瓷不仅在工业领域,也在日常生活中的应用日益增多,成为现代材料科学中的一个重要分支。\n抽取文本中可能存在的实体,并以json{制造品名称/制造过程/制造材料/工艺参数/应用/生物医学/工程特性:[实体]}格式输出。"
|
46 |
-
# "<reserved_13>" is a reserved token for human, "<reserved_14>" is a reserved token for assistant
|
47 |
-
prompt = "<reserved_13>" + prompt + "<reserved_14>"
|
48 |
-
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
49 |
-
response = model.generate(**inputs, max_new_tokens=512, temperature=0)
|
50 |
-
print(tokenizer.decode(response[0],skip_special_tokens=True))
|
51 |
```
|
52 |
|
53 |
#### 指令样例/Sample Prompts
|
@@ -86,7 +91,7 @@ AI,Literature,Music,Politics,Science为英文数据集,boson,clue,
|
|
86 |
|
87 |
AI,Literature,Music,Politics and Science are English datasets; boson,clue and weibo are Chinese datasets
|
88 |
|
89 |
-
| Model | AI | Literature | Music | Politics | Science | EN Average | boson | clue | weibo | ZH Average |
|
90 |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ |
|
91 |
| davinci | 2.97 | 9.87 | 13.83 | 18.42 | 10.04 | 11.03 | - | - | - | 31.09 |
|
92 |
| ChatGPT 3.5 | **54.4** | **54.07** | **61.24** | **59.12** | **63** | **58.37** | 38.53 | 25.44 | 29.3 |
|
@@ -102,7 +107,7 @@ FewRe,Wiki-ZSL为英文数据集, SKE 2020,COAE2016,IPRE为中文数据
|
|
102 |
|
103 |
FewRe and Wiki-ZSL are English datasets; SKE 2020, COAE2016 and IPRE are Chinese datasets
|
104 |
|
105 |
-
| Model | FewRel | Wiki-ZSL | EN Average | SKE 2020 | COAE2016 | IPRE | ZH Average |
|
106 |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ |
|
107 |
| ChatGPT 3.5 | 9.96 | 13.14 | 11.55 24.47 | 19.31 | 6.73 | 16.84 |
|
108 |
| ZETT(T5-small) | 30.53 | 31.74 | 31.14 | - | - | - | - |
|
@@ -119,7 +124,7 @@ commodity news is a English dataset, FewFC and ccf_law are Chinese datasets
|
|
119 |
|
120 |
EET(事件类型判别 Event Type Extraction)
|
121 |
|
122 |
-
| 模型 | commodity news | FewFC | ccf_law |
|
123 |
| ------ | ------ | ------ | ------ | ------ |
|
124 |
| ChatGPT 3.5 | 1.41 | 16.15 | 0 | 8.08 |
|
125 |
| UIE | - | 50.23 | 2.16 | 26.20 |
|
@@ -128,7 +133,7 @@ EET(事件类型判别 Event Type Extraction)
|
|
128 |
|
129 |
EEA(事件论元抽取 Event Arguments Extraction)
|
130 |
|
131 |
-
| 模型 | commodity news | FewFC | ccf_law |
|
132 |
| ------ | ------ | ------ | ------ | ------ |
|
133 |
| ChatGPT 3.5 | 8.6 | 44.4 | 44.57 | 44.49 |
|
134 |
| UIE | - | 43.02 | **60.85** | 51.94 |
|
@@ -137,7 +142,6 @@ EEA(事件论元抽取 Event Arguments Extraction)
|
|
137 |
|
138 |
The chart illustrates the performance of our model on Chinese IE tasks in zero-shot setting.
|
139 |
|
140 |
-
|
141 |
![零样本推理性能分布](./assets/zh-0shot.png)
|
142 |
|
143 |
## 相关协议/Terms and Conditions
|
@@ -169,3 +173,19 @@ by the YAYI UIE, and avoid distributing harmful content on the internet. The spr
|
|
169 |
|
170 |
This project is intended only for research purposes. The project developers are not liable for any harm or loss resulting from the use of this project, including but not
|
171 |
limited to data, models, and code. For more details, please refer to the disclaimer.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
---
|
5 |
license: apache-2.0
|
6 |
---
|
7 |
+
|
8 |
+
<div align="center">
|
9 |
+
<h1>
|
10 |
+
雅意IE大模型/YAYI UIE
|
11 |
+
</h1>
|
12 |
+
<!-- <br> -->
|
13 |
+
</div>
|
14 |
|
15 |
<div align="center">
|
16 |
<img src="./assets/yayi_dark_small.png" alt="YaYi" style="width: 30%; display: block; margin: auto;">
|
17 |
<br>
|
18 |
|
19 |
+
[[🤗Github Repo](https://github.com/wenge-research)]
|
20 |
[[🔗网页端](https://yayi.wenge.com)]
|
21 |
|
22 |
</div>
|
23 |
|
|
|
24 |
## 介绍/Introduction
|
25 |
雅意信息抽取统一大模型 (YAYI-UIE)在百万级人工构造的高质量信息抽取数据上进行指令微调,统一训练信息抽取任务包括命名实体识别(NER),关系抽取(RE)和事件抽取(EE),实现通用、安全、金融、生物、医疗、商业、
|
26 |
个人、车辆、电影、工业、餐厅、科学等场景下结构化抽取。
|
27 |
|
28 |
+
通过雅意IE大模型的开源为促进中文预训练大模型开源社区的发展,贡献自己的一份力量,通过开源,与每一位合作伙伴共建雅意大模型生态。如果您想了解更多关于 YAYI UIE 模型的细节,我们建议您参阅 [GitHub](https://github.com/wenge-research/yayi_uie) 仓库。更多技术细节,敬请期待我们的技术报告🔥。
|
29 |
|
30 |
模型下载地址是 https://huggingface.co/wenge-research/yayi-uie
|
31 |
|
|
|
33 |
Recognition (NER), Relation Extraction (RE), and Event Extraction (EE). The model is able to extract structured outputs across diverse fields including general, security,
|
34 |
finance, biology, medicine, business, personal, automotive, film, industry, restaurant, and science.
|
35 |
|
36 |
+
The open-source of YAYI-UIE aims to foster the growth of the Chinese PLM open-source community. We can't wait to collaborate with our partners to develop the YAYI Large Models ecosystem! For more details about the YAYI UIE, please refer to our [GitHub](https://github.com/wenge-research/yayi_uie) repository. Stay tuned for more technical details in our upcoming technical report! �
|
37 |
|
38 |
![instruction](./assets/YAYI-UIE-1.png)
|
39 |
|
|
|
41 |
|
42 |
#### 模型推理/Model Inference
|
43 |
```python
|
44 |
+
>>> import torch
|
45 |
+
>>> from transformers import AutoModelForCausalLM, AutoTokenizer
|
46 |
+
>>> from transformers.generation.utils import GenerationConfig
|
47 |
+
>>> tokenizer = AutoTokenizer.from_pretrained("wenge-research/yayi-uie", use_fast=False, trust_remote_code=True)
|
48 |
+
>>> model = AutoModelForCausalLM.from_pretrained("wenge-research/yayi-uie", device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True)
|
49 |
+
>>> generation_config = GenerationConfig.from_pretrained("wenge-research/yayi-uie")
|
50 |
+
>>> prompt = "文本:氧化锆陶瓷以其卓越的物理和化学特性在多个行业中发挥着关键作用。这种材料因其高强度、高硬度和优异的耐磨性,广泛应用于医疗器械、切削工具、磨具以及高端珠宝制品。在制造这种高性能陶瓷时,必须遵循严格的制造标准,以确保其最终性能。这些标准涵盖了从原材料选择到成品加工的全过程,保障产品的一致性和可靠性。氧化锆的制造过程通常包括粉末合成、成型、烧结和后处理等步骤。原材料通常是高纯度的氧化锆粉末,通过精确控制的烧结工艺,这些粉末被转化成具有特定微观结构的坚硬陶瓷。这种独特的微观结构赋予氧化锆陶瓷其显著的抗断裂韧性和耐腐蚀性。此外,氧化锆陶瓷的热膨胀系数与铁类似,使其在高温应用中展现出良好的热稳定性。因此,氧化锆陶瓷不仅在工业领域,也在日常生活中的应用日益增多,成为现代材料科学中的一个重要分支。\n抽取文本中可能存在的实体,并以json{制造品名称/制造过程/制造材料/工艺参数/应用/生物医学/工程特性:[实体]}格式输出。"
|
51 |
+
>>> # "<reserved_13>" is a reserved token for human, "<reserved_14>" is a reserved token for assistant
|
52 |
+
>>> prompt = "<reserved_13>" + prompt + "<reserved_14>"
|
53 |
+
>>> inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
54 |
+
>>> response = model.generate(**inputs, max_new_tokens=512, temperature=0)
|
55 |
+
>>> print(tokenizer.decode(response[0],skip_special_tokens=True))
|
56 |
```
|
57 |
|
58 |
#### 指令样例/Sample Prompts
|
|
|
91 |
|
92 |
AI,Literature,Music,Politics and Science are English datasets; boson,clue and weibo are Chinese datasets
|
93 |
|
94 |
+
| Model | AI | Literature | Music | Politics | Science | **EN** Average | boson | clue | weibo | **ZH** Average |
|
95 |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ |
|
96 |
| davinci | 2.97 | 9.87 | 13.83 | 18.42 | 10.04 | 11.03 | - | - | - | 31.09 |
|
97 |
| ChatGPT 3.5 | **54.4** | **54.07** | **61.24** | **59.12** | **63** | **58.37** | 38.53 | 25.44 | 29.3 |
|
|
|
107 |
|
108 |
FewRe and Wiki-ZSL are English datasets; SKE 2020, COAE2016 and IPRE are Chinese datasets
|
109 |
|
110 |
+
| Model | FewRel | Wiki-ZSL | **EN** Average | SKE 2020 | COAE2016 | IPRE | **ZH** Average |
|
111 |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ |
|
112 |
| ChatGPT 3.5 | 9.96 | 13.14 | 11.55 24.47 | 19.31 | 6.73 | 16.84 |
|
113 |
| ZETT(T5-small) | 30.53 | 31.74 | 31.14 | - | - | - | - |
|
|
|
124 |
|
125 |
EET(事件类型判别 Event Type Extraction)
|
126 |
|
127 |
+
| 模型 | commodity news | FewFC | ccf_law | **ZH** Average |
|
128 |
| ------ | ------ | ------ | ------ | ------ |
|
129 |
| ChatGPT 3.5 | 1.41 | 16.15 | 0 | 8.08 |
|
130 |
| UIE | - | 50.23 | 2.16 | 26.20 |
|
|
|
133 |
|
134 |
EEA(事件论元抽取 Event Arguments Extraction)
|
135 |
|
136 |
+
| 模型 | commodity news | FewFC | ccf_law | **ZH** Average |
|
137 |
| ------ | ------ | ------ | ------ | ------ |
|
138 |
| ChatGPT 3.5 | 8.6 | 44.4 | 44.57 | 44.49 |
|
139 |
| UIE | - | 43.02 | **60.85** | 51.94 |
|
|
|
142 |
|
143 |
The chart illustrates the performance of our model on Chinese IE tasks in zero-shot setting.
|
144 |
|
|
|
145 |
![零样本推理性能分布](./assets/zh-0shot.png)
|
146 |
|
147 |
## 相关协议/Terms and Conditions
|
|
|
173 |
|
174 |
This project is intended only for research purposes. The project developers are not liable for any harm or loss resulting from the use of this project, including but not
|
175 |
limited to data, models, and code. For more details, please refer to the disclaimer.
|
176 |
+
|
177 |
+
## 引用/Citation
|
178 |
+
|
179 |
+
如果您在工作中使用了我们的模型,请引用我们的论文:
|
180 |
+
|
181 |
+
If you are using the resource for your work, please cite our paper.
|
182 |
+
|
183 |
+
```
|
184 |
+
@article{YAYI-UIE,
|
185 |
+
author = {Xinglin Xiao, Yijie Wang, Nan Xu, Yuqi Wang, Hanxuan Yang, Minzheng Wang, Yin Luo, Lei Wang, Wenji Mao, Dajun Zeng}},
|
186 |
+
title = {YAYI-UIE: A Chat-Enhanced Instruction Tuning Framework for Universal Information Extraction},
|
187 |
+
journal = {arXiv preprint arXiv},
|
188 |
+
year = {2023}
|
189 |
+
}
|
190 |
+
```
|
191 |
+
|