Tokenize each prompt and candidate answer pair and return PyTorch tensors. You should also create some labels:

from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("my_awesome_swag_model")
inputs = tokenizer([[prompt, candidate1], [prompt, candidate2]], return_tensors="pt", padding=True)
labels = torch.tensor(0).unsqueeze(0)

Pass your inputs and labels to the model and return the logits: