Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kernel Died when running Neuralcoref

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

like image 815
Aman Dalmia Avatar asked Jul 12 '19 14:07

Aman Dalmia


2 Answers

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.

like image 190
kimberley woods Avatar answered Oct 17 '22 02:10

kimberley woods


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]]
like image 5
Sergey Bushmanov Avatar answered Oct 17 '22 02:10

Sergey Bushmanov