{ "info": { "author": "Jarno Sepp\u00e4nen", "author_email": "azalea@meit.si", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3" ], "description": "\n# Azalea\n\n> playing to learn to play\n\nAzalea is a reinterpretation of the [AlphaZero game AI](https://en.wikipedia.org/wiki/AlphaZero)\nlearning algorithm for the [Hex board game](https://en.wikipedia.org/wiki/Hex_(board_game)).\n\n## Features\n\n* Straightforward reimplementation of the AlphaZero algorithm except\n for MCTS parallelization (see below)\n* Pre-trained model for Hex board game\n* Fast MCTS implementation through Numba JIT acceleration.\n* Fast Hex game move generation implementation through Numba.\n* Parallelized self play to saturate Nvidia V100 GPU during training\n* AI policy evaluation through round robin tournament, also parallelized\n* Tested on Ubuntu 16.04\n* Requires Python 3.6 and PyTorch 0.4\n\n## Differences to published AlphaZero\n\n* Single GPU implementation only - tested on Nvidia V100, with 8 CPU's\n for move generation and MCTS, and 1 GPU for the policy network.\n* Only Hex game is implemented, though the code supports adding more\n games. Two components are needed for a new game: move generator and\n policy network, with board input and moves output adjusted to the\n new game.\n* MCTS simulations are not run in parallel threads, but instead,\n self-play games are played in parallel processes. This is to avoid\n the need for a multi-threaded MCTS implementation while still\n maintaining fast training speed and saturating the GPU.\n* MCTS simulation and board evaluations are batched according to\n `search_batch_size` config parameter. \"Virtual loss\" is used\n as in AlphaZero, to increase search diversity.\n\n# Installation\n\nClone the repository and install dependencies with Conda:\n\n git clone https://github.com/jseppanen/azalea.git\n conda env create -n azalea\n source activate azalea\n\nThe default `environment.yml` installs GPU packages but you can choose\n`environment-cpu.yml` for testing on a laptop.\n\n## Playing against pretrained model\n\n python play.py models/hex11-20180712-3362.policy.pth\n\nThis will load the model and start playing, asking for your move. The\ncolumns are labeled a\u2013k and rows 1\u201311. The first player, playing `X`'s,\nis trying to draw a vertical connected path through the board, while the\nsecond player, with `O`'s, is drawing a horizontal path.\n\n```\nO O O O X . . . . . . \n . . . . . . . . . . . \n . . . . . . . . . . . \n . . . . X . . . . . . \n . . . . . X . . . . . \n . . . . . . . . . . . \n . . . . X . . . . . . \n . . . . . . . . . . . \n . . . X . . . . . . . \n x . . . . . . . . . . . \n o\\\\ . . . . . . . . . . . \nlast move: e1\nYour move? \n```\n\n## Model training\n\n python train.py --config config/hex11_train_config.yml --rundir runs/train\n\n## Model comparison\n\n python compare.py --config config/hex11_eval_config.yml --rundir runs/compare [model3] ...\n\n## Model selection\n\n python tune.py\n\n## References\n\n* [Mastering the Game of Go without Human Knowledge](https://deepmind.com/documents/119/agz_unformatted_nature.pdf)\n* [Mastering Chess and Shogi by Self-Play with a General Reinforcement Learning Algorithm](https://arxiv.org/abs/1712.01815)\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jseppanen/azalea", "keywords": "", "license": "BSD 3-Clause License", "maintainer": "", "maintainer_email": "", "name": "azalea", "package_url": "https://pypi.org/project/azalea/", "platform": "", "project_url": "https://pypi.org/project/azalea/", "project_urls": { "Homepage": "https://github.com/jseppanen/azalea" }, "release_url": "https://pypi.org/project/azalea/0.1.0/", "requires_dist": [ "numba", "numpy", "torch", "scipy", "pyyaml", "click", "tensorboardX" ], "requires_python": "", "summary": "Hex board game AI with self-play learning based on the AlphaZero algorithm", "version": "0.1.0" }, "last_serial": 4137403, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "862f162e30c023903fdc136022dd6c1c", "sha256": "26d37f27c2e118c2f3d742efb87f152a9c24b1c5b691d06e9d4d2c2ea37be9c4" }, "downloads": -1, "filename": "azalea-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "862f162e30c023903fdc136022dd6c1c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 29059, "upload_time": "2018-08-05T10:08:39", "url": "https://files.pythonhosted.org/packages/83/10/f4a97bbd32aaf1467e489c658ceb7ef841f5ae00dbe9b04375db5f0971f4/azalea-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c558c419e4d36d6b33996d8e06a18372", "sha256": "510629ce818a6cbede9d2837b42779c682b4f3a7d17f9c40199d6238b638cd45" }, "downloads": -1, "filename": "azalea-0.1.0.tar.gz", "has_sig": false, "md5_digest": "c558c419e4d36d6b33996d8e06a18372", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22493, "upload_time": "2018-08-05T10:08:41", "url": "https://files.pythonhosted.org/packages/a6/b2/0f8876fd07cdace277d2f6c26005b75a1db0ae12410de16646f933b05a38/azalea-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "862f162e30c023903fdc136022dd6c1c", "sha256": "26d37f27c2e118c2f3d742efb87f152a9c24b1c5b691d06e9d4d2c2ea37be9c4" }, "downloads": -1, "filename": "azalea-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "862f162e30c023903fdc136022dd6c1c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 29059, "upload_time": "2018-08-05T10:08:39", "url": "https://files.pythonhosted.org/packages/83/10/f4a97bbd32aaf1467e489c658ceb7ef841f5ae00dbe9b04375db5f0971f4/azalea-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c558c419e4d36d6b33996d8e06a18372", "sha256": "510629ce818a6cbede9d2837b42779c682b4f3a7d17f9c40199d6238b638cd45" }, "downloads": -1, "filename": "azalea-0.1.0.tar.gz", "has_sig": false, "md5_digest": "c558c419e4d36d6b33996d8e06a18372", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22493, "upload_time": "2018-08-05T10:08:41", "url": "https://files.pythonhosted.org/packages/a6/b2/0f8876fd07cdace277d2f6c26005b75a1db0ae12410de16646f933b05a38/azalea-0.1.0.tar.gz" } ] }