Closed borg323 closed 4 years ago
Reading from a PGN database might be another not-so-hard way of doing it. Pgnlib works ok for small databases: https://github.com/DanielUranga/trainingdata-tool/tree/pgnlib/pgnlib and https://sourceforge.net/projects/pgnlib/ We could make a git submodule for it.
pgnlib is not compatible with our licence. (pgnlib is GPL, we are "GPL with exception")
To PGN parsing, I'd prefer a text file with one position per line, in formats like:
startpost moves e2e4 e7e5
fen rnbqnrk1/pp2ppbp/6p1/4P3/3P1N2/5NP1/PP3PBP/R1BQK2R b KQ - 4 11
It may be e.g. two params, --position="startpos moves e2e4"
(to pass it as a string) and --position-file=filename
I don't see anything wrong with --position=file:filename
or --position=file=filename
. We can reuse the uci position parsing for this (with the file
extension) so that --position="fen rnbqnrk1/pp2ppbp/6p1/4P3/3P1N2/5NP1/PP3PBP/R1BQK2R b KQ - 4 11 moves a2a4
will also work.
We also need a mechanism to specify how to select a line from the file. We certainly don't want each user to train on one opening only.
The "canonical" way to pass parameters as file is to prefix them with @
. E.g. --position=@filename.txt
.
But I didn't like it (a bit) because corresponding Uci parameter then wouldn't have file
in the name, and chess GUI won't show file selection dialog.
But we don't use chess GUI with selfplay mode anyway.
For "how to select line", I think shuffling it in the beginning, and then doing round-robin in shuffled array would be fine.
I'm pretty sure that this is implemented now for the FRC run and @Ttl experiments, but I can't find the merged PR. Would be nice if someone could link the relevant PR(s) and close this issue.
There are several rellated PRs #1060 #1135 #1142 #1178 #1227, https://github.com/LeelaChessZero/lczero-client/pull/79 https://github.com/LeelaChessZero/lczero-client/pull/113 and https://github.com/Tilps/chess/pull/3
There was some discussion of discord starting here. The main options are:
1. Accept fen and moves from the command line (or a uci position command).3. Uselc0 selfplay --interactive
Option 1 is simple to implement in lc0, and client has most of the code needed (e.g. https://github.com/borg323/lczero-client/commit/38db0018b203f068ecfb14e5b93444e0284439e3 adds client support for using a book in test matches). The main drawback is that the client will need to stop and restart lc0 periodically to change start position, adding complexity and overhead.
Option 2 adds more complexity to lc0 (reading the file, selecting position) but the client needs only to download the file.
Option 3 needs no work in lc0, but adds a lot of complexity to the client. In particular, handling of parallelism is a big change: currently test match play (which is similar) does not supporting parallelism.
Comments? If there are any other options suggested, I'll update the above list.
Update: given the latest client changes to always use selfplay, only option 2 is still viable.