attardi / deepnl

Deep Learning for Natural Language Processing
GNU General Public License v3.0
457 stars 116 forks source link

unable to load model with deepnl #44

Closed tweetsharp closed 7 years ago

tweetsharp commented 7 years ago

I want to improve polyglot NER. i create a model with gensim Word2Vec. when i want load model with deepnl.ner_tagger i get follow error. any Idea?

File "//word2vec/LoadModel/mydeepnl.py", line 3, in <module>
    tagger = NerTagger.load(open('sen.model'))
  File "deepnl/tagger.pyx", line 149, in deepnl.tagger.Tagger.load (deepnl/tagger.cpp:3984)
  File "deepnl/networkseq.pyx", line 433, in deepnl.networkseq.SequenceNetwork.load (deepnl/networkseq.cpp:9036)
  File "deepnl/networkseq.pyx", line 87, in deepnl.networkseq.SeqParameters.load (deepnl/networkseq.cpp:4122)
  File "/usr/local/lib/python2.7/dist-packages/gensim/models/word2vec.py", line 1297, in __getitem__
    return self.wv.__getitem__(words)
AttributeError: 'Word2Vec' object has no attribute 'wv'
attardi commented 7 years ago

The file mydeepnl.py is not part of the distribution. Your code at networkseq.pyx line 87 is calling methods from the gensim library. The code in the deepnl distribution instead loads the data itself:

data = pickle.load(file)
p.hidden_weights, p.hidden_bias, p.output_weights, p.output_bias, p.transitions = data

Please ensure you are using the right sources.

tweetsharp commented 7 years ago

thanx for response. Another Question. How can i change train data for polyglot NER model? for more explain, how can i use deepNL to create new model with my data?

attardi commented 7 years ago

On 02 gen 2017, at 23:35, tweetsharp notifications@github.com wrote:

Another Question. How can i change train data for polyglot NER model? for more explain, how can i use deepNL to create new model with my data?

Check the instructions here:

https://github.com/attardi/deepnl/wiki/NER

Let me know if you need further help.

— Attardi

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/attardi/deepnl/issues/44#issuecomment-270062833, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVuonUE9ig6Al03kl9_sgrajWL1umTiks5rOfowgaJpZM4LY1ql.