diff --git a/.gitignore b/.gitignore index 9f0257e..a099177 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ lichess_elite_db/ *.pyc stockfish_20090216_x64_avx2.exe stockfish_20090216_x64_bmi2.exe +Lichess Elite Database/ diff --git a/README.md b/README.md index 19714c0..5578d43 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ # tj-chess -https://www.reddit.com/r/chess/comments/gz8acg/introducing_the_lichess_elite_database/ for the torrent containing the elite games in the database. \ No newline at end of file +https://www.reddit.com/r/chess/comments/gz8acg/introducing_the_lichess_elite_database/ for the torrent containing the elite games in the database. + +https://lczero.org/dev/backend/nn/ for the network topology of Leela Chess Zero and http://lczero.org/dev/wiki/technical-explanation-of-leela-chess-zero/ for explanations. \ No newline at end of file diff --git a/overview.svg b/overview.svg index 5f46e1a..9e131fe 100644 --- a/overview.svg +++ b/overview.svg @@ -7,90 +7,47 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - inkscape:version="1.0 (4035a4fb49, 2020-05-01)" - sodipodi:docname="overview.svg" - id="svg8" - version="1.1" - viewBox="0 0 210 297" + width="210mm" height="297mm" - width="210mm"> + viewBox="0 0 210 297" + version="1.1" + id="svg8" + sodipodi:docname="overview.svg" + inkscape:version="1.0 (4035a4fb49, 2020-05-01)"> - - - - - - - - - + refX="0" + id="marker2057" + style="overflow:visible" + inkscape:isstock="true"> + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1" + transform="matrix(-0.8,0,0,-0.8,-10,0)" /> + id="path1612" /> - - - + + + + + + + id="path855" + d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z " + style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1" + transform="scale(0.8) translate(12.5,0)" /> + inkscape:stockid="Arrow1Lend" + inkscape:collect="always"> + id="path858-9" /> + id="Arrow1Lend-8" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow1Lend"> + d="M 0,0 5,-5 -12.5,0 5,5 Z" + id="path858-5" /> + style="overflow:visible" + id="Arrow1Lend-0" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow1Lend"> + d="M 0,0 5,-5 -12.5,0 5,5 Z" + id="path858-8" /> + + + + style="overflow:visible" + id="Arrow1Lend-3" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow1Lend"> + + + + d="M 0,0 5,-5 -12.5,0 5,5 Z" + id="path858-9-9-4" /> + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="1.4" + inkscape:cx="1501.2168" + inkscape:cy="428.03544" + inkscape:document-units="mm" + inkscape:current-layer="layer1" + inkscape:document-rotation="0" + showgrid="false" + inkscape:window-width="1920" + inkscape:window-height="1027" + inkscape:window-x="-8" + inkscape:window-y="-8" + inkscape:window-maximized="1" /> @@ -250,290 +250,377 @@ + id="layer1"> stockfishstockfish(open source) + style="stroke-width:0.264583" + id="tspan837">(open source) python-chesspython-chesslibrary + style="stroke-width:0.264583" + id="tspan843">library tj-chess-modeltj-chess-modelarchitecture + style="stroke-width:0.264583" + id="tspan1181">architecture + id="path853" + sodipodi:nodetypes="cc" /> reinforcement learning + y="36.482292" + style="stroke-width:0.264583" + id="tspan1179">reinforcement learning + d="m 75.008294,37.888007 10.18372,0.28823" + style="fill:none;stroke:#000000;stroke-width:0.499999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Lend-7)" /> + d="m 106.03578,22.650384 -0.28823,10.18372" + style="fill:none;stroke:#000000;stroke-width:0.499999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Lend-8)" /> + id="path853-8-0" + sodipodi:nodetypes="cc" /> + id="path2093" + sodipodi:nodetypes="cc" /> + style="fill:none;stroke:#000000;stroke-width:0.499999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + d="m 104.50239,41.69405 -0.2006,10.246557" + style="fill:none;stroke:#000000;stroke-width:0.499999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + id="path2127" /> + id="path2129" /> + id="path2131" /> inspiration from leelachess,inspiration from leelachess,alphazero, deep neural networkalphazero, deep neural networkarchitecture, board representation + y="5.8794603" + style="stroke-width:0.264583" + id="tspan2153">architecture, board representation + id="path2139" /> + id="path2141" /> + id="path2143" /> heuristics, loss functions + y="70.425522" + style="stroke-width:0.264583" + id="tspan2149">heuristics, loss functions + id="path2155" /> + id="path2157" /> tj-chess-modeltj-chess-modelarchitecture + y="121.52389" + x="72.03685" + sodipodi:role="line">architecture lichess-database + x="35.529762" + y="138.90625" + style="stroke-width:0.264583">lichess-database supervised learning + y="138.71725" + x="72.463013" + sodipodi:role="line">supervised learning + d="m 59.249447,137.51907 10.18372,0.28823" + style="fill:none;stroke:#000000;stroke-width:0.499999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Lend-85)" /> + d="m 81.872327,122.93292 -0.28823,10.18372" + style="fill:none;stroke:#000000;stroke-width:0.499999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Lend-3)" /> + d="M 107.19884,116.20605 97.015118,115.91782" + style="fill:none;stroke:#000000;stroke-width:0.499999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Lend-7-6-7)" /> + d="m 83.144584,151.48562 24.588796,-0.26727" + style="fill:none;stroke:#000000;stroke-width:0.499999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + id="path2093-9-8" /> + id="path2093-1-2" + sodipodi:nodetypes="cc" /> update weights + update weights + update weights + id="tspan2977" + x="53.529095" + y="88.724823" + style="stroke-width:0.264583">training methodology for "human-like" bot at various ELOs + y="-14.396955" + x="30.036467" + height="93.205864" + width="174.85698" + id="rect2967-9" + style="fill:none;stroke:#000000;stroke-width:0.499999;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:2.00315;stroke-opacity:1" /> training methodology for "human-like" bot at various ELOs + y="-17.579626" + x="144.84761" + id="tspan2977-4" + sodipodi:role="line">training methodology for best bot possible + y="91.092255" + x="286.88394" + height="38.288887" + width="72.951973" + id="rect1015" + style="fill:none;stroke:#000000;stroke-width:0.564999;stroke-dashoffset:2.00315" /> + Board Representation + 8x8x73 output, see alphazero paper + training methodology for best bot possible + id="tspan1017-7" + x="406.34766" + y="102.88746" + style="stroke-width:0.264583">Implement DataLoader + Probably use torch.utils.data.IterableDataset + + Network Architecture + 8x8x(MT + L) input, see alphazero paper diff --git a/src/data_utils/pt_loader.py b/src/data_utils/pt_loader.py new file mode 100644 index 0000000..52762ed --- /dev/null +++ b/src/data_utils/pt_loader.py @@ -0,0 +1,13 @@ +"""[summary] +""" + +import torch + + +class MoveLoader(torch.utils.data.IterableDataset): + def __init__(self, board, engine): + super(MoveLoader).__init__() + self.board = board + self.engine = engine + + def __iter__(): \ No newline at end of file diff --git a/src/main.py b/src/main.py index 2abab75..022f229 100644 --- a/src/main.py +++ b/src/main.py @@ -11,7 +11,7 @@ if __name__ == "__main__": - display_gui() + # display_gui() # engine = chess.engine.SimpleEngine.popen_uci(str(cfg.STOCKFISH_ENGINE_PATH)) # board = chess.Board() @@ -20,4 +20,5 @@ # board.push(result.move) # print(board) - # engine.quit() \ No newline at end of file + # engine.quit() +