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