File size: 1,051 Bytes
56d0342
 
 
884d0bb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
efc7c2e
884d0bb
 
 
 
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
---
license: apache-2.0
---

### Using .generate()
```python
from transformers import GenerationConfig, T5ForConditionalGeneration, T5Tokenizer

model_name = "cu-kairos/propbank_srl_seq2seq_t5_large"

model = T5ForConditionalGeneration.from_pretrained(model_name)
tokenizer = T5Tokenizer.from_pretrained(model_name)
generation_config = GenerationConfig.from_pretrained(model_name)

tokenized_inputs = tokenizer(["SRL for [put]: That fund was [put] together by Blackstone Group ."], return_tensors="pt")
outputs = model.generate(**tokenized_inputs, generation_config=generation_config)

print(tokenizer.batch_decode(outputs, skip_special_tokens=True))

# ['ARG-1: That fund | ARG-2: together | ARG-0: by Blackstone Group ']
```

### Using pipeline

```python
from transformers import pipeline
srl = pipeline("text2text-generation", "cu-kairos/propbank_srl_seq2seq_t5_large")
print(srl(["SRL for [put]: That fund was [put] together by Blackstone Group ."]))

# [{'generated_text': 'ARG-1: That fund | ARG-2: together | ARG-0: by Blackstone Group '}]
```