kanishkamisra / minicons

Utility for behavioral and representational analyses of Language Models
https://minicons.kanishka.website
MIT License
121 stars 29 forks source link

Can't make the surprisal example to work #1

Closed bnicenboim closed 3 years ago

bnicenboim commented 3 years ago

Hi I couldn't make the surprisals example to work in https://github.com/kanishkamisra/minicons/blob/master/examples/surprisals.md

>>> import minicons
>>> import torch
>>> from torch.utils.data import DataLoader
>>> 
>>> import json
>>> model = scorer.IncrementalLMScorer('gpt2', 'cpu')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'scorer' is not defined
>>> 

Also not with minicons.scorer

Not sure from where scorer is supposed to come...

Sorry, if it's just me doing something stupid. My python abilities are mostly from copy&paste (I'm an R person)

bnicenboim commented 3 years ago

ok, I just had to add from minicons import scorer (I don't really get why it didn't allow me to do minicons.scorer either...)

kanishkamisra commented 3 years ago

This is my bad -- I will fix it in the tutorial! Thanks for pointing it out!