File size: 1,180 Bytes
e91e11a
0a98a5f
2f5f670
0a98a5f
2f5f670
0a98a5f
2f5f670
0a98a5f
e91e11a
0a98a5f
e91e11a
0a98a5f
2f5f670
 
b4ec441
9ed0e00
6c542ff
2f5f670
b4ec441
2f5f670
 
 
 
 
 
 
 
 
9ed0e00
6c542ff
9ed0e00
6c542ff
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
rebel-base-chinese-cndbpedia is a generation-based relation extraction model

  ·a SOTA chinese end-to-end relation extraction model,using bart as backbone.
  
  ·using the training method of <REBEL:Relation Extraction By End-to-end Language generation>(EMNLP Findings 2021).
  
  ·using the Distant-supervised data from cndbpedia,pretrained from the checkpoint of fnlp/bart-base-chinese.
  
  ·can perform SOTA in many chinese relation extraction dataset,such as lic2019,lic2020,HacRED,etc.
  
  ·easy to use,just like normal generation task.
  
  ·input is sentence,and output is linearlize triples,such as input:姚明是一名NBA篮球运动员 output:[subj]姚明[obj]NBA[rel]公司[obj]篮球运动员[rel]职业(more details can read on REBEL paper)
  
#using model:

'''
from transformers import BertTokenizer, BartForConditionalGeneration

model_name = 'fnlp/bart-base-chinese'

tokenizer_kwargs = {
    "use_fast": True,
    "additional_special_tokens": ['<rel>', '<obj>', '<subj>'],
}

tokenizer = BertTokenizer.from_pretrained(model_name, **tokenizer_kwargs)


model = BartForConditionalGeneration.from_pretrained("fanxiao/rebel-base-chinese-cndbpedia")

'''