Open killerducky opened 6 years ago
Procedure to debug games: Get a pgn file. If training game from server: Copy pgn moves, paste into test.pgn. Add header and footer, not sure how much you need but this worked for me:
[Event "LCZero training"]
[Result "1-0"]
1. e4 f6 2. d4 d6 3. c4 a5 4. Nc3 e5 1-0
Load pgn into GUI (I used scid), go to position of interest, get the FEN code (Edit->Copy Position in scid). Run ./lczero -w ~/lcnetworks/latest.txt -p800 --noponder -t1
, optionally add -n
. Load position with position fen FEN_CODE
e.g. position fen 8/8/5k2/1P3np1/1rP1p2p/5Pr1/3qB3/K7 b - - 2 46
. Tell engine to think go
.
You can also put the UCI commands into a file and do cat commands.txt | ./lczero args
Here you can copy-paste pgn without any headers, and get fen at the bottom of any position in it. https://www.chess.com/analysis-board-editor
I just realized debugging using FEN only is broken, because it doesn't include the 8 moves of history. The network will be very confused by the 7 blank planes and then a position that is not the game start. You need to send the FEN from 8 moves before, and add in the 8 moves. Or send in the entire game history.
Ok new procedure for debug. Maybe this weekend I can add some stuff to make this smoother, I think adding a -l log.txt
to lzchess and then connecting scid will work because then you can drive with GUI and see debug output in logfile.
For now I did this:
Download from https://www.cs.kent.ac.uk/people/staff/djb/pgn-extract
~/projects/pgn-extract/pgn-extract missmate.pgn -Wuci
Cut output at the point you want to test, and put into a file e.g. missmate.cmd:
position startpos moves e2e4 f7f6 d2d4 d7d6 c2c4 a7a5 b1c3 e7e5 g1e2 c8e6 d4e5 c7c6 e5f6 h7h5 c3d5 e6d5 d1d5 c6d5 b2b4 d5e4 b4a5 a8a5 c1h6 g8f6 h2h3 b8c6 a1b1 b7b5 b1b5 c6d4 a2a4 d4b5 h6f4 h5h4 e1d2 f6d5 e2c1 d8d7 a4b5 g7g6 f4h6 d5e7 h1g1 e7f5 c1a2 e8e7 g2g4 f5h6 a2b4 d6d5 b4d5 e7e6 d2e1 d7a7 f1g2 a7a8 d5f6 e6f6 g4g5 f6g5 g1h1 a8b8 h1f1 b8b6 f1g1 f8b4 e1d1 g5f6 d1c2 a5a3 g2f1 h6f5 f1e2 a3h3 g1a1 b4a5 c2b2 b6e3 a1a5 e3d2 b2a1 g6g5 a5a3 h3g3 a3a8 h8a8 a1b1 a8a4 f2f3 a4b4 b1a1
go
quit
Generate logfiles for different gen nets:
rm gen006_de1d.log; cat missmate.cmd | ./lczero -w ~/lcnetworks/gen006_de1d -t1 -s1 -p800 --noponder &>> gen006_de1d.log
rm gen009_b91f.log; cat missmate.cmd | ./lczero -w ~/lcnetworks/gen009_b91f -t1 -s1 -p800 --noponder &>> gen009_b91f.log
rm gen011_6d2e.log; cat missmate.cmd | ./lczero -w ~/lcnetworks/gen011_6d2e -t1 -s1 -p800 --noponder &>> gen011_6d2e.log
I was editing local text files when I figured why not use the wiki instead, so I dumped some stuff here: https://github.com/glinscott/leela-chess/wiki/Debug-and-test-procedures
I figured I would start an issue for this. We need to find a GUI that supports loading pgn, going to different positions, and shows the full engine output, not just PV etc. And/or enhancing the raw LZChess text output to also show a board would help for when you use command line only.
If anyone knows of a GUI let us know. Adding a text board display to LZChess would be a nice easy project for someone looking to start contributing. We need more programmers! :)