mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-26 03:56:50 +08:00
Improve info messages.
This commit is contained in:
@@ -140,15 +140,12 @@ namespace Learner
|
||||
|
||||
void print(const std::string& prefix, ostream& s) const
|
||||
{
|
||||
s
|
||||
<< "--> "
|
||||
<< prefix << "_cross_entropy_eval = " << cross_entropy_eval / count
|
||||
<< " , " << prefix << "_cross_entropy_win = " << cross_entropy_win / count
|
||||
<< " , " << prefix << "_entropy_eval = " << entropy_eval / count
|
||||
<< " , " << prefix << "_entropy_win = " << entropy_win / count
|
||||
<< " , " << prefix << "_cross_entropy = " << cross_entropy / count
|
||||
<< " , " << prefix << "_entropy = " << entropy / count
|
||||
<< endl;
|
||||
s << "==> " << prefix << "_cross_entropy_eval = " << cross_entropy_eval / count << endl;
|
||||
s << "==> " << prefix << "_cross_entropy_win = " << cross_entropy_win / count << endl;
|
||||
s << "==> " << prefix << "_entropy_eval = " << entropy_eval / count << endl;
|
||||
s << "==> " << prefix << "_entropy_win = " << entropy_win / count << endl;
|
||||
s << "==> " << prefix << "_cross_entropy = " << cross_entropy / count << endl;
|
||||
s << "==> " << prefix << "_entropy = " << entropy / count << endl;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -678,11 +675,13 @@ namespace Learner
|
||||
TimePoint elapsed = now() - Search::Limits.startTime + 1;
|
||||
|
||||
cout << "\n";
|
||||
cout << "PROGRESS (calc_loss): " << now_string() << ", ";
|
||||
cout << total_done << " sfens, ";
|
||||
cout << total_done * 1000 / elapsed << " sfens/second";
|
||||
cout << ", iteration " << epoch;
|
||||
cout << ", learning rate = " << global_learning_rate << ", ";
|
||||
cout << "PROGRESS (calc_loss): " << now_string()
|
||||
<< ", " << total_done << " sfens"
|
||||
<< ", " << total_done * 1000 / elapsed << " sfens/second"
|
||||
<< ", epoch " << epoch
|
||||
<< endl;
|
||||
|
||||
cout << "==> learning rate = " << global_learning_rate << endl;
|
||||
|
||||
// For calculation of verification data loss
|
||||
AtomicLoss test_loss_sum{};
|
||||
@@ -699,7 +698,7 @@ namespace Learner
|
||||
auto& pos = th.rootPos;
|
||||
StateInfo si;
|
||||
pos.set(StartFEN, false, &si, &th);
|
||||
cout << "startpos eval = " << Eval::evaluate(pos) << endl;
|
||||
cout << "==> startpos eval = " << Eval::evaluate(pos) << endl;
|
||||
});
|
||||
mainThread->wait_for_worker_finished();
|
||||
|
||||
@@ -722,16 +721,15 @@ namespace Learner
|
||||
|
||||
if (psv.size() && test_loss_sum.count > 0.0)
|
||||
{
|
||||
cout << "--> norm = " << sum_norm
|
||||
<< " , move accuracy = " << (move_accord_count * 100.0 / psv.size()) << "%"
|
||||
<< endl;
|
||||
|
||||
test_loss_sum.print("test", cout);
|
||||
|
||||
if (learn_loss_sum.count > 0.0)
|
||||
{
|
||||
learn_loss_sum.print("learn", cout);
|
||||
}
|
||||
|
||||
cout << "==> norm = " << sum_norm << endl;
|
||||
cout << "==> move accuracy = " << (move_accord_count * 100.0 / psv.size()) << "%" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -847,7 +845,8 @@ namespace Learner
|
||||
const double latest_loss = latest_loss_sum / latest_loss_count;
|
||||
latest_loss_sum = 0.0;
|
||||
latest_loss_count = 0;
|
||||
cout << "loss: " << latest_loss;
|
||||
cout << "INFO (learning_rate):" << endl;
|
||||
cout << "==> loss = " << latest_loss;
|
||||
auto tot = total_done;
|
||||
if (auto_lr_drop)
|
||||
{
|
||||
@@ -877,7 +876,7 @@ namespace Learner
|
||||
if (--trials > 0 && !is_final)
|
||||
{
|
||||
cout
|
||||
<< "reducing learning rate from " << global_learning_rate
|
||||
<< "==> reducing learning rate from " << global_learning_rate
|
||||
<< " to " << (global_learning_rate * newbob_decay)
|
||||
<< " (" << trials << " more trials)" << endl;
|
||||
|
||||
@@ -887,7 +886,7 @@ namespace Learner
|
||||
|
||||
if (trials == 0)
|
||||
{
|
||||
cout << "converged" << endl;
|
||||
cout << "==> converged" << endl;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace Learner{
|
||||
PackedSfenValue ps;
|
||||
if (!read_to_thread_buffer(0, ps))
|
||||
{
|
||||
std::cout << "Error! read packed sfen , failed." << std::endl;
|
||||
std::cout << "ERROR (sfen_reader): Reading failed." << std::endl;
|
||||
return sfen_for_mse;
|
||||
}
|
||||
|
||||
@@ -211,16 +211,16 @@ namespace Learner{
|
||||
|
||||
if (sfen_input_stream == nullptr)
|
||||
{
|
||||
std::cout << "File does not exist: " << currentFilename << '\n';
|
||||
std::cout << "INFO (sfen_reader): File does not exist: " << currentFilename << '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Opened file for reading: " << currentFilename << '\n';
|
||||
std::cout << "INFO (sfen_reader): Opened file for reading: " << currentFilename << '\n';
|
||||
|
||||
// in case the file is empty or was deleted.
|
||||
if (sfen_input_stream->eof())
|
||||
{
|
||||
std::cout << "File empty, nothing to read.\n";
|
||||
std::cout << "INFO (sfen_reader): File empty, nothing to read.\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -232,7 +232,7 @@ namespace Learner{
|
||||
|
||||
if (sfen_input_stream == nullptr && !open_next_file())
|
||||
{
|
||||
std::cout << "..end of files." << std::endl;
|
||||
std::cout << "INFO (sfen_reader): End of files." << std::endl;
|
||||
end_of_files = true;
|
||||
return;
|
||||
}
|
||||
@@ -271,7 +271,7 @@ namespace Learner{
|
||||
if(!open_next_file())
|
||||
{
|
||||
// There was no next file. Abort.
|
||||
std::cout << "..end of files." << std::endl;
|
||||
std::cout << "INFO (sfen_reader): End of files." << std::endl;
|
||||
end_of_files = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ namespace Eval::NNUE {
|
||||
// save merit function parameters to a file
|
||||
void save_eval(std::string dir_name) {
|
||||
auto eval_dir = Path::combine(Options["EvalSaveDir"], dir_name);
|
||||
std::cout << "save_eval() start. folder = " << eval_dir << std::endl;
|
||||
std::cout << "INFO (save_eval): Saving current evaluation file in " << eval_dir << std::endl;
|
||||
|
||||
// mkdir() will fail if this folder already exists, but
|
||||
// Apart from that. If not, I just want you to make it.
|
||||
@@ -261,7 +261,5 @@ namespace Eval::NNUE {
|
||||
#ifndef NDEBUG
|
||||
assert(result);
|
||||
#endif
|
||||
|
||||
std::cout << "save_eval() finished. folder = " << eval_dir << std::endl;
|
||||
}
|
||||
} // namespace Eval::NNUE
|
||||
@@ -100,11 +100,11 @@ namespace Eval::NNUE {
|
||||
std::begin(max_activations_), std::end(max_activations_));
|
||||
|
||||
std::cout << "INFO (check_health):"
|
||||
<< " layer = " << LayerType::kLayerIndex
|
||||
<< " , name = " << LayerType::get_name()
|
||||
<< " layer " << LayerType::kLayerIndex
|
||||
<< " - " << LayerType::get_name()
|
||||
<< std::endl;
|
||||
|
||||
std::cout << "--> largest min activation = " << largest_min_activation
|
||||
std::cout << "==> largest min activation = " << largest_min_activation
|
||||
<< " , smallest max activation = " << smallest_max_activation
|
||||
<< std::endl;
|
||||
|
||||
|
||||
@@ -331,11 +331,11 @@ namespace Eval::NNUE {
|
||||
// Check if there are any problems with learning
|
||||
void check_health() {
|
||||
std::cout << "INFO (check_health):"
|
||||
<< " layer = " << LayerType::kLayerIndex
|
||||
<< " , name = " << LayerType::get_name()
|
||||
<< " layer " << LayerType::kLayerIndex
|
||||
<< " - " << LayerType::get_name()
|
||||
<< std::endl;
|
||||
|
||||
std::cout << "--> observed " << observed_features.count()
|
||||
std::cout << "==> observed " << observed_features.count()
|
||||
<< " (out of " << kInputDimensions << ") features"
|
||||
<< std::endl;
|
||||
|
||||
@@ -343,7 +343,7 @@ namespace Eval::NNUE {
|
||||
std::numeric_limits<typename LayerType::WeightType>::max() /
|
||||
kWeightScale;
|
||||
|
||||
std::cout << "--> (min, max) of pre-activations = "
|
||||
std::cout << "==> (min, max) of pre-activations = "
|
||||
<< min_pre_activation_ << ", "
|
||||
<< max_pre_activation_ << " (limit = "
|
||||
<< kPreActivationLimit << ")"
|
||||
@@ -354,7 +354,7 @@ namespace Eval::NNUE {
|
||||
const auto smallest_max_activation = *std::min_element(
|
||||
std::begin(max_activations_), std::end(max_activations_));
|
||||
|
||||
std::cout << "--> largest min activation = " << largest_min_activation
|
||||
std::cout << "==> largest min activation = " << largest_min_activation
|
||||
<< " , smallest max activation = " << smallest_max_activation
|
||||
<< std::endl;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user