nlpnet POSTagger returns error message when allow_pickle=False

血红的双手。 提交于 2021-02-10 14:35:26

问题


I have installed the latest version of nlpnet library (http://nilc.icmc.usp.br/nlpnet/). Then, when I try to use nlpnet POSTagger according to the follwoing example, I get an error:

import nlpnet
tagger = nlpnet.POSTagger('/path/to/pos-model/', language='pt')

Error:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/r/env2/lib/python3.6/site-packages/nlpnet/taggers.py", line 205, in __init__
self._load_data()
File "/home/r/env2/lib/python3.6/site-packages/nlpnet/taggers.py", line 423, in _load_data
self.nn = load_network(md)
File "/home/r/env2/lib/python3.6/site-packages/nlpnet/taggers.py", line 38, in load_network
nn = net_class.load_from_file(md.paths[md.network])
File "nlpnet/network.pyx", line 860, in nlpnet.network.Network.load_from_file (nlpnet/network.c:14631)
File "/home/r/env2/lib/python3.6/site-packages/numpy/lib/npyio.py", line 262, in __getitem__
pickle_kwargs=self.pickle_kwargs)
File "/home/r/env2/lib/python3.6/site-packages/numpy/lib/format.py", line 722, in read_array
raise ValueError("Object arrays cannot be loaded when "
ValueError: Object arrays cannot be loaded when allow_pickle=False

I also tried to install nlpnet again in a different virtual environment, but the error persists. I'm not sure if this is a incompatibility problem, a bug in the lib or an installation issue.

Any suggestions?


回答1:


I am also using nlpnet, and I had the same problem. Searching on Google, I found this question on Stack Overflow. Following one of the answers, I downgraded numpy to version 1.16.1, and it worked for me.

pip install numpy==1.16.1

Hope it helps you.



来源:https://stackoverflow.com/questions/57361531/nlpnet-postagger-returns-error-message-when-allow-pickle-false

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!