erickrf / nlpnet

A neural network architecture for NLP tasks, using cython for fast performance. Currently, it can perform POS tagging, SRL and dependency parsing.
http://nilc.icmc.usp.br/nlpnet/
MIT License
407 stars 104 forks source link

nlpnet POSTagger returns error message when allow_pickle=False #42

Closed dcaled closed 5 years ago

dcaled commented 5 years ago

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?

erickrf commented 5 years ago

What is your numpy version? I remember something similar happening with the latest one.

dcaled commented 5 years ago

The version is '1.17.0' (the latest one).

biancaberdugo commented 5 years ago

Same error here with nlpnet.SRLTagger()

erickrf commented 5 years ago

This was a compatibility issue with numpy 1.17, and is fixed now. Please check if it is working.

biancaberdugo commented 5 years ago

Now i have that error: File "", line 1, in File "/usr/local/lib/python3.5/dist-packages/nlpnet/taggers.py", line 205, in init self._load_data() File "/usr/local/lib/python3.5/dist-packages/nlpnet/taggers.py", line 224, in _load_data self.boundary_nn = load_network(md_boundary) File "/usr/local/lib/python3.5/dist-packages/nlpnet/taggers.py", line 38, in load_network nn = net_class.load_from_file(md.paths[md.network]) File "networkconv.pyx", line 245, in nlpnet.network.ConvolutionalNetwork.load_from_file File "networkconv.pyx", line 223, in nlpnet.network.ConvolutionalNetwork._load_from_file File "network.pyx", line 258, in nlpnet.network.Network.padding_left.set TypeError: can't multiply sequence by non-int of type 'float'

My test code: import nlpnet nlpnet.set_data_dir('/home/srl-pt') tagger = nlpnet.SRLTagger() tagger.tag(u'O rato roeu a roupa do rei de Roma.')