1
0
Fork 0
Commit Graph

304 Commits (5640ad48ae5881223b868362c1cbeb042947f7b4)

Author SHA1 Message Date
Tomasz Sobczyk d76be2f428
Merge branch 'tools' into tools_merge 2021-08-09 13:06:54 +02:00
Tomasz Sobczyk 368bd2e4f9 most-merge fixes 2021-08-09 13:01:52 +02:00
Tomasz Sobczyk 51b4e7bd6e Merge branch 'tools' into tools_merge 2021-08-09 11:39:42 +02:00
Joost VandeVondele dc4983327d Update WDL model for NNUE
This updates the WDL model based on the LTC statistics in June this year (10M games),
so from pre-NNUE to NNUE based results.

(for old results see, https://github.com/official-stockfish/Stockfish/pull/2778)

As before the fit by the model to the data is quite good.

closes https://github.com/official-stockfish/Stockfish/pull/3582

No functional change
2021-06-28 21:13:30 +02:00
Tomasz Sobczyk 2e745956c0 Change trace with NNUE eval support
This patch adds some more output to the `eval` command. It adds a board display
with estimated piece values (method is remove-piece, evaluate, put-piece), and
splits the NNUE evaluation with (psqt,layers) for each bucket for the NNUE net.

Example:

```

./stockfish
position fen 3Qb1k1/1r2ppb1/pN1n2q1/Pp1Pp1Pr/4P2p/4BP2/4B1R1/1R5K b - - 11 40
eval

 Contributing terms for the classical eval:
+------------+-------------+-------------+-------------+
|    Term    |    White    |    Black    |    Total    |
|            |   MG    EG  |   MG    EG  |   MG    EG  |
+------------+-------------+-------------+-------------+
|   Material |  ----  ---- |  ----  ---- | -0.73 -1.55 |
|  Imbalance |  ----  ---- |  ----  ---- | -0.21 -0.17 |
|      Pawns |  0.35 -0.00 |  0.19 -0.26 |  0.16  0.25 |
|    Knights |  0.04 -0.08 |  0.12 -0.01 | -0.08 -0.07 |
|    Bishops | -0.34 -0.87 | -0.17 -0.61 | -0.17 -0.26 |
|      Rooks |  0.12  0.00 |  0.08  0.00 |  0.04  0.00 |
|     Queens |  0.00  0.00 | -0.27 -0.07 |  0.27  0.07 |
|   Mobility |  0.84  1.76 |  0.01  0.66 |  0.83  1.10 |
|King safety | -0.99 -0.17 | -0.72 -0.10 | -0.27 -0.07 |
|    Threats |  0.27  0.27 |  0.73  0.86 | -0.46 -0.59 |
|     Passed |  0.00  0.00 |  0.79  0.82 | -0.79 -0.82 |
|      Space |  0.61  0.00 |  0.24  0.00 |  0.37  0.00 |
|   Winnable |  ----  ---- |  ----  ---- |  0.00 -0.03 |
+------------+-------------+-------------+-------------+
|      Total |  ----  ---- |  ----  ---- | -1.03 -2.14 |
+------------+-------------+-------------+-------------+

 NNUE derived piece values:
+-------+-------+-------+-------+-------+-------+-------+-------+
|       |       |       |   Q   |   b   |       |   k   |       |
|       |       |       | +12.4 | -1.62 |       |       |       |
+-------+-------+-------+-------+-------+-------+-------+-------+
|       |   r   |       |       |   p   |   p   |   b   |       |
|       | -3.89 |       |       | -0.84 | -1.19 | -3.32 |       |
+-------+-------+-------+-------+-------+-------+-------+-------+
|   p   |   N   |       |   n   |       |       |   q   |       |
| -1.81 | +3.71 |       | -4.82 |       |       | -5.04 |       |
+-------+-------+-------+-------+-------+-------+-------+-------+
|   P   |   p   |       |   P   |   p   |       |   P   |   r   |
| +1.16 | -0.91 |       | +0.55 | +0.12 |       | +0.50 | -4.02 |
+-------+-------+-------+-------+-------+-------+-------+-------+
|       |       |       |       |   P   |       |       |   p   |
|       |       |       |       | +2.33 |       |       | +1.17 |
+-------+-------+-------+-------+-------+-------+-------+-------+
|       |       |       |       |   B   |   P   |       |       |
|       |       |       |       | +4.79 | +1.54 |       |       |
+-------+-------+-------+-------+-------+-------+-------+-------+
|       |       |       |       |   B   |       |   R   |       |
|       |       |       |       | +4.54 |       | +6.03 |       |
+-------+-------+-------+-------+-------+-------+-------+-------+
|       |   R   |       |       |       |       |       |   K   |
|       | +4.81 |       |       |       |       |       |       |
+-------+-------+-------+-------+-------+-------+-------+-------+

 NNUE network contributions (Black to move)
+------------+------------+------------+------------+
|   Bucket   |  Material  | Positional |   Total    |
|            |   (PSQT)   |  (Layers)  |            |
+------------+------------+------------+------------+
|  0         |  +  0.32   |  -  1.46   |  -  1.13   |
|  1         |  +  0.25   |  -  0.68   |  -  0.43   |
|  2         |  +  0.46   |  -  1.72   |  -  1.25   |
|  3         |  +  0.55   |  -  1.80   |  -  1.25   |
|  4         |  +  0.48   |  -  1.77   |  -  1.29   |
|  5         |  +  0.40   |  -  2.00   |  -  1.60   |
|  6         |  +  0.57   |  -  2.12   |  -  1.54   | <-- this bucket is used
|  7         |  +  3.38   |  -  2.00   |  +  1.37   |
+------------+------------+------------+------------+

Classical evaluation   -1.00 (white side)
NNUE evaluation        +1.54 (white side)
Final evaluation       +2.38 (white side) [with scaled NNUE, hybrid, ...]

```

Also renames the export_net() function to save_eval() while there.

closes https://github.com/official-stockfish/Stockfish/pull/3562

No functional change
2021-06-19 11:57:01 +02:00
Tomasz Sobczyk 9094255f50 Add primitive MCTS search. 2021-06-17 16:05:12 +02:00
Tomasz Sobczyk eac1d430b4 Add dedicated command for training data validation. 2021-05-24 19:43:36 +02:00
Tomasz Sobczyk a4605860c6 Post-merge fixes. 2021-05-24 11:45:21 +02:00
Tomasz Sobczyk 8f0dbc9348 Merge remote-tracking branch 'upstream/master' into tools_merge_20210513 2021-05-13 10:53:57 +02:00
Tomasz Sobczyk 58054fd0fa Exporting the currently loaded network file
This PR adds an ability to export any currently loaded network.
The export_net command now takes an optional filename parameter.
If the loaded net is not the embedded net the filename parameter is required.

Two changes were required to support this:

* the "architecture" string, which is really just a some kind of description in the net, is now saved into netDescription on load and correctly saved on export.
* the AffineTransform scrambles weights for some architectures and sparsifies them, such that retrieving the index is hard. This is solved by having a temporary scrambled<->unscrambled index lookup table when loading the network, and the actual index is saved for each individual weight that makes it to canSaturate16. This increases the size of the canSaturate16 entries by 6 bytes.

closes https://github.com/official-stockfish/Stockfish/pull/3456

No functional change
2021-05-11 19:36:11 +02:00
Tomasz Sobczyk ca250e969c Add an UCI level command "export_net".
This command writes the embedded net to the file `EvalFileDefaultName`.
If there is no embedded net the command does nothing.

fixes #3453

closes https://github.com/official-stockfish/Stockfish/pull/3454

No functional change
2021-05-07 09:45:08 +02:00
Tomasz Sobczyk ba32bd5d70 Bring the changes closer to official-stockfish/master 2021-04-19 18:57:21 +02:00
Tomasz Sobczyk 19f712cdbb Post-merge fixes. 2021-04-18 20:33:49 +02:00
Tomasz Sobczyk 08e255960d Merge remote-tracking branch 'upstream/master' into data_generation 2021-04-18 19:45:46 +02:00
Tomasz Sobczyk 696e849a30 learn -> tools 2021-04-18 19:18:41 +02:00
Tomasz Sobczyk 3101ae7973 remove learn 2021-04-18 19:04:14 +02:00
mattginsberg 5346f1c6c7 Deal with commented lines in UCI input
commands starting with '#' as the first character will be ignored

closes https://github.com/official-stockfish/Stockfish/pull/3378

No functional change
2021-03-07 21:10:04 +01:00
Dieter Dobbelaere 7ffae17f85 Add Stockfish namespace.
fixes #3350 and is a small cleanup that might make it easier to use SF
in separate projects, like a NNUE trainer or similar.

closes https://github.com/official-stockfish/Stockfish/pull/3370

No functional change.
2021-03-07 14:26:54 +01:00
Tomasz Sobczyk 0ddad45ab2 Add `gather_statistics` command that allows gathering statistics from a .bin or .binpack file. Initially only support position count. 2021-03-01 00:36:45 +09:00
Joost VandeVondele c4d67d77c9 Update copyright years
No functional change
2021-01-08 17:04:23 +01:00
Tomasz Sobczyk 96b377a90a Add gensfen_nonpv 2020-12-24 21:37:30 +09:00
Tomasz Sobczyk 89294e2e4f Add transform command. Add transform nudged_static subcommand. 2020-11-27 09:16:22 +09:00
Tomasz Sobczyk c56a4a36eb Add our own blas-like routines that use stockfish's thread pool for parallelization. 2020-10-29 23:57:51 +09:00
Tomasz Sobczyk c229929d26 Remove the position parameter from learn. 2020-10-27 00:35:43 +09:00
Tomasz Sobczyk 6d4d20c4be Cleaner printing and some renaming. 2020-10-26 09:37:59 +09:00
Tomasz Sobczyk c7ac3688a7 Move the old convert stuff from learn to their own commands. 2020-10-24 08:52:42 +09:00
Tomasz Sobczyk 74af287637 Fix execute_with_workers test call in uci 2020-10-20 19:19:32 +09:00
Tomasz Sobczyk 5188c26b20 Allow execution of tasks on the global thread pool. 2020-10-20 19:19:32 +09:00
Tomasz Sobczyk 146a6b056e PascalCase -> snake_case for consistency with the rest of the codebase. 2020-10-19 18:37:23 +09:00
Tomasz Sobczyk 5db46d0c82 Verify whether there is a network being used during training. 2020-10-17 08:44:38 +09:00
Tomasz Sobczyk 14f83ad7b9 Move public search/qsearch interface from namespace Learner to namespace Search 2020-10-15 20:37:03 +09:00
Tomasz Sobczyk 0494adeb2c Move nnue evaluation stuff from evaluate.h to nnue/evaluate_nnue.h 2020-10-15 20:37:03 +09:00
Tomasz Sobczyk 5fa28b12fa Allow setting UCI options programmatically. 2020-10-07 23:09:33 +09:00
noobpwnftw 5be8b573be Merge remote-tracking branch 'remotes/origin/master' into trainer 2020-09-23 19:02:27 +08:00
noobpwnftw 411adab149 Merge remote-tracking branch 'remotes/nodchip/master' into trainer 2020-09-23 18:29:30 +08:00
Stéphane Nicolet 9a64e737cf Small cleanups 12
- Clean signature of functions in namespace NNUE
- Add comment for countermove based pruning
- Remove bestMoveCount variable
- Add const qualifier to kpp_board_index array
- Fix spaces in get_best_thread()
- Fix indention in capture LMR code in search.cpp
- Rename TtmemDeleter to LargePageDeleter

Closes https://github.com/official-stockfish/Stockfish/pull/3063

No functional change
2020-09-21 10:41:10 +02:00
noobpwnftw 26f63fe741 Merge remote-tracking branch 'remotes/origin/master' into trainer 2020-09-19 03:38:37 +08:00
noobpwnftw a47a3bfc7c Merge remote-tracking branch 'remotes/nodchip/master' into trainer 2020-09-19 02:14:17 +08:00
GoldenRare df43805953 Added FEN string to bench output
fixes https://github.com/official-stockfish/Stockfish/pull/3117

closes https://github.com/official-stockfish/Stockfish/pull/3118

No functional change
2020-09-17 07:06:21 +02:00
Tomasz Sobczyk d33e7a9b07 Remove conditional compilation on EVAL_LEARN 2020-09-12 16:19:24 +02:00
Tomasz Sobczyk 683c6146ce Move declarations around and split them. 2020-09-11 21:53:17 +09:00
Tomasz Sobczyk c76bb34a96 Add convert UCI function that allows conversion of files between any of plain, bin, and binpack. Usage: convert infile outfile [append]. 2020-09-11 09:36:24 +09:00
nodchip 458771a181 Removed GENSFEN2019 macro. 2020-09-09 10:26:42 +09:00
nodchip 1d00d00241 Removed ENABLE_TEST_CMD macro. 2020-09-09 10:26:42 +09:00
nodchip a6013557f2 Removed EVAL_NNUE macro. 2020-09-09 10:26:42 +09:00
nodchip 906c18eb46 Merge branch 'master' of github.com:official-stockfish/Stockfish into nnue-player-merge-2020-08-28
# Conflicts:
#	README.md
#	src/Makefile
#	src/search.cpp
#	src/types.h
#	src/uci.cpp
#	src/ucioption.cpp
2020-08-28 11:26:11 +09:00
tttak 4ce30d9522 Use winning_percentage_wdl in learn 2020-08-24 22:56:08 +09:00
Joost VandeVondele 5f1843c9cb Small trivial cleanups
closes https://github.com/official-stockfish/Stockfish/pull/2801

No functional change
2020-08-23 01:53:41 +02:00
nodchip 4f97d3446d Cleaned up source code. 2020-08-10 08:52:34 +09:00
nodchip 2395833c07 Re-added commands for training data generator and trainer. 2020-08-08 16:52:18 +09:00