Skip to content
Snippets Groups Projects
Commit 9fb78420 authored by Franck Dary's avatar Franck Dary
Browse files

Print time during training

parent 7e7d8d52
No related branches found
No related tags found
No related merge requests found
......@@ -54,6 +54,8 @@ bool isSeparator(utf8char c);
bool isIllegal(utf8char c);
std::string getTime();
template <typename T>
bool isEmpty(const std::vector<T> & s)
{
......
......@@ -186,3 +186,14 @@ std::vector<std::filesystem::path> util::findFilesByExtension(std::filesystem::p
return files;
}
std::string util::getTime()
{
std::time_t rawtime;
char buffer[80];
std::time(&rawtime);
std::strftime(buffer, sizeof(buffer), "%H:%M:%S", std::localtime(&rawtime));
return std::string(buffer);
}
......@@ -92,7 +92,7 @@ int MacaonTrain::main()
bool printAdvancement = !debug && variables.count("silent") == 0 ? true : false;
bool computeDevScore = variables.count("devScore") == 0 ? false : true;
fmt::print(stderr, "Training using device : {}\n", NeuralNetworkImpl::device.str());
fmt::print(stderr, "[{}] Training using device : {}\n", util::getTime(), NeuralNetworkImpl::device.str());
try
{
......@@ -159,10 +159,9 @@ int MacaonTrain::main()
bestDevScore = devScoreMean;
machine.save();
}
if (debug)
fmt::print(stderr, "Epoch {:^5} loss = {:6.1f} dev = {} {:5}\n", fmt::format("{}/{}", i+1, nbEpoch), loss, devScoresStr, saved ? "SAVED" : "");
else
fmt::print(stderr, "\r{:80}\rEpoch {:^5} loss = {:6.1f} dev = {} {:5}\n", " ", fmt::format("{}/{}", i+1, nbEpoch), loss, devScoresStr, saved ? "SAVED" : "");
if (!debug)
fmt::print(stderr, "\r{:80}\r", "");
fmt::print(stderr, "[{}] Epoch {:^5} loss = {:6.1f} dev = {} {:5}\n", util::getTime(), fmt::format("{}/{}", i+1, nbEpoch), loss, devScoresStr, saved ? "SAVED" : "");
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment