fleonce commited on
Commit
4c555e8
1 Parent(s): 48b354c

Upload ITERForRelationExtraction

Browse files
Files changed (4) hide show
  1. README.md +104 -0
  2. config.json +78 -0
  3. generation_config.json +5 -0
  4. model.safetensors +3 -0
README.md ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model:
4
+ - KISTI-AI/Scideberta-full
5
+ library_name: transformers
6
+ tags:
7
+ - relation extraction
8
+ - nlp
9
+ model-index:
10
+ - name: iter-scierc-deberta-full
11
+ results:
12
+ - task:
13
+ type: relation-extraction
14
+ dataset:
15
+ name: scierc
16
+ type: scierc
17
+ metrics:
18
+ - name: F1
19
+ type: f1
20
+ value: 39.359
21
+ ---
22
+
23
+
24
+ # ITER: Iterative Transformer-based Entity Recognition and Relation Extraction
25
+
26
+ This model checkpoint is part of the collection of models published alongside our paper ITER,
27
+ [accepted at EMNLP 2024](https://aclanthology.org/2024.findings-emnlp.655/).<br>
28
+ To ease reproducibility and enable open research, our source code has been published on [GitHub](https://github.com/fleonce/iter).
29
+
30
+ This model achieved an F1 score of `39.359` on dataset `scierc`
31
+
32
+ ### Using ITER in your code
33
+
34
+ First, install ITER in your preferred environment:
35
+
36
+ ```text
37
+ pip install git+https://github.com/fleonce/iter
38
+ ```
39
+
40
+ To use our model, refer to the following code:
41
+ ```python
42
+ from iter import ITERForRelationExtraction
43
+
44
+ model = ITERForRelationExtraction.from_pretrained("fleonce/iter-scierc-deberta-full")
45
+ tokenizer = model.tokenizer
46
+
47
+ encodings = tokenizer(
48
+ "An art exhibit at the Hakawati Theatre in Arab east Jerusalem was a series of portraits of Palestinians killed in the rebellion .",
49
+ return_tensors="pt"
50
+ )
51
+
52
+ generation_output = model.generate(
53
+ encodings["input_ids"],
54
+ attention_mask=encodings["attention_mask"],
55
+ )
56
+
57
+ # entities
58
+ print(generation_output.entities)
59
+
60
+ # relations between entities
61
+ print(generation_output.links)
62
+ ```
63
+
64
+ ### Checkpoints
65
+
66
+ We publish checkpoints for the models performing best on the following datasets:
67
+
68
+ - **ACE05**:
69
+ 1. [fleonce/iter-ace05-deberta-large](https://huggingface.co/fleonce/iter-ace05-deberta-large)
70
+ - **CoNLL04**:
71
+ 1. [fleonce/iter-conll04-deberta-large](https://huggingface.co/fleonce/iter-conll04-deberta-large)
72
+ - **ADE**:
73
+ 1. [fleonce/iter-ade-deberta-large](https://huggingface.co/fleonce/iter-ade-deberta-large)
74
+ - **SciERC**:
75
+ 1. [fleonce/iter-scierc-deberta-large](https://huggingface.co/fleonce/iter-scierc-deberta-large)
76
+ 2. [fleonce/iter-scierc-scideberta-full](https://huggingface.co/fleonce/iter-scierc-scideberta-full)
77
+ - **CoNLL03**:
78
+ 1. [fleonce/iter-conll03-deberta-large](https://huggingface.co/fleonce/iter-conll03-deberta-large)
79
+ - **GENIA**:
80
+ 1. [fleonce/iter-genia-deberta-large](https://huggingface.co/fleonce/iter-genia-deberta-large)
81
+
82
+
83
+ ### Reproducibility
84
+
85
+ For each dataset, we selected the best performing checkpoint out of the 5 training runs we performed during training.
86
+ This model was trained with the following hyperparameters:
87
+
88
+ - Seed: `3`
89
+ - Config: `scierc/d_ff_150`
90
+ - PyTorch `2.3.0` with CUDA `12.1` and precision `torch.bfloat16`
91
+ - GPU: `1 NVIDIA GeForce RTX 4090`
92
+
93
+ Varying GPU and CUDA version as well as training precision did result in slightly different end results in our tests
94
+ for reproducibility.
95
+
96
+ To train this model, refer to the following command:
97
+ ```shell
98
+ python3 train.py --dataset scierc/d_ff_150 --transformer KISTI-AI/Scideberta-full --use_bfloat16 --seed 3
99
+ ```
100
+
101
+ ```text
102
+ @inproceedings{citation}
103
+ ```
104
+
config.json ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "models/fleonce/iter-scierc-scideberta-full",
3
+ "activation_fn": "relu",
4
+ "architectures": [
5
+ "ITERForRelationExtraction"
6
+ ],
7
+ "d_ff": 150,
8
+ "d_model": 768,
9
+ "dataset": "scierc",
10
+ "dropout": 0.3,
11
+ "entity_types": [
12
+ "Task",
13
+ "Method",
14
+ "Material",
15
+ "OtherScientificTerm",
16
+ "Metric",
17
+ "Generic"
18
+ ],
19
+ "features": 1385248,
20
+ "link_types": [
21
+ "Used-for",
22
+ "Feature-of",
23
+ "Hyponym-of",
24
+ "Evaluate-for",
25
+ "Part-of",
26
+ "Compare",
27
+ "Conjunction"
28
+ ],
29
+ "max_length": 512,
30
+ "max_nest_depth": 3,
31
+ "model_type": "iter",
32
+ "num_links": 7,
33
+ "num_types": 7,
34
+ "threshold": 0.5,
35
+ "torch_dtype": "float32",
36
+ "transformer_config": {
37
+ "_name_or_path": "KISTI-AI/Scideberta-full",
38
+ "architectures": null,
39
+ "attention_head_size": 64,
40
+ "attention_probs_dropout_prob": 0.1,
41
+ "decoder_start_token_id": null,
42
+ "eos_token_id": null,
43
+ "hidden_act": "gelu",
44
+ "hidden_dropout_prob": 0.1,
45
+ "hidden_size": 768,
46
+ "initializer_range": 0.02,
47
+ "intermediate_size": 3072,
48
+ "is_encoder_decoder": false,
49
+ "layer_norm_eps": 1e-07,
50
+ "max_length": 512,
51
+ "max_position_embeddings": 512,
52
+ "max_relative_positions": -1,
53
+ "model_type": "deberta-v2",
54
+ "norm_rel_ebd": "layer_norm",
55
+ "num_attention_heads": 12,
56
+ "num_hidden_layers": 12,
57
+ "padding_idx": 0,
58
+ "pooler_dropout": 0,
59
+ "pooler_hidden_act": "gelu",
60
+ "pooler_hidden_size": 768,
61
+ "pos_att_type": [
62
+ "p2c",
63
+ "c2p"
64
+ ],
65
+ "position_biased_input": false,
66
+ "position_buckets": 256,
67
+ "relative_attention": true,
68
+ "share_att_key": true,
69
+ "task_specific_params": null,
70
+ "type_vocab_size": 0,
71
+ "vocab_size": 128100
72
+ },
73
+ "transformers_version": "4.37.0",
74
+ "use_bias": false,
75
+ "use_gate": true,
76
+ "use_mlp": true,
77
+ "use_scale": false
78
+ }
generation_config.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "max_length": 512,
4
+ "transformers_version": "4.37.0"
5
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c64349059cb28c2b8ce7db99744f76cb3f2af7a28a10432e1796c1ad97aab33f
3
+ size 739972032