From 52929f9f265443ab51ced9f89885c7c862d73267 Mon Sep 17 00:00:00 2001 From: Frank Seide Date: Fri, 11 Mar 2016 06:56:38 -0800 Subject: [PATCH] cleaned up log output --- Examples/Text/PennTreebank/Config/rnn.cntk | 11 ++++++----- Source/CNTK/BrainScript/BrainScriptEvaluator.cpp | 2 +- Source/CNTK/BrainScript/BrainScriptParser.cpp | 6 +++--- Source/CNTK/CNTK.cpp | 16 +++++++++------- .../ComputationNetworkEvaluation.cpp | 6 +++--- .../ComputationNetworkScripting.cpp | 4 ---- Source/ComputationNetworkLib/ComputationNode.h | 2 +- Source/SGDLib/SGD.cpp | 16 ++++++++-------- 8 files changed, 31 insertions(+), 32 deletions(-) diff --git a/Examples/Text/PennTreebank/Config/rnn.cntk b/Examples/Text/PennTreebank/Config/rnn.cntk index d7bcf156b059..c158d39e2ac7 100644 --- a/Examples/Text/PennTreebank/Config/rnn.cntk +++ b/Examples/Text/PennTreebank/Config/rnn.cntk @@ -54,11 +54,8 @@ writeWordAndClassInfo = [ train = [ action = "train" - minibatchSize = 128:256:512 # TODO: Why is this here and not inside SGD? traceLevel = 1 epochSize = 0 # (for quick tests, this can be overridden with something small) - defaultHiddenActivity = 0.1 # default value for hidden states--is this used by SimpleNetworkBuilder? - useValidation = true SimpleNetworkBuilder = [ rnnType = "CLASSLSTM" # TODO: camelCase @@ -70,6 +67,7 @@ train = [ initValueScale = 6.0 uniformInit = true layerSizes = "$confVocabSize$:150:200:10000" + defaultHiddenActivity = 0.1 # default value for hidden states addPrior = false addDropoutNodes = false applyMeanVarNorm = false @@ -81,6 +79,7 @@ train = [ ] SGD = [ + minibatchSize = 128:256:512 learningRatesPerSample = 0.1 momentumPerMB = 0 gradientClippingWithTruncation = true @@ -90,6 +89,10 @@ train = [ gradUpdateType = "none" loadBestModel = true + dropoutRate = 0.0 + + #traceNodeNamesReal = AutoName37 # this allows to track a node's value + # settings for Auto Adjust Learning Rate AutoAdjust = [ autoAdjustLR = "adjustAfterEpoch" @@ -102,8 +105,6 @@ train = [ numPrevLearnRates = 5 numBestSearchEpoch = 1 ] - - dropoutRate = 0.0 ] reader = [ diff --git a/Source/CNTK/BrainScript/BrainScriptEvaluator.cpp b/Source/CNTK/BrainScript/BrainScriptEvaluator.cpp index a8b2904d30a7..d333c1c679eb 100644 --- a/Source/CNTK/BrainScript/BrainScriptEvaluator.cpp +++ b/Source/CNTK/BrainScript/BrainScriptEvaluator.cpp @@ -53,7 +53,7 @@ class EvaluationException : public ConfigException __declspec_noreturn static inline void EvaluationError(const wstring &msg, TextLocation where) { - Microsoft::MSR::CNTK::DebugUtil::PrintCallStack(); + //Microsoft::MSR::CNTK::DebugUtil::PrintCallStack(); throw EvaluationException(msg, where); } diff --git a/Source/CNTK/BrainScript/BrainScriptParser.cpp b/Source/CNTK/BrainScript/BrainScriptParser.cpp index 834fe04334a2..dab31e32b782 100644 --- a/Source/CNTK/BrainScript/BrainScriptParser.cpp +++ b/Source/CNTK/BrainScript/BrainScriptParser.cpp @@ -184,7 +184,7 @@ class CodeSource __declspec_noreturn static void Fail(wstring msg, TextLocation where) { - Microsoft::MSR::CNTK::DebugUtil::PrintCallStack(); + //Microsoft::MSR::CNTK::DebugUtil::PrintCallStack(); throw CodeSourceException(msg, where); } @@ -375,7 +375,7 @@ class Lexer : public CodeSource private: __declspec_noreturn static void Fail(wstring msg, Token where) { - Microsoft::MSR::CNTK::DebugUtil::PrintCallStack(); + //Microsoft::MSR::CNTK::DebugUtil::PrintCallStack(); throw LexerException(msg, where.beginLocation); } @@ -606,7 +606,7 @@ class Parser : public Lexer __declspec_noreturn static void Fail(const wstring& msg, Token where) { - Microsoft::MSR::CNTK::DebugUtil::PrintCallStack(); + //Microsoft::MSR::CNTK::DebugUtil::PrintCallStack(); throw ParseException(msg, where.beginLocation); } diff --git a/Source/CNTK/CNTK.cpp b/Source/CNTK/CNTK.cpp index 3db4a6cb5d2f..c35ee681ca53 100644 --- a/Source/CNTK/CNTK.cpp +++ b/Source/CNTK/CNTK.cpp @@ -579,11 +579,13 @@ int wmainOldCNTKConfig(int argc, wchar_t* argv[]) // called from wmain which is std::string timestamp = TimeDateStamp(); // dump config info - fprintf(stderr, "running on %s at %s\n", GetHostName().c_str(), timestamp.c_str()); - fprintf(stderr, "command line: \n"); + fprintf(stderr, "\nRunning on %s at %s\n", GetHostName().c_str(), timestamp.c_str()); + fprintf(stderr, "Command line: \n"); for (int i = 0; i < argc; i++) fprintf(stderr, "%*s%ls", i > 0 ? 2 : 0, "", argv[i]); // use 2 spaces for better visual separability + fprintf(stderr, "\n\n"); +#if 1 //def _DEBUG // This simply merges all the different config parameters specified (eg, via config files or via command line directly), // and prints it. fprintf(stderr, "\n\n>>>>>>>>>>>>>>>>>>>> RAW CONFIG (VARIABLES NOT RESOLVED) >>>>>>>>>>>>>>>>>>>>\n"); @@ -601,12 +603,12 @@ int wmainOldCNTKConfig(int argc, wchar_t* argv[]) // called from wmain which is fprintf(stderr, "\n>>>>>>>>>>>>>>>>>>>> PROCESSED CONFIG WITH ALL VARIABLES RESOLVED >>>>>>>>>>>>>>>>>>>>\n"); config.dumpWithResolvedVariables(); fprintf(stderr, "<<<<<<<<<<<<<<<<<<<< PROCESSED CONFIG WITH ALL VARIABLES RESOLVED <<<<<<<<<<<<<<<<<<<<\n"); +#endif - fprintf(stderr, "Commands: "); + fprintf(stderr, "Commands:"); for (int i = 0; i < command.size(); i++) - { - fprintf(stderr, "%s ", command[i].c_str()); - } + fprintf(stderr, " %s", command[i].c_str()); + fprintf(stderr, "\n"); // run commands std::string type = config(L"precision", "float"); @@ -614,7 +616,7 @@ int wmainOldCNTKConfig(int argc, wchar_t* argv[]) // called from wmain which is if (config.Exists("type")) InvalidArgument("CNTK: Use of 'type' parameter is deprecated, it is called 'precision' now."); - fprintf(stderr, "\nPrecision = \"%s\"\n", type.c_str()); + fprintf(stderr, "Precision = \"%s\"\n", type.c_str()); if (type == "float") DoCommands(config); else if (type == "double") diff --git a/Source/ComputationNetworkLib/ComputationNetworkEvaluation.cpp b/Source/ComputationNetworkLib/ComputationNetworkEvaluation.cpp index 8615dce8edd7..957c257da5fa 100644 --- a/Source/ComputationNetworkLib/ComputationNetworkEvaluation.cpp +++ b/Source/ComputationNetworkLib/ComputationNetworkEvaluation.cpp @@ -430,7 +430,7 @@ void ComputationNetwork::CompileNetwork() // STEP: Some final details. ResetEvalTimeStamps(); // invalidate all m_value fields. Really belongs into StartEvaluateMinibatchLoop() - fprintf(stderr, "\nPost-processing network complete.\n"); + fprintf(stderr, "\nPost-processing network complete.\n\n"); m_isCompiled = true; } @@ -531,11 +531,11 @@ void ComputationNetwork::ValidateNetwork() size_t toValidate = nodes.size(); while (toValidate > 0) { - fprintf(stderr, "\n\nValidating network. %d nodes to process in pass %d.\n", (int) toValidate, (int) pass); + fprintf(stderr, "\nValidating network. %d nodes to process in pass %d.\n\n", (int) toValidate, (int) pass); toValidate = ValidateNodes(nodes, /*isFirstPass=*/pass == 1, false /*isFinalValidationPass*/); pass++; } - fprintf(stderr, "\n\nValidating network, final pass.\n"); + fprintf(stderr, "\nValidating network, final pass.\n\n"); toValidate = ValidateNodes(nodes, /*isFirstPass=*/pass == 1, true /*isFinalValidationPass*/); if (toValidate != 0) LogicError("ValidateSubNetwork: ValidateNodes(true) unexpectedly returned with work left to do."); diff --git a/Source/ComputationNetworkLib/ComputationNetworkScripting.cpp b/Source/ComputationNetworkLib/ComputationNetworkScripting.cpp index acc3d004ab2d..e7f1be1803a9 100644 --- a/Source/ComputationNetworkLib/ComputationNetworkScripting.cpp +++ b/Source/ComputationNetworkLib/ComputationNetworkScripting.cpp @@ -107,10 +107,6 @@ ComputationNetwork::ComputationNetwork(const IConfigRecordPtr configp) // perform all necessary post-processing CompileNetwork(); -#if 1 - wstring args = ToString(); - fprintf(stderr, "%ls\n", args.c_str()); -#endif } // =================================================================== diff --git a/Source/ComputationNetworkLib/ComputationNode.h b/Source/ComputationNetworkLib/ComputationNode.h index 07a1928633b6..2f859c1d6495 100644 --- a/Source/ComputationNetworkLib/ComputationNode.h +++ b/Source/ComputationNetworkLib/ComputationNode.h @@ -1483,7 +1483,7 @@ class ComputationNode : public ComputationNodeBase // abstract class that cannot const std::string& valueFormatString) const; void Trace() { - if (m_traceNodeValue+1) + if (m_traceNodeValue) { fprintf(stderr, "Trace --> %s\n", FormatOperationPrototype("").c_str()); WriteMinibatchWithFormatting(stderr, m_traceNodeValueUpToDim, m_traceNodeValueUpToT, false/*transpose*/, m_traceNodeValueAsCategoryLabel, std::vector(), diff --git a/Source/SGDLib/SGD.cpp b/Source/SGDLib/SGD.cpp index 7c725a1e20ca..82404e2f2b5b 100644 --- a/Source/SGDLib/SGD.cpp +++ b/Source/SGDLib/SGD.cpp @@ -49,21 +49,21 @@ void SGD::Train(function createN } wstring modelFileName = GetModelNameForEpoch(int(startEpoch) - 1); - bool loadNetworkFromCheckpoint = false; - if (startEpoch >= 0) - { - loadNetworkFromCheckpoint = true; - fprintf(stderr, "Starting from checkpoint. Loading network from '%ls'.\n", modelFileName.c_str()); - } + bool loadNetworkFromCheckpoint = startEpoch >= 0; + if (loadNetworkFromCheckpoint) + fprintf(stderr, "\nStarting from checkpoint. Loading network from '%ls'.\n", modelFileName.c_str()); + else + fprintf(stderr, "\nCreating virgin network.\n"); // create or load from checkpoint shared_ptr net = !loadNetworkFromCheckpoint ? createNetworkFn(deviceId) : ComputationNetwork::CreateFromFile(deviceId, modelFileName); // log the device we are computing on + fprintf(stderr, "%s model with %d nodes", loadNetworkFromCheckpoint ? "Loaded" : "Created", (int)net->GetTotalNumberOfNodes()); if (net->GetDeviceId() < 0) - fprintf(stderr, "\nSGD using CPU.\n"); + fprintf(stderr, " on CPU.\n"); else - fprintf(stderr, "\nSGD using GPU %d.\n", (int) net->GetDeviceId()); + fprintf(stderr, " on GPU %d.\n", (int) net->GetDeviceId()); // TODO: BUGBUG: if not starting from checkpoint, need to synchronize initial model // strategy should be to run the initializer above on mpiRank==0, and then broadcast parameters.