aiola commited on
Commit
11c8191
1 Parent(s): ab48119

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +46 -2
README.md CHANGED
@@ -19,10 +19,54 @@ datasets:
19
 
20
  ## Model description
21
 
22
- A multi-task model for named-entity recognition, relation extraction, entity mention detection and coreference resolution.
23
 
24
- We model NER as a span classification task, and relation extraction as a multi-label classification of (NER) span tuples.
25
  Similarly, model EMD as a span classification task and CR as a binary classification of (EMD) span tuples.
26
  To construct the CR clusters, we keep the top antecedent of each mention, then compute the connected components of the mentions' undirected graph.
27
 
 
 
 
 
 
 
28
  See additional details and usage examples at: https://github.com/aiola-lab/corener.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  ## Model description
21
 
22
+ A multi-task model for named-entity recognition, relation extraction, entity mention detection, and coreference resolution.
23
 
24
+ We model NER as a span classification task and relation extraction as a multi-label classification of (NER) span tuples.
25
  Similarly, model EMD as a span classification task and CR as a binary classification of (EMD) span tuples.
26
  To construct the CR clusters, we keep the top antecedent of each mention, then compute the connected components of the mentions' undirected graph.
27
 
28
+ The model was trained to recognize:
29
+ - Entity types: GPE, ORG, PERSON, DATE, NORP, CARDINAL, MONEY, PERCENT, WORK_OF_ART, ORDINAL, EVENT, LOC, TIME, FAC, QUANTITY, LAW, PRODUCT, LANGUAGE.
30
+ - Relation types: Kill, Live_In, Located_In, OrgBased_In, Work_For.
31
+
32
+ ## Usage example
33
+
34
  See additional details and usage examples at: https://github.com/aiola-lab/corener.
35
+
36
+ ```python
37
+ import json
38
+
39
+ from transformers import AutoTokenizer
40
+ from corener.models import Corener, ModelOutput
41
+ from corener.data import MTLDataset
42
+ from corener.utils.prediction import convert_model_output
43
+
44
+
45
+ tokenizer = AutoTokenizer.from_pretrained("aiola/roberta-base-corener")
46
+ model = Corener.from_pretrained("aiola/roberta-base-corener")
47
+ model.eval()
48
+
49
+ examples = [
50
+ "Apple Park is the corporate headquarters of Apple Inc., located in Cupertino, California, United States. It was opened to employees in April 2017, while construction was still underway, and superseded the original headquarters at 1 Infinite Loop, which opened in 1993."
51
+ ]
52
+
53
+ dataset = MTLDataset(
54
+ types=model.config.types,
55
+ tokenizer=tokenizer,
56
+ train_mode=False,
57
+ )
58
+ dataset.read_dataset(examples)
59
+ example = dataset.get_example(0) # get first example
60
+
61
+ output: ModelOutput = model(
62
+ input_ids=example.encodings,
63
+ context_masks=example.context_masks,
64
+ entity_masks=example.entity_masks,
65
+ entity_sizes=example.entity_sizes,
66
+ entity_spans=example.entity_spans,
67
+ entity_sample_masks=example.entity_sample_masks,
68
+ inference=True,
69
+ )
70
+
71
+ print(json.dumps(convert_model_output(output=output, batch=example, dataset=dataset), indent=2))
72
+ ```