moses-smt / mosesdecoder

Moses, the machine translation system
http://www.statmt.org/moses
GNU Lesser General Public License v2.1
1.58k stars 778 forks source link

NPLM wrapper not compatible with rsennrich's version #102

Closed michaelhutt closed 9 years ago

michaelhutt commented 9 years ago

The nplm wrapper at lm/wrappers/nplm.cc is not compatible with the NPLM at https://github.com/rsennrich/nplm, which is the suggested NPLM (from http://www.statmt.org/moses/?n=FactoredTraining.BuildingLanguageModel#ntoc1). The NPLM from @rsennrich has incorporated changes from the upstream 0.3 version, which changed the nplm::neuralLM constructor's signature - it no longer takes a string.

rsennrich commented 9 years ago

The currently supported wrapper for NPLM is in moses/LM/NeuralLMWrapper.cpp . I don't know if lm/wrappers/nplm.cc is used for anything, but if you want to compile it, use Kenneth's fork of NPLM (https://github.com/kpu/nplm) and compile moses with the option '--with-nplm-0.1'.

michaelhutt commented 9 years ago

'--with-nplm-0.1` was taken out with the latest commit (https://github.com/moses-smt/mosesdecoder/commit/8b323abbca16619bfbaf32d5f9b2dcaf63457d53).

kpu commented 9 years ago

Rico, is NPLM threadsafe for parallel lookup_ngram against the same instance of neuralLM? If so, a lot of that wrapper can be thrown out.

rsennrich commented 9 years ago

when each thread has its own instance of neuralNetwork() (or neuralLM/neuralTM), lookups are thread-safe, even if the instances share the same model(); just don't do anything that modifies the model in parallel, like calling neuralNetwork.premultiply().