Kernel Died when running Neuralcoref
Asked Answered
U

2

5

I am trying to install neuralcoref and following the instructions given here.

I created a jupyter notebook and try to run the following code.

# Load your usual SpaCy model (one of SpaCy English models)
import spacy
nlp = spacy.load('en')

# Add neural coref to SpaCy's pipe
import neuralcoref
neuralcoref.add_to_pipe(nlp)

# You're done. You can now use NeuralCoref as you usually manipulate a SpaCy 
document annotations.
doc = nlp(u'My sister has a dog. She loves him.')

doc._.has_coref
doc._.coref_clusters

I get an error message from the jupyter, that kernel died. Even I try to run in the in a python file but still its not working.

O.S - Windows 10 RAM : 16GB

Note: I did try out to updating numpy but still it didn't worked.

Can anyone help me with that. Appreciate your time. Thanks

Ulent answered 12/7, 2019 at 14:4 Comment(0)
S
6

There is no need to downgrade spacy at all. Build from source, because neuralcoref installed with pip is built against spacy==2.1.0.

Proof:

Build:

git clone https://github.com/huggingface/neuralcoref.git
cd neuralcoref
pip install -r requirements.txt # correct for the desired versions of Cython and SpaCy
python setup.py install

Test:

import spacy
import neuralcoref
nlp = spacy.load('en_core_web_md')
neuralcoref.add_to_pipe(nlp)
print(spacy.__version__)
doc = nlp(u'My sister has a dog. She loves him.')
print(doc._.has_coref)
print(doc._.coref_clusters)
2.3.2
True
[My sister: [My sister, She], a dog: [a dog, him]]
Standfast answered 31/8, 2020 at 21:18 Comment(1)
Yes. The --no-binary neuralcoref does not seem to work, unfortunately. Building from source works, luckily!Arris
D
5

As per here: https://github.com/huggingface/neuralcoref/issues/189.

You can get it to work fine if you downgrade Spacy to 2.1.0.

pip uninstall spacy 
pip uninstall neuralcoref
pip install spacy==2.1.0 
pip install neuralcoref --no-binary neuralcoref

Has worked for others, including myself. Notebook now runs fine.

Dolmen answered 3/9, 2019 at 3:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.