From 52215eec281de6e3a0c50cc9e58c40ed776c50d8 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Fri, 15 Jul 2016 11:17:09 +0200 Subject: update lm --- training/dtrain/Makefile.am | 1 + training/dtrain/dtrain_net_interface.cc | 24 ++++++++++++++++++------ training/dtrain/dtrain_net_interface.h | 1 + 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/training/dtrain/Makefile.am b/training/dtrain/Makefile.am index db36d0f6..d22a8594 100644 --- a/training/dtrain/Makefile.am +++ b/training/dtrain/Makefile.am @@ -7,6 +7,7 @@ dtrain_net_SOURCES = dtrain_net.cc dtrain_net.h dtrain.h sample.h score.h update dtrain_net_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a /srv/postedit/lib/nanomsg-0.5-beta/lib/libnanomsg.so dtrain_net_interface_SOURCES = dtrain_net_interface.cc dtrain_net_interface.h dtrain.h sample_net_interface.h score_net_interface.h update.h +dtrain_net_interface_LDFLAGS = -rdynamic dtrain_net_interface_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a /srv/postedit/lib/nanomsg-0.5-beta/lib/libnanomsg.so AM_CPPFLAGS = -W -Wall -Wno-sign-compare -I$(top_srcdir)/utils -I$(top_srcdir)/decoder -I$(top_srcdir)/mteval -I/srv/postedit/lib/nanomsg-0.5-beta/include -I/srv/postedit/lib/cppnanomsg diff --git a/training/dtrain/dtrain_net_interface.cc b/training/dtrain/dtrain_net_interface.cc index ac447517..696348d4 100644 --- a/training/dtrain/dtrain_net_interface.cc +++ b/training/dtrain/dtrain_net_interface.cc @@ -7,6 +7,14 @@ #include #include "nn.hpp" +#include // mkfifo +#include +#include +#include +#include +#include + + using namespace dtrain; int @@ -28,6 +36,16 @@ main(int argc, char** argv) const bool output_derivation = conf["output_derivation"].as(); const bool output_rules = conf["output_rules"].as(); + // update lm + /*if (conf["update_lm_fn"].as() != "") + mkfifo(conf["update_lm_fn"].as().c_str(), 0666);*/ + + // setup socket + nn::socket sock(AF_SP, NN_PAIR); + sock.bind(master_addr.c_str()); + string hello = "hello"; + sock.send(hello.c_str(), hello.size()+1, 0); + // setup decoder register_feature_functions(); SetSilent(true); @@ -76,12 +94,6 @@ main(int argc, char** argv) cerr << setw(25) << "learning rate RB " << learning_rate_RB << endl; cerr << setw(25) << "learning rate Shape " << learning_rate_Shape << endl; - // setup socket - nn::socket sock(AF_SP, NN_PAIR); - sock.bind(master_addr.c_str()); - string hello = "hello"; - sock.send(hello.c_str(), hello.size()+1, 0); - // debug ostringstream debug_output; diff --git a/training/dtrain/dtrain_net_interface.h b/training/dtrain/dtrain_net_interface.h index 720c4c9b..91c2e538 100644 --- a/training/dtrain/dtrain_net_interface.h +++ b/training/dtrain/dtrain_net_interface.h @@ -97,6 +97,7 @@ dtrain_net_init(int argc, char** argv, po::variables_map* conf) ("learning_rate_Shape", po::value(), "learning rate for shape features") ("output_derivation,E", po::bool_switch()->default_value(false), "output derivation, not viterbi str") ("output_rules,R", po::bool_switch()->default_value(false), "also output rules") + ("update_lm_fn", po::value()->default_value(""), "TODO") ("dense_features,D", po::value()->default_value("EgivenFCoherent SampleCountF CountEF MaxLexFgivenE MaxLexEgivenF IsSingletonF IsSingletonFE Glue WordPenalty PassThrough LanguageModel LanguageModel_OOV Shape_S01111_T11011 Shape_S11110_T11011 Shape_S11100_T11000 Shape_S01110_T01110 Shape_S01111_T01111 Shape_S01100_T11000 Shape_S10000_T10000 Shape_S11100_T11100 Shape_S11110_T11110 Shape_S11110_T11010 Shape_S01100_T11100 Shape_S01000_T01000 Shape_S01010_T01010 Shape_S01111_T01011 Shape_S01100_T01100 Shape_S01110_T11010 Shape_S11000_T11000 Shape_S11000_T01100 IsSupportedOnline NewRule KnownRule OOVFix"), "dense features") ("debug_output,d", po::value()->default_value(""), "file for debug output"); -- cgit v1.2.3