Jupyter notebooks on Google Colab to calculate surprisal for experimental stimuli, using the minicons package (Misra 2022).
The notebook can be run on Google Colab without any local installation of Python. To do so, click on the "open in Colab" button at the top of the notebook.
Generate surprisals for a csv (input and output) or single sentence using GPT-2
Misra, Kanishka. (2022). minicons: Enabling flexible behavioral and representational analyses of transformer language models. ArXiv:2203.13112 [Cs]. http://arxiv.org/abs/2203.13112