File size: 4,201 Bytes
3910af4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5c0511d
3910af4
5379c14
3910af4
 
 
 
 
 
 
 
 
 
302ab13
3910af4
 
 
 
 
 
 
302ab13
 
 
 
 
 
5401374
3910af4
 
 
 
 
6bef198
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
---
language:
- en
library_name: transformers
pipeline_tag: other
base_model: google-t5/t5-large
base_model_relation: finetune
tags:
- text-to-graph
- webnlg
- regen
---

# ReGen T2G.CE for WebNLG

This T5-large model converts English text into subject–relation–object triples. It implements the WebNLG T2G.CE setting of [Dognin et al. (2021)](https://aclanthology.org/2021.emnlp-main.83/), using cross-entropy fine-tuning.

The first author of the [XQDT paper](https://huggingface.co/papers/2608.29948) reproduced ReGen T2G.CE for use as a base text-to-data model in that study. The [reproduction repository](https://github.com/guihuzhang/bt5-regen-text-to-graph) contains the code, saved predictions, and evaluation scripts.

The checkpoint is epoch 3 of the continuation run. Its saved predictions on 2,155 WebNLG 2020 English test examples give Exact precision 70.35, recall 72.18, and F1 71.07, using five-beam decoding. For CE on the same task, [Table 2 of the ReGen paper](https://aclanthology.org/2021.emnlp-main.83.pdf#page=7) reports 72.3 Exact F1, while the example run in the [IBM training guide](https://github.com/IBM/regen/blob/main/docs/train_t2g_webnlg.md#overview) scores 70.11.

## Usage

```python
import torch
from transformers import T5ForConditionalGeneration, T5Tokenizer

model_path = "Loria-MosAIk/regen-webnlg-t2g-ce"
tokenizer = T5Tokenizer.from_pretrained(model_path, legacy=True)
model = T5ForConditionalGeneration.from_pretrained(model_path).eval()
inputs = tokenizer("Text to Graph: Lina Dorado was born in Bogotá in 1975.", return_tensors="pt")
prefix = torch.full((1, 1), tokenizer.pad_token_id, dtype=inputs.input_ids.dtype)
input_ids = torch.cat((prefix, inputs.input_ids), dim=1)
attention_mask = torch.cat((torch.ones_like(prefix), inputs.attention_mask), dim=1)
outputs = model.generate(input_ids=input_ids, attention_mask=attention_mask, num_beams=5, max_length=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True, clean_up_tokenization_spaces=False))
```

Output:

```text
__subject__ Lina_Dorado __predicate__ birthPlace __object__ Bogotá __subject__ Lina_Dorado __predicate__ birthYear __object__ 1975
```

The example prepends a pad token to match ReGen's data loader.

The [base T5-large model](https://huggingface.co/google-t5/t5-large) is distributed under Apache-2.0. The WebNLG fine-tuning data are distributed under [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/).

## Citation

Original ReGen model: [Dognin et al. (2021)](https://arxiv.org/abs/2108.12472).

```bibtex
@inproceedings{dognin-etal-2021-regen,
    title = "{R}e{G}en: {R}einforcement Learning for Text and Knowledge Base Generation using Pretrained Language Models",
    author = "Dognin, Pierre  and
      Padhi, Inkit  and
      Melnyk, Igor  and
      Das, Payel",
    editor = "Moens, Marie-Francine  and
      Huang, Xuanjing  and
      Specia, Lucia  and
      Yih, Scott Wen-tau",
    booktitle = "Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing",
    month = nov,
    year = "2021",
    address = "Online and Punta Cana, Dominican Republic",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2021.emnlp-main.83/",
    doi = "10.18653/v1/2021.emnlp-main.83",
    pages = "1084--1099"
}
```

This checkpoint and reproduction code: [Efimov-Zhang et al. (2026)](https://aclanthology.org/2026.emnlp-main.397/).

```bibtex
@inproceedings{efimov-zhang-etal-2026-xqdt,
    title = "{XQDT}: e{X}plainable and Quantitative Data-Text Alignment Metric with Feedback Signals",
    author = "Efimov-Zhang, Kun  and
      Song, Yifei  and
      Gardent, Claire",
    editor = "Lee, Hung-Yi  and
      Dev, Sunipa  and
      Li, Jessy  and
      Elliott, Desmond",
    booktitle = "Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing",
    month = oct,
    year = "2026",
    address = "Budapest, Hungary",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2026.emnlp-main.397/",
    doi = "10.18653/2026.emnlp-main.397",
    pages = "9121--9157",
    ISBN = "979-8-89176-459-0"
}
```