Instructions to use Loria-MosAIk/regen-webnlg-t2g-ce with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Loria-MosAIk/regen-webnlg-t2g-ce with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("Loria-MosAIk/regen-webnlg-t2g-ce") model = AutoModelForSeq2SeqLM.from_pretrained("Loria-MosAIk/regen-webnlg-t2g-ce", device_map="auto") - Notebooks
- Google Colab
- Kaggle
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), using cross-entropy fine-tuning.
The first author of the XQDT paper reproduced ReGen T2G.CE for use as a base text-to-data model in that study. The reproduction repository contains the code, saved predictions, and evaluation scripts.
The checkpoint 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 reports 72.3 Exact F1, while the example run in the IBM training guide scores 70.11.
Usage
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:
__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 is distributed under Apache-2.0. The WebNLG fine-tuning data are distributed under CC BY-NC-SA 4.0.
Citation
Original ReGen model: Dognin et al. (2021).
@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).
@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"
}
- Downloads last month
- 85
Model tree for Loria-MosAIk/regen-webnlg-t2g-ce
Base model
google-t5/t5-large