summaryrefslogtreecommitdiff
path: root/dtrain
diff options
context:
space:
mode:
Diffstat (limited to 'dtrain')
-rw-r--r--dtrain/dtrain.cc6
-rw-r--r--dtrain/dtrain.h2
-rw-r--r--dtrain/hstreaming/dtrain.ini1
-rw-r--r--dtrain/test/example/dtrain.ini7
4 files changed, 10 insertions, 6 deletions
diff --git a/dtrain/dtrain.cc b/dtrain/dtrain.cc
index 9969a070..37430fb9 100644
--- a/dtrain/dtrain.cc
+++ b/dtrain/dtrain.cc
@@ -22,7 +22,7 @@ dtrain_init(int argc, char** argv, po::variables_map* cfg)
("hstreaming", po::value<bool>()->zero_tokens(), "run in hadoop streaming mode")
("learning_rate", po::value<double>()->default_value(0.0005), "learning rate")
("gamma", po::value<double>()->default_value(0.), "gamma for SVM (0 for perceptron)")
- ("tmp", po::value<string>()->default_value("/tmp"), "temp dir to use") // FIXME
+ ("tmp", po::value<string>()->default_value("/tmp"), "temp dir to use")
("noup", po::value<bool>()->zero_tokens(), "do not update weights");
po::options_description cl("Command Line Options");
cl.add_options()
@@ -141,7 +141,9 @@ main(int argc, char** argv)
vector<string> src_str_buf; // source strings
vector<vector<WordID> > ref_ids_buf; // references as WordID vecs
// this is for writing the grammar buffer file
- char grammar_buf_fn[] = DTRAIN_TMP_DIR"/dtrain-grammars-XXXXXX";
+ char grammar_buf_fn[1024];
+ strcpy(grammar_buf_fn, cfg["tmp"].as<string>().c_str());
+ strcat(grammar_buf_fn, "/dtrain-grammars-XXXXXX");
mkstemp(grammar_buf_fn);
ogzstream grammar_buf_out;
grammar_buf_out.open(grammar_buf_fn);
diff --git a/dtrain/dtrain.h b/dtrain/dtrain.h
index 71dfbc7f..c1d910aa 100644
--- a/dtrain/dtrain.h
+++ b/dtrain/dtrain.h
@@ -3,6 +3,7 @@
#include <iomanip>
+#include <string.h>
#include <boost/algorithm/string.hpp>
#include <boost/program_options.hpp>
@@ -11,7 +12,6 @@
#include "pairsampling.h"
#define DTRAIN_DOTS 100 // when to display a '.'
-#define DTRAIN_TMP_DIR "/var/hadoop/mapred/local"
#define DTRAIN_GRAMMAR_DELIM "########EOS########"
using namespace std;
diff --git a/dtrain/hstreaming/dtrain.ini b/dtrain/hstreaming/dtrain.ini
index 14195bf6..bb594653 100644
--- a/dtrain/hstreaming/dtrain.ini
+++ b/dtrain/hstreaming/dtrain.ini
@@ -7,3 +7,4 @@ output=-
scorer=stupid_bleu
sample_from=forest
pair_sampling=rand
+tmp=/var/hadoop/mapred/local
diff --git a/dtrain/test/example/dtrain.ini b/dtrain/test/example/dtrain.ini
index fd3a3841..b1b9b7bd 100644
--- a/dtrain/test/example/dtrain.ini
+++ b/dtrain/test/example/dtrain.ini
@@ -1,11 +1,12 @@
decoder_config=test/example/cdec.ini
k=100
N=4
-epochs=100
+epochs=2
input=test/example/nc-1k.gz
scorer=stupid_bleu
-output=test/example/weights.gz
-stop_after=0
+output=- #test/example/weights.gz
+stop_after=2
sample_from=forest
pair_sampling=rand
print_weights=Glue WordPenalty LanguageModel LanguageModel_OOV PhraseModel_0 PhraseModel_1 PhraseModel_2 PhraseModel_3 PhraseModel_4 PassThrough
+tmp=./