File size: 640 Bytes
b3eea3c 0a98241 ce46e25 4c754b2 ce46e25 b3eea3c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
```
import transformers
import datasets
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
from datasets import load_dataset # if loading a dataset
model_name = 'logicreasoning/LogiT5'
tokenize = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
device = 'cuda:0' if torch.cuda.is_available() else 'cpu'
input_text = '' #your input text here must be a string
input = tokenize(input_text, return_tensors='pt', padding=True).to(device)
model = model.to(device)
output = model.generate(*input, max_length=1024)
prediction = tokenize.decode(output[0],skip_special_tokens=True)``` |