KeyError: "[E018] Can't retrieve string for hash while running movie sentiment example
See original GitHub issueWhile running movie sentiment example I am getting the following error while running the code explainer = AnchorText(nlp, predict_fn):
KeyError Traceback (most recent call last) <ipython-input-12-184c1e0a132f> in <module>() ----> 1 explainer = AnchorText(nlp, predict_fn)
2 frames /usr/local/lib/python3.6/dist-packages/alibi/explainers/anchor_text.py in <listcomp>(.0) 43 self.w_prob = w_prob 44 # list with spaCy lexemes in vocabulary —> 45 self.to_check = [self.nlp.vocab[w] for w in self.nlp.vocab.vectors if self.nlp.vocab[w].prob >= self.w_prob] 46 self.n_similar = n_similar 47
vocab.pyx in spacy.vocab.Vocab.getitem()
lexeme.pyx in spacy.lexeme.Lexeme.init()
vocab.pyx in spacy.vocab.Vocab.get_by_orth()
strings.pyx in spacy.strings.StringStore.getitem()
KeyError: “[E018] Can’t retrieve string for hash ‘11580349482641876976’. This usually refers to an issue with the Vocab
or StringStore
.”
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
A workaround would be:
The keys in
nlp.vocab.vectors
are supposed to all beint
, but in some v2.2md
models they’re accidentallynumpy.uint64
.@adrianeboyd thanks for the workaround. @devchaitu18 I’ll put this in the master shortly.