In addition, I tried to do the following:
import spacy
from prodigy.models.ner import EntityRecognizer
nlp = spacy.load("en_trf_distilbertbaseuncased_lg")
model = EntityRecognizer(nlp, label=["TEST1", "TEST2"])
But I got an error with a very long stack trace:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "cython_src/prodigy/models/ner.pyx", line 175, in prodigy.models.ner.EntityRecognizer.__init__
File "/usr/lib/python3.6/copy.py", line 180, in deepcopy
y = _reconstruct(x, memo, *rv)
File "/usr/lib/python3.6/copy.py", line 280, in _reconstruct
state = deepcopy(state, memo)
File "/usr/lib/python3.6/copy.py", line 150, in deepcopy
y = copier(x, memo)
File "/usr/lib/python3.6/copy.py", line 240, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/lib/python3.6/copy.py", line 150, in deepcopy
y = copier(x, memo)
File "/usr/lib/python3.6/copy.py", line 215, in _deepcopy_list
append(deepcopy(a, memo))
File "/usr/lib/python3.6/copy.py", line 150, in deepcopy
y = copier(x, memo)
File "/usr/lib/python3.6/copy.py", line 220, in _deepcopy_tuple
y = [deepcopy(a, memo) for a in x]
File "/usr/lib/python3.6/copy.py", line 220, in <listcomp>
y = [deepcopy(a, memo) for a in x]
File "/usr/lib/python3.6/copy.py", line 180, in deepcopy
y = _reconstruct(x, memo, *rv)
File "/usr/lib/python3.6/copy.py", line 280, in _reconstruct
state = deepcopy(state, memo)
File "/usr/lib/python3.6/copy.py", line 150, in deepcopy
y = copier(x, memo)
File "/usr/lib/python3.6/copy.py", line 240, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/lib/python3.6/copy.py", line 169, in deepcopy
rv = reductor(4)
File "/opt/prodigy/venv/lib/python3.6/site-packages/thinc/neural/_classes/model.py", line 98, in __getstate__
return srsly.pickle_dumps(self.__dict__)
File "/opt/prodigy/venv/lib/python3.6/site-packages/srsly/_pickle_api.py", line 14, in pickle_dumps
return cloudpickle.dumps(data, protocol=protocol)
File "/opt/prodigy/venv/lib/python3.6/site-packages/srsly/cloudpickle/cloudpickle.py", line 1125, in dumps
cp.dump(obj)
File "/opt/prodigy/venv/lib/python3.6/site-packages/srsly/cloudpickle/cloudpickle.py", line 482, in dump
return Pickler.dump(self, obj)
File "/usr/lib/python3.6/pickle.py", line 409, in dump
self.save(obj)
File "/usr/lib/python3.6/pickle.py", line 476, in save
f(self, obj) # Call unbound method with explicit self
File "/usr/lib/python3.6/pickle.py", line 821, in save_dict
self._batch_setitems(obj.items())
File "/usr/lib/python3.6/pickle.py", line 847, in _batch_setitems
save(v)
File "/usr/lib/python3.6/pickle.py", line 476, in save
f(self, obj) # Call unbound method with explicit self
File "/opt/prodigy/venv/lib/python3.6/site-packages/srsly/cloudpickle/cloudpickle.py", line 556, in save_function
return self.save_function_tuple(obj)
File "/opt/prodigy/venv/lib/python3.6/site-packages/srsly/cloudpickle/cloudpickle.py", line 758, in save_function_tuple
save(state)
File "/usr/lib/python3.6/pickle.py", line 476, in save
f(self, obj) # Call unbound method with explicit self
File "/usr/lib/python3.6/pickle.py", line 821, in save_dict
self._batch_setitems(obj.items())
File "/usr/lib/python3.6/pickle.py", line 847, in _batch_setitems
save(v)
File "/usr/lib/python3.6/pickle.py", line 476, in save
f(self, obj) # Call unbound method with explicit self
File "/usr/lib/python3.6/pickle.py", line 821, in save_dict
self._batch_setitems(obj.items())
File "/usr/lib/python3.6/pickle.py", line 847, in _batch_setitems
save(v)
File "/usr/lib/python3.6/pickle.py", line 490, in save
self.save_global(obj)
File "/opt/prodigy/venv/lib/python3.6/site-packages/srsly/cloudpickle/cloudpickle.py", line 877, in save_global
self.save_dynamic_class(obj)
File "/opt/prodigy/venv/lib/python3.6/site-packages/srsly/cloudpickle/cloudpickle.py", line 686, in save_dynamic_class
save(clsdict)
File "/usr/lib/python3.6/pickle.py", line 476, in save
f(self, obj) # Call unbound method with explicit self
File "/usr/lib/python3.6/pickle.py", line 821, in save_dict
self._batch_setitems(obj.items())
File "/usr/lib/python3.6/pickle.py", line 847, in _batch_setitems
save(v)
File "/usr/lib/python3.6/pickle.py", line 476, in save
f(self, obj) # Call unbound method with explicit self
File "/usr/lib/python3.6/pickle.py", line 751, in save_tuple
save(element)
File "/usr/lib/python3.6/pickle.py", line 507, in save
self.save_global(obj, rv)
File "/opt/prodigy/venv/lib/python3.6/site-packages/srsly/cloudpickle/cloudpickle.py", line 875, in save_global
Pickler.save_global(self, obj, name=name)
File "/usr/lib/python3.6/pickle.py", line 927, in save_global
(obj, module_name, name))
_pickle.PicklingError: Can't pickle typing.Union[_ForwardRef('numpy.ndarray'), _ForwardRef('cupy.ndarray')]: it's not the same object as typing.Union