Skip to content

Commit

Permalink
cleaned up log output
Browse files Browse the repository at this point in the history
  • Loading branch information
frankseide committed Mar 11, 2016
1 parent e64aec5 commit 52929f9
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 32 deletions.
11 changes: 6 additions & 5 deletions Examples/Text/PennTreebank/Config/rnn.cntk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -81,6 +79,7 @@ train = [
]

SGD = [
minibatchSize = 128:256:512
learningRatesPerSample = 0.1
momentumPerMB = 0
gradientClippingWithTruncation = true
Expand All @@ -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"
Expand All @@ -102,8 +105,6 @@ train = [
numPrevLearnRates = 5
numBestSearchEpoch = 1
]

dropoutRate = 0.0
]

reader = [
Expand Down
2 changes: 1 addition & 1 deletion Source/CNTK/BrainScript/BrainScriptEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
6 changes: 3 additions & 3 deletions Source/CNTK/BrainScript/BrainScriptParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down
16 changes: 9 additions & 7 deletions Source/CNTK/CNTK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -601,20 +603,20 @@ 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");
// accept old precision key for backward compatibility
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<float>(config);
else if (type == "double")
Expand Down
6 changes: 3 additions & 3 deletions Source/ComputationNetworkLib/ComputationNetworkEvaluation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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.");
Expand Down
4 changes: 0 additions & 4 deletions Source/ComputationNetworkLib/ComputationNetworkScripting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

// ===================================================================
Expand Down
2 changes: 1 addition & 1 deletion Source/ComputationNetworkLib/ComputationNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>(),
Expand Down
16 changes: 8 additions & 8 deletions Source/SGDLib/SGD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@ void SGD<ElemType>::Train(function<ComputationNetworkPtr(DEVICEID_TYPE)> 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<ComputationNetwork> net = !loadNetworkFromCheckpoint ? createNetworkFn(deviceId) : ComputationNetwork::CreateFromFile<ElemType>(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.
Expand Down

0 comments on commit 52929f9

Please sign in to comment.