File size: 789 Bytes
c34356b
 
3dd6822
 
c34356b
 
 
 
3dd6822
c34356b
3dd6822
c34356b
3dd6822
 
 
c34356b
 
3dd6822
 
 
 
 
 
c34356b
 
3dd6822
c34356b
 
3dd6822
 
 
 
 
 
 
c34356b
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
---
library_name: transformers
datasets:
- webnlg/challenge-2023
---

# Model Card for Model ID

T5-XL seq2seq model trained on WebNLG dataset

# Use

```python
from typing import List, Tuple
from transformers import pipeline


def prepare_text(triplets: List[Tuple[str, str, str]]):
    graph = "[graph]"
    for triplet in triplets:
        graph += f"[head] {triplet[0]} [relation] {triplet[1]} [tail] {triplet[2]} "
    graph += "[text]</s>"
    return graph


g2t_model = pipeline(task="text2text-generation", model="s-nlp/g2t-t5-xl-webnlg")


graph = prepare_text([
    ("London", "capital_of", "United Kingdom"),
    ("London", "population", "8,799,728")
])
g2t_model(graph)
# [{'generated_text': 'London is the capital of the United Kingdom and has a population of 8,799,7'}]
```