Views
No views yet
pip install .1from glidre import GLiDRE
2
3model = GLiDRE.from_pretrained("cea-list-ia/glidre_multi")
4
5text = "The Loud Tour was the fourth overall and third world concert tour by Barbadian recording artist Rihanna."
6
7# Define relation labels
8labels = ["COUNTRY_OF_CITIZENSHIP", "PUBLICATION_DATE", "PART_OF"] # Labels are uppercase because the model performs better with capitalized relation names
9# Define entity mentions (format: [{"id" : id, "type" : type, "mentions" : [{"value" : text, "start" : start_idx, "end" : end_idx}]}])
10mentions = [{
11 "id": 0,
12 "mentions": [
13 {
14 "value": "Barbadian",
15 "start": 69,
16 "end": 78
17 }
18 ],
19 "type": "LOC"
20 },
21 {
22 "id": 1,
23 "mentions": [
24 {
25 "value": "Rihanna",
26 "start": 96,
27 "end": 103
28 }
29 ],
30 "type": "PER"}]
31
32# Predict relations using GLiDRE
33relations = model.predict_entities(text = text, labels = labels, mentions = mentions, threshold=0.3, multi_label = False)
34print("Predicted Relations:")
35for relation in relations:
36 print(relation["entity_1"])
37 print("Label :", relation["relation_type"])
38 print(relation["entity_2"])
39 print("---")1# For Re-DocRED:
2python3 train.py --config configs/config_finetuning.yaml1@misc{armingaud2025glidregeneralistlightweightmodel,
2 title={GLiDRE: Generalist Lightweight model for Document-level Relation Extraction},
3 author={Robin Armingaud and Romaric Besançon},
4 year={2025},
5 eprint={2508.00757},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL},
8 url={https://arxiv.org/abs/2508.00757},
9}