huggingface / neuralcoref

✨Fast Coreference Resolution in spaCy with Neural Networks
https://huggingface.co/coref/
MIT License
2.83k stars 474 forks source link

GPU support - cuda 11.1 - TypeError: Unsupported type <class 'numpy.ndarray'> #345

Open bryanjohns opened 2 years ago

bryanjohns commented 2 years ago

Example:

import spacy

spacy.require_gpu()
>> True

nlp = spacy.load("en_core_web_sm")
doc = nlp("this is my example text")
print(doc)
>> this is my example text

import neuralcoref
neuralcoref.add_to_pipe(nlp)
>> <spacy.lang.en.English object at 0x7f53d9da6d60>

doc =  nlp("this is my example text")
>> Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/brj/.local/share/virtualenvs/spacy-ozIRu_0L/lib/python3.8/site-packages/spacy/language.py", line 445, in __call__
    doc = proc(doc, **component_cfg.get(name, {}))
  File "neuralcoref.pyx", line 593, in neuralcoref.neuralcoref.NeuralCoref.__call__
  File "neuralcoref.pyx", line 720, in neuralcoref.neuralcoref.NeuralCoref.predict
  File "neuralcoref.pyx", line 908, in neuralcoref.neuralcoref.NeuralCoref.get_mention_embeddings
  File "neuralcoref.pyx", line 899, in neuralcoref.neuralcoref.NeuralCoref.get_average_embedding
  File "cupy/_core/core.pyx", line 1591, in cupy._core.core.ndarray.__array_ufunc__
  File "cupy/_core/_kernel.pyx", line 1218, in cupy._core._kernel.ufunc.__call__
  File "cupy/_core/_kernel.pyx", line 138, in cupy._core._kernel._preprocess_args
  File "cupy/_core/_kernel.pyx", line 124, in cupy._core._kernel._preprocess_arg
TypeError: Unsupported type <class 'numpy.ndarray'>

# printing versions
import cupy
spacy.__version__
>> 2.3.7
neuralcoref.__version__
>> 4.1.0
cupy.__version__
>> 10.4.0

Everything works fine if I run this without spacy.require_gpu().