From c59583bbf06e69cb367b835b0d5e8f2555bb77c2 Mon Sep 17 00:00:00 2001 From: FireFather Date: Tue, 7 Jul 2020 23:25:20 +0200 Subject: [PATCH] UCI option EvalFile Replace EvalDir with EvalFile Can now browse filesystem for net (eval\nn.bin is default) nn.bin no longer hard-coded --- src/eval/nnue/evaluate_nnue.cpp | 6 +++--- src/eval/nnue/evaluate_nnue.h | 2 +- src/ucioption.cpp | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/eval/nnue/evaluate_nnue.cpp b/src/eval/nnue/evaluate_nnue.cpp index bc06ea31..27c79605 100644 --- a/src/eval/nnue/evaluate_nnue.cpp +++ b/src/eval/nnue/evaluate_nnue.cpp @@ -23,7 +23,7 @@ AlignedPtr feature_transformer; AlignedPtr network; // Evaluation function file name -const char* const kFileName = "nn.bin"; +const char* kFileName = "eval\\nn.bin"; // Get a string that represents the structure of the evaluation function std::string GetArchitectureString() { @@ -243,8 +243,8 @@ void load_eval() { return; } - const std::string dir_name = Options["EvalDir"]; - const std::string file_name = Path::Combine(dir_name, NNUE::kFileName); + const std::string file_name = Options["EvalFile"]; + NNUE::kFileName = file_name.c_str(); std::ifstream stream(file_name, std::ios::binary); const bool result = NNUE::ReadParameters(stream); diff --git a/src/eval/nnue/evaluate_nnue.h b/src/eval/nnue/evaluate_nnue.h index ee498f51..6fb45277 100644 --- a/src/eval/nnue/evaluate_nnue.h +++ b/src/eval/nnue/evaluate_nnue.h @@ -36,7 +36,7 @@ extern AlignedPtr feature_transformer; extern AlignedPtr network; // Evaluation function file name -extern const char* const kFileName; +extern const char* kFileName; // Get a string that represents the structure of the evaluation function std::string GetArchitectureString(); diff --git a/src/ucioption.cpp b/src/ucioption.cpp index f067a875..d98d82b1 100644 --- a/src/ucioption.cpp +++ b/src/ucioption.cpp @@ -42,7 +42,7 @@ void on_hash_size(const Option& o) { TT.resize(size_t(o)); } void on_logger(const Option& o) { start_logger(o); } void on_threads(const Option& o) { Threads.set(size_t(o)); } void on_tb_path(const Option& o) { Tablebases::init(o); } -void on_eval_dir(const Option& o) { load_eval_finished = false; init_nnue(); } +void on_eval_file(const Option& o) { load_eval_finished = false; init_nnue(); } /// Our case insensitive less() function as required by UCI protocol @@ -80,12 +80,12 @@ void init(OptionsMap& o) { o["SyzygyProbeDepth"] << Option(1, 1, 100); o["Syzygy50MoveRule"] << Option(true); o["SyzygyProbeLimit"] << Option(7, 0, 7); - // Evaluation function folder. When this is changed, it is necessary to reread the evaluation function at the next isready timing. - o["EvalDir"] << Option("eval", on_eval_dir); - // When the evaluation function is loaded at the isready timing, it is necessary to convert the new evaluation function. + // Evaluation function file name. When this is changed, it is necessary to reread the evaluation function at the next ucinewgame timing. + o["EvalFile"] << Option("eval\\nn.bin", on_eval_file); + // When the evaluation function is loaded at the ucinewgame timing, it is necessary to convert the new evaluation function. // I want to hit the test eval convert command, but there is no new evaluation function // It ends abnormally before executing this command. - // Therefore, with this hidden option, you can suppress the loading of the evaluation function when isready, + // Therefore, with this hidden option, you can suppress the loading of the evaluation function when ucinewgame, // Hit the test eval convert command. o["SkipLoadingEval"] << Option(false); // how many moves to use a fixed move