{"id":18508069,"url":"https://github.com/official-stockfish/nnue-pytorch","last_synced_at":"2025-04-04T19:08:25.905Z","repository":{"id":37562198,"uuid":"307892602","full_name":"official-stockfish/nnue-pytorch","owner":"official-stockfish","description":"Stockfish NNUE (Chess evaluation) trainer in Pytorch","archived":false,"fork":false,"pushed_at":"2024-06-19T08:40:45.000Z","size":2147,"stargazers_count":377,"open_issues_count":32,"forks_count":106,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-03-28T18:12:20.353Z","etag":null,"topics":["chess","deep-learning","pytorch","stockfish"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/official-stockfish.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-28T03:07:01.000Z","updated_at":"2025-03-27T13:05:54.000Z","dependencies_parsed_at":"2023-08-22T13:38:51.749Z","dependency_job_id":"a756d135-21c8-4586-8978-7c4d465a1d5d","html_url":"https://github.com/official-stockfish/nnue-pytorch","commit_stats":{"total_commits":339,"total_committers":21,"mean_commits":"16.142857142857142","dds":0.504424778761062,"last_synced_commit":"14124a0c9c6d70b25f46e5bbe443c1c97fd55fee"},"previous_names":["official-stockfish/nnue-pytorch"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/official-stockfish%2Fnnue-pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/official-stockfish%2Fnnue-pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/official-stockfish%2Fnnue-pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/official-stockfish%2Fnnue-pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/official-stockfish","download_url":"https://codeload.github.com/official-stockfish/nnue-pytorch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234921,"owners_count":20905854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chess","deep-learning","pytorch","stockfish"],"created_at":"2024-11-06T15:13:15.785Z","updated_at":"2025-04-04T19:08:25.889Z","avatar_url":"https://github.com/official-stockfish.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Setup\n\n### Software prerequisites\n\n#### Python\n\nIf using easy_train.py then at least 3.7 is required.\n\nOtherwise versions around 3.6 should also work, but updating is recommended.\n\nPython 3.11 was also tested and works well.\n\n#### A C++ compiler\n\nIf you're using easy_train.py then at least GCC 9.2 is required for compiling the data loader, Stockfish, and c-chess-cli. This a defensive version requirement as older versions were known to cause problems with Stockfish.\n\nIf you're not using easy_train.py then no automatic compilation will take place; use what you wish.\n\nIf you're on Windows the best way is to probably use [MSYS2](https://www.msys2.org/). It would also make it easy to install Make (next step).\n\n#### Make\n\nFor compiling Stockfish and c-chess-cli. Not strictly necessary if you're not using easy_train.py, but recommended.\n\n#### CMake\n\nNecessary for compiling the data loader.\n\nhttps://cmake.org/install/\n\n### Package dependencies\n\n```\npython -m venv trainer\npip install -r requirements.txt\n```\n\nPyTorch with CUDA 11.8 will be automatically installed, along with the matching CuPy version.\n\n### The data loader (if not using easy_train.py)\n\nThis requires a C++17 compiler and cmake.\n\nWindows:\n```\ncompile_data_loader.bat\n```\n\nLinux/Mac:\n```\nsh compile_data_loader.bat\n```\n\n# Network training and management\n\nHard way: [wiki](https://github.com/official-stockfish/nnue-pytorch/wiki/Basic-training-procedure-(train.py))\n\nEasier way: [wiki](https://github.com/official-stockfish/nnue-pytorch/wiki/Basic-training-procedure-(easy_train.py))\n\n# Logging\n\nTODO: Move to wiki. Add setup for easy_train.py\n\n```\ntensorboard --logdir=logs\n```\nThen, go to http://localhost:6006/\n\n# Automatically run matches to determine the best net generated by a (running) training\n\nTODO: Move to wiki\n\n```\npython run_games.py --concurrency 16 --stockfish_exe ./stockfish.master --c_chess_exe ./c-chess-cli --ordo_exe ./ordo --book_file_name ./noob_3moves.epd run96\n```\n\nAutomatically converts all `.ckpt` found under `run96` to `.nnue` and runs games to find the best net. Games are played using `c-chess-cli` and nets are ranked using `ordo`.\nThis script runs in a loop, and will monitor the directory for new checkpoints. Can be run in parallel with the training, if idle cores are available.\n\n\n# Thanks\n\n* Sopel - for the amazing fast sparse data loader\n* connormcmonigle - https://github.com/connormcmonigle/seer-nnue, and loss function advice.\n* syzygy - http://www.talkchess.com/forum3/viewtopic.php?f=7\u0026t=75506\n* https://github.com/DanielUranga/TensorFlowNNUE\n* https://hxim.github.io/Stockfish-Evaluation-Guide/\n* dkappe - Suggesting ranger (https://github.com/lessw2020/Ranger-Deep-Learning-Optimizer)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fofficial-stockfish%2Fnnue-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fofficial-stockfish%2Fnnue-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fofficial-stockfish%2Fnnue-pytorch/lists"}