@@ -20,35 +20,27 @@ Best acc on val set: 0.986000
20
20
100%|██████████████████████████████████████████████████████████████████████████████████| 16/16 [ 00:06<00:00, 2.64it/s, acc=0.986]
21
21
Accuracy on test set: 0.986
22
22
## 测试结果
23
- > > > model.infer({'text': '场照片事后将发给媒体,避免采访时出现混乱,[ 3] 举行婚礼侯佩岑黄伯俊婚纱照2011年4月17日下午2点,70名亲友见 证下,侯佩', 'h': {'pos': (28, 30)}, 't': {'pos': (31, 33)}})
23
+ model.infer({'text': '场照片事后将发给媒体,避免采访时出现混乱,[ 3] 举行婚礼侯佩岑黄伯俊婚纱照2011年4月17日下午2点,70名亲友见 证下,侯佩', 'h': {'pos': (28, 30)}, 't': {'pos': (31, 33)}})
24
24
('夫妻', 0.9995878338813782)
25
- > > >
26
- > > > model.infer({'text': '及他们的女儿小苹果与汪峰感情纠葛2004年,葛荟婕在欧洲杯期间录制节目时与汪峰相识并相恋,汪峰那首《我如此爱你', 'h': {'pos': (10, 11)}, 't': {'pos': (22, 24)}})
25
+
26
+ model.infer({'text': '及他们的女儿小苹果与汪峰感情纠葛2004年,葛荟婕在欧洲杯期间录制节目时与汪峰相识并相恋,汪峰那首《我如此爱你', 'h': {'pos': (10, 11)}, 't': {'pos': (22, 24)}})
27
27
('情侣', 0.9992896318435669)
28
- > > >
29
- > > > model.infer({'text': '14日,彭加木的侄女彭丹凝打通了彭加木儿子彭海的电话,“堂哥已经知道了,他说这些年传得太多,他不相信是真的', 'h': {'pos': (4, 6)}, 't': {'pos': (22, 21)}})
28
+
29
+ model.infer({'text': '14日,彭加木的侄女彭丹凝打通了彭加木儿子彭海的电话,“堂哥已经知道了,他说这些年传得太多,他不相信是真的', 'h': {'pos': (4, 6)}, 't': {'pos': (22, 21)}})
30
30
('父母', 0.8954808712005615)
31
- >>>
32
- >>> model.infer({'text': '名旦吴菱仙是位列“同治十三绝”的名旦时小福的弟子,算得梅兰芳的开蒙老师,早年曾搭过梅巧玲的四喜班,旧谊', 'h': {'pos': (2, 4)}, 't': {'pos': (27, 29)}})
33
- ('师生', 0.996309220790863)
34
31
35
- # 使用前准备
36
- 1.bert模型下载:在./pretrain/下面放置chinese_wwm_pytorch模型,下载地址:https://github.com/ymcui/Chinese-BERT-wwm
32
+ model.infer({'text': '名旦吴菱仙是位列“同治十三绝”的名旦时小福的弟子,算得梅兰芳的开蒙老师,早年曾搭过梅巧玲的四喜班,旧谊', 'h': {'pos': (2, 4)}, 't': {'pos': (27, 29)}})
33
+ ('师生', 0.996309220790863)
34
+ # 使用方式
35
+ 1.bert模型下载:在./pretrain/下面放置chinese_wwm_pytorch模型
37
36
2.数据下载:在./benchmark/people-relation/下执行gen.py,生产中文人物关系数据,具体脚本中有说明。
38
37
3.配置环境变量:vim ~ /.bash_profile 添加
39
38
# openNRE
40
39
export openNRE=项目位置
41
-
42
-
43
- # 注意事项
44
- 如果自己训练了tensorflow 的bert,可以通过https://github.com/huggingface/transformers 里面的convert_bert_original_tf_checkpoint_to_pytorch.py 脚本转换为pytorch版。
45
- 踩坑:
46
- 1.安装tensorflow 2.0,最终用的都是PyTorch模型,但TensorFlow也得安装
47
- 2.构造checkpoint文件
48
- 3.报错:Embedding' object has no attribute 'shape' ,解决:将报错位置assert那几行直接删除
49
-
50
40
51
41
42
+ -----
43
+ 以下是原工程内容
52
44
# OpenNRE
53
45
54
46
OpenNRE is an open-source and extensible toolkit that provides a unified framework to implement relation extraction models. This package is designed for the following groups:
0 commit comments