{ "info": { "author": "M\u00e1rcio Porto", "author_email": "mflporto@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# rlib\n\n[![Build Status](https://travis-ci.org/MarcioPorto/rlib.svg?branch=master)](https://travis-ci.org/MarcioPorto/rlib)\n\n`rlib` is a small deep reinforcement learning library with implementations of popular deep RL algorithms. Each algorithm is highly modular and customizable, making this library a great choice for anyone who wants to test the performance of different algorithms in the same environment. `rlib` uses PyTorch as the library of choice for its initial version, but support for TensorFlow is on the roadmap.\n\n## Installation\n\n```\npip install rlib\n```\n\n## Usage\n\nUsing `rlib` is this simple:\n\n```python\nfrom rlib.algorithms.dqn import DQNAgent\nfrom rlib.environments.gym import GymEnvironment\n\n\ne = gym.make('CartPole-v0')\n\nobservation_size = 4\naction_size = 2\n\ndqn = DQNAgent(observation_size, action_size)\nenv = GymEnvironment(e, dqn)\nenv.train()\nenv.test()\n```\n\n## Advanced\n\n### TensorBoard and GIFRecorder\n\n1. Initialize `Logger` and/or `GIFRecorder` objects. \n\n```python\nos.makedirs('your/log/dir', exist_ok=True)\n\nlogger = Logger(output_dir)\ngifs_recorder = GIFRecorder(output_dir, duration=3.0)\n```\n\n2. Initialize a new environment using these objects.\n\n```python\nenv = GymEnvironment(e, dqn, logger=logger, gifs_recorder=gifs_recorder)\n```\n\n3. To check Tensorboard logs, run:\n\n```\ntensorboard --logdir=your/log/dir\n```\n\n### Custom models\n\n1. Define your own custom model.\n\n```python\nclass NeuralNet(torch.nn.Module):\n def __init__(self):\n super(NeuralNet, self).__init__()\n self.fc1 = nn.Linear(4, 8) \n self.relu = nn.ReLU()\n self.fc2 = nn.Linear(8, 2) \n\n def forward(self, x):\n out = self.fc1(x)\n out = self.relu(out)\n out = self.fc2(out)\n return out\n```\n\n2. Check the documentation for the algorithm you are using for the appropriate argument name. For DQN:\n\n```python\ndqn = DQNAgent(\n observation_size, action_size,\n qnetwork_local=NeuralNet(),\n qnetwork_target=NeuralNet(),\n)\n```\n\n### Saving model weights\n\n1. Set the `model_output_dir` argument when creating a new instance of an algorithm to the directory where you want your model to be saved.\n\n## Testing\n\nTo run all tests:\n\n```\npython -m unittest discover test/\n```\n\n## Contributing\n\n### Installation\n\nFeel free to open issues with any bugs found or any feature requests. Pull requests are always welcome for new functionality.\n\n```\nvirtualenv -p python3 venv\ncd rlib/\nsource venv/bin/activate\npip install -r requirements.txt\n```\n\nTo make sure your installation worked, run one of the algorithms in the test folder:\n\n```\npython test/algorithms/dqn_test.py\n```\n\n## License\n\n`rlib` is released under the [MIT License](https://github.com/MarcioPorto/rlib/blob/master/LICENSE.md).\n\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/MarcioPorto/rlib", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "rlib", "package_url": "https://pypi.org/project/rlib/", "platform": "", "project_url": "https://pypi.org/project/rlib/", "project_urls": { "Homepage": "https://github.com/MarcioPorto/rlib" }, "release_url": "https://pypi.org/project/rlib/0.0.2/", "requires_dist": null, "requires_python": "", "summary": "Implementations of popular Deep Reinforcement Learning algorithms", "version": "0.0.2" }, "last_serial": 4956872, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "211afcfdb95ba503c847edb02f448abb", "sha256": "7fd4dad0e679761969390ddaba414b0723eadd07c6ac5af5f92ebd3712bbe6e4" }, "downloads": -1, "filename": "rlib-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "211afcfdb95ba503c847edb02f448abb", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 35118, "upload_time": "2019-03-17T22:27:08", "url": "https://files.pythonhosted.org/packages/e0/16/2e986e96884014daca65931616c9c77d38d149540d1d329e2515570d83c6/rlib-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "af47c3d6e25ae32dc70e169e3adc43cd", "sha256": "abd02e41e81f9a58591ea1a48d28f9f13eb910cf458232fc12aa23f5ccf8439e" }, "downloads": -1, "filename": "rlib-0.0.1.tar.gz", "has_sig": false, "md5_digest": "af47c3d6e25ae32dc70e169e3adc43cd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19372, "upload_time": "2019-03-17T22:27:11", "url": "https://files.pythonhosted.org/packages/9d/b2/fe74560b32c8dfd3b64d6f671b1c323e5fc30a9abf924985d91b05dcde71/rlib-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "2cd25487712428f885a47b39cdfd79eb", "sha256": "7dbe468fb6020e6980479bb9853d7cff999e96862a6013efe8a2b3a5d2477f67" }, "downloads": -1, "filename": "rlib-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "2cd25487712428f885a47b39cdfd79eb", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 37344, "upload_time": "2019-03-19T03:41:38", "url": "https://files.pythonhosted.org/packages/06/e8/4d8ef94541cd7e81e4fd597ebc8843dc48e8b7085b1b077d22c6ebc68444/rlib-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0cebd7d4b63b371ee2b83b91a9880feb", "sha256": "4715f8f91a80f70c481199b406ad16931324bae0bbe2509ec5f08102d4610704" }, "downloads": -1, "filename": "rlib-0.0.2.tar.gz", "has_sig": false, "md5_digest": "0cebd7d4b63b371ee2b83b91a9880feb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21055, "upload_time": "2019-03-19T03:41:40", "url": "https://files.pythonhosted.org/packages/01/68/16d21c4b9b5550d4549945e4cb21f11a3b87f04fcc898c3c8769efc16a09/rlib-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2cd25487712428f885a47b39cdfd79eb", "sha256": "7dbe468fb6020e6980479bb9853d7cff999e96862a6013efe8a2b3a5d2477f67" }, "downloads": -1, "filename": "rlib-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "2cd25487712428f885a47b39cdfd79eb", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 37344, "upload_time": "2019-03-19T03:41:38", "url": "https://files.pythonhosted.org/packages/06/e8/4d8ef94541cd7e81e4fd597ebc8843dc48e8b7085b1b077d22c6ebc68444/rlib-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0cebd7d4b63b371ee2b83b91a9880feb", "sha256": "4715f8f91a80f70c481199b406ad16931324bae0bbe2509ec5f08102d4610704" }, "downloads": -1, "filename": "rlib-0.0.2.tar.gz", "has_sig": false, "md5_digest": "0cebd7d4b63b371ee2b83b91a9880feb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21055, "upload_time": "2019-03-19T03:41:40", "url": "https://files.pythonhosted.org/packages/01/68/16d21c4b9b5550d4549945e4cb21f11a3b87f04fcc898c3c8769efc16a09/rlib-0.0.2.tar.gz" } ] }