Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't load model TypeError: unhashable type: 'dict' #125

Closed
tokestermw opened this issue Jan 9, 2019 · 3 comments
Closed

Can't load model TypeError: unhashable type: 'dict' #125

tokestermw opened this issue Jan 9, 2019 · 3 comments

Comments

@tokestermw
Copy link

Currently, spacy==2.0.18 fails like this when trying to load the coref model: #120

I downgraded to spacy==2.0.12 and thinc==6.10.3 and when I try to load the coref model, and now I get:


(venv) motoki@tmjr:~/repo-name$ python -c "import spacy; nlp = spacy.load('en_coref_md')"

...

  File "/home/motoki/repo-name/venv/lib/python3.6/site-packages/spacy/util.py", line 114, in load_model
    return load_model_from_package(name, **overrides)
  File "/home/motoki/repo-name/venv/lib/python3.6/site-packages/spacy/util.py", line 135, in load_model_from_package
    return cls.load(**overrides)
  File "/home/motoki/repo-name/venv/lib/python3.6/site-packages/en_coref_md/__init__.py", line 14, in load
    nlp = load_model_from_init_py(__file__, **overrides)
  File "/home/motoki/repo-name/venv/lib/python3.6/site-packages/spacy/util.py", line 173, in load_model_from_init_py
    return load_model_from_path(data_path, meta, **overrides)
  File "/home/motoki/repo-name/venv/lib/python3.6/site-packages/spacy/util.py", line 156, in load_model_from_path
    return nlp.from_disk(model_path)
  File "/home/motoki/repo-name/venv/lib/python3.6/site-packages/spacy/language.py", line 653, in from_disk
    util.from_disk(path, deserializers, exclude)
  File "/home/motoki/repo-name/venv/lib/python3.6/site-packages/spacy/util.py", line 511, in from_disk
    reader(path / key)
  File "/home/motoki/repo-name/venv/lib/python3.6/site-packages/spacy/language.py", line 641, in <lambda>
    self.vocab.from_disk(p) and _fix_pretrained_vectors_name(self))),
  File "vocab.pyx", line 380, in spacy.vocab.Vocab.from_disk
  File "vectors.pyx", line 391, in spacy.vectors.Vectors.from_disk
  File "/home/motoki/repo-name/venv/lib/python3.6/site-packages/spacy/util.py", line 511, in from_disk
    reader(path / key)
  File "vectors.pyx", line 369, in spacy.vectors.Vectors.from_disk.load_key2row
  File "vectors.pyx", line 370, in spacy.vectors.Vectors.from_disk.load_key2row
  File "/home/motoki/repo-name/venv/lib/python3.6/site-packages/msgpack_numpy.py", line 175, in unpack
    return _unpack(stream, **kwargs)
  File "msgpack/_unpacker.pyx", line 229, in msgpack._unpacker.unpack
  File "msgpack/_unpacker.pyx", line 200, in msgpack._unpacker.unpackb
TypeError: unhashable type: 'dict'

I've been trying various msgpack versions to no avail

msgpack==0.5.4
msgpack-numpy==0.4.3.2
msgpack-python==0.5.6

Thanks

@JohnGiorgi
Copy link

For me,

pip install msgpack==0.5.6 spacy==2.0.13 https://github.com/huggingface/neuralcoref-models/releases/download/en_coref_md-3.0.0/en_coref_md-3.0.0.tar.gz

worked on both Linux and MacOS.

@ahalterman
Copy link

ahalterman commented Jan 11, 2019

For me, spacy==2.0.13 lead to the issue in #103. Instead what I did was

# make a new environment
 python -m venv neuralcoref
source neuralcoref/bin/activate
CFLAGS='-stdlib=libc++' pip install thinc==6.10.3
pip install msgpack==0.5.6
CFLAGS='-stdlib=libc++' pip install spacy==2.0.12  # <-- not 2.0.13
pip install https://github.com/huggingface/neuralcoref-models/releases/download/en_coref_lg-3.0.0/en_coref_lg-3.0.0.tar.gz

Then the demo works fine for me. Using spaCy 2.0.16 or 2.0.18 leads to the cymem error that others have described (#102, #116, etc.).

This is Mac OS 10.13.6, Python 3.6 (Anaconda).

@thomwolf
Copy link
Member

Hi this should all be fixed in the new release (4.0) and with SpaCy 2.1+.
Please open a new issue if you still experience issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants