Я использую dill
для сохранения модели ML в файл.
Когда я запускаю свои тесты с python -m unittest
, это работает.Но если я попробую запустить тесты с python setup.py test
, то получится ошибка TypeError: can't pickle PyCapsule objects
в raw, где я попытаюсь сохранить модель.
Мои настройки в setup.py для тестирования:
test_suite='tests',
tests_require=['pytest']
Ошибка:
File "/Users/anna/anaconda3/lib/python3.6/site-packages/dill/_dill.py", line 1055, in save_builtin_method
pickler.save_reduce(_get_attr, (module, obj.__name__), obj=obj)
File "/Users/anna/anaconda3/lib/python3.6/pickle.py", line 610, in save_reduce
save(args)
File "/Users/anna/anaconda3/lib/python3.6/pickle.py", line 476, in save
f(self, obj) # Call unbound method with explicit self
File "/Users/anna/anaconda3/lib/python3.6/pickle.py", line 736, in save_tuple
save(element)
File "/Users/anna/anaconda3/lib/python3.6/pickle.py", line 476, in save
f(self, obj) # Call unbound method with explicit self
File "/Users/anna/anaconda3/lib/python3.6/site-packages/dill/_dill.py", line 1260, in save_module
state=_main_dict)
File "/Users/anna/anaconda3/lib/python3.6/pickle.py", line 634, in save_reduce
save(state)
File "/Users/anna/anaconda3/lib/python3.6/pickle.py", line 476, in save
f(self, obj) # Call unbound method with explicit self
File "/Users/anna/anaconda3/lib/python3.6/site-packages/dill/_dill.py", line 893, in save_module_dict
StockPickler.save_dict(pickler, obj)
File "/Users/anna/anaconda3/lib/python3.6/pickle.py", line 821, in save_dict
self._batch_setitems(obj.items())
File "/Users/anna/anaconda3/lib/python3.6/pickle.py", line 847, in _batch_setitems
save(v)
File "/Users/anna/anaconda3/lib/python3.6/pickle.py", line 496, in save
rv = reduce(self.proto)
TypeError: can't pickle PyCapsule objects
Не могли бы вы помочь мне узнать, почему это не работает?