From d0613843f2ce5628aa6728f3672d59877ef85833 Mon Sep 17 00:00:00 2001
From: Patrick Simianer
Date: Tue, 12 Apr 2016 10:17:20 +0200
Subject: mira: verbose mode, lesser output as default
---
training/mira/kbest_mira.cc | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
(limited to 'training/mira/kbest_mira.cc')
diff --git a/training/mira/kbest_mira.cc b/training/mira/kbest_mira.cc
index 2868de0c..07718a7f 100644
--- a/training/mira/kbest_mira.cc
+++ b/training/mira/kbest_mira.cc
@@ -57,7 +57,8 @@ bool InitCommandLine(int argc, char** argv, po::variables_map* conf) {
("sample_forest,f", "Instead of a k-best list, sample k hypotheses from the decoder's forest")
("sample_forest_unit_weight_vector,x", "Before sampling (must use -f option), rescale the weight vector used so it has unit length; this may improve the quality of the samples")
("random_seed,S", po::value(), "Random seed (if not specified, /dev/random will be used)")
- ("decoder_config,c",po::value(),"Decoder configuration file");
+ ("decoder_config,c",po::value(),"Decoder configuration file")
+ ("verbose,v", po::value()->zero_tokens(), "verbose stderr output");
po::options_description clo("Command line options");
clo.add_options()
("config", po::value(), "Configuration file")
@@ -188,6 +189,8 @@ int main(int argc, char** argv) {
po::variables_map conf;
if (!InitCommandLine(argc, argv, &conf)) return 1;
+ const bool VERBOSE = conf.count("verbose");
+
if (conf.count("random_seed"))
rng.reset(new MT19937(conf["random_seed"].as()));
else
@@ -254,7 +257,8 @@ int main(int argc, char** argv) {
if ((cur_sent * 40 / corpus.size()) > dots) { ++dots; cerr << '.'; }
if (corpus.size() == cur_sent) {
cerr << " [AVG METRIC LAST PASS=" << (tot_loss / corpus.size()) << "]\n";
- Weights::ShowLargestFeatures(dense_weights);
+ if (VERBOSE)
+ Weights::ShowLargestFeatures(dense_weights);
cur_sent = 0;
tot_loss = 0;
dots = 0;
--
cgit v1.2.3