How to get probability of a sentence using GPT-2 model?

Hi, I’m doing a linguistic research and I’m using GPT-2 model.
I have two sentences: one is correct and the other one has some atypical elements which makes it strange.
I’d like to use GPT-2 to get the probabilities of both the sentences and see if the model understands which one is linguistically correct.
How can I do?

Hi @caput maybe these two links help:
Generation Probabilities: How to compute probabilities of output scores for GPT2