Using .generate()
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
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 '}]
- Downloads last month
- 5
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social
visibility and check back later, or deploy to Inference Endpoints (dedicated)
instead.