{"id":15175889,"url":"https://github.com/franckndame/drlkit","last_synced_at":"2025-10-26T11:31:33.544Z","repository":{"id":49305285,"uuid":"225875138","full_name":"FranckNdame/drlkit","owner":"FranckNdame","description":"A High Level Python Deep Reinforcement Learning library. Great for beginners,  prototyping and quickly comparing algorithms","archived":false,"fork":false,"pushed_at":"2022-12-08T03:17:31.000Z","size":79259,"stargazers_count":32,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-30T04:49:34.300Z","etag":null,"topics":["comparing-algorithms","deep-learning","deep-reinforcement-learning","gpu","gym","gym-environment","machine-learning","numpy","python","pytorch","reinforcement-learning","tensor","tensorflow"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FranckNdame.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null}},"created_at":"2019-12-04T13:34:13.000Z","updated_at":"2022-11-24T02:14:16.000Z","dependencies_parsed_at":"2023-01-25T04:00:58.745Z","dependency_job_id":null,"html_url":"https://github.com/FranckNdame/drlkit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FranckNdame%2Fdrlkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FranckNdame%2Fdrlkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FranckNdame%2Fdrlkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FranckNdame%2Fdrlkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FranckNdame","download_url":"https://codeload.github.com/FranckNdame/drlkit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238319458,"owners_count":19452340,"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":["comparing-algorithms","deep-learning","deep-reinforcement-learning","gpu","gym","gym-environment","machine-learning","numpy","python","pytorch","reinforcement-learning","tensor","tensorflow"],"created_at":"2024-09-27T12:43:32.347Z","updated_at":"2025-10-26T11:31:30.960Z","avatar_url":"https://github.com/FranckNdame.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n \u003cimg src=\"https://raw.githubusercontent.com/FranckNdame/drlkit/master/images/drl-kit-banner.png\" width=70% alt=\"Gitter\"\u003e\n\u003c/p\u003e\n\n--------------------------------------------------------------------------------\n\u003cbr/\u003e\n\u003cp align=\"center\"\u003e\n   \u003ca\u003e\n      \u003cimg src=\"https://img.shields.io/badge/python-3.6+-blue.svg\" alt=\"Gitter\"\u003e\n   \u003c/a\u003e\n   \u003ca\u003e\n      \u003cimg src=\"https://github.com/FranckNdame/drlkit/blob/master/images/torchbadge.svg\" alt=\"Pytorch\"\u003e\n   \u003c/a\u003e\n   \u003ca\u003e\n      \u003cimg src=\"https://camo.githubusercontent.com/7ce7d8e78ad8ddab3bea83bb9b98128528bae110/68747470733a2f2f616c65656e34322e6769746875622e696f2f6261646765732f7372632f74656e736f72666c6f772e737667\" alt=\"Gitter\"\u003e\n   \u003c/a\u003e\n   \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\n      \u003cimg src=\"https://img.shields.io/badge/License-MIT-yellow.svg\" alt=\"Gitter\"\u003e\n   \u003c/a\u003e\n   \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\n      \u003cimg src=\"https://app.fossa.com/api/projects/git%2Bgithub.com%2Fwau%2Fkeras-rl2.svg?type=shield\" alt=\"Gitter\"\u003e\n   \u003c/a\u003e\n  \u003c/p\u003e\n\n\u003cbr/\u003e\n \u003ch3 align=\"center\"\u003eA High Level Python Deep Reinforcement Learning library.\u003cbr\u003e \n Great for beginners,  prototyping and quickly comparing algorithms\n\u003c/h3\u003e\n\n\u003cbr/\u003e\n\u003cp align=\"center\"\u003e\n \u003cimg src=\"images/environments.gif\" width=95% alt=\"Environments\"\u003e\n\u003c/p\u003e\n\n\n## Installation 📦\n\nInstall drlkit via pip\n\n```python\npip install drlkit\n```\n\n## Usage 📖\n**1.** Import the modules\n```python\nimport numpy as np\nfrom agents.TorchAgent import TorchAgent\nfrom utils.plot import Plot\nfrom environments.wrapper import EnvironmentWrapper\n```\n**2.** Initialize the environment and the agent\n```python\nENV_NAME = \"LunarLander-v2\"\nenv = EnvironmentWrapper(ENV_NAME)\nagent = TorchAgent(state_size=8, action_size=env.env.action_space.n, seed=0)\n```\n**3.** Train the agent\n```python\n# Train the agent\nenv.fit(agent, n_episodes=1000)\n```\n**4.** Plot the results (optional)\n```python\n# See the results\nPlot.basic_plot(np.arange(len(env.scores)), env.scores, xlabel='Episode #', ylabel='Score')\n```\n**5.** Play 🎮\n```python\n# Play trained agent\nenv.play(num_episodes=10, trained=True)\n```\n# It is as simple as that! 🤯\n\n--------------------------------------------------------------------------------\n\u003cbr/\u003e\n\n### Loading a model 🗃\n```python\nENV_NAME = \"LunarLander-v2\"\nenv = EnvironmentWrapper(ENV_NAME)\nagent = TorchAgent(state_size=8, action_size=env.env.action_space.n, seed=0)\n\nenv.load_model(agent, \"./models/LunarLander-v2-4477.pth\")\nenv.play(num_episodes=10)\n```\n\n### Play untrained agent\n```python\nenv.play(num_episodes=10, trained=False)\n```\n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n \u003cimg src=\"images/Untrained-Agent.gif\" width=50% alt=\"Environments\"\u003e\n\u003c/p\u003e\n\n\n### Play trained agent (4477 episodes, 3 hours)\n```python\nenv.play(num_episodes=10, trained=True)\n```\n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n \u003cimg src=\"images/Trained-Agent.gif\" width=50% alt=\"Environments\"\u003e\n\u003c/p\u003e\n\n## Tested Environments ⛳️\n\n| **Environment**             |\n| --------------------------- |\n| LunarLander-v2              |\n| CartPole-v1                 |\n| MountainCar-v0              |\n\n\n## Implemented Algorithms 📈\n`Done` = :heavy_check_mark: ||\n`In Progress` = :heavy_minus_sign: ||\n`Not done yet` = :x: \n\n| **Algorithms**              | **Status**                        | **Tested**                        |\n| --------------------------- | --------------------------------- | --------------------------------- |\n| DQN                         | :heavy_check_mark: \u003csup\u003e(1)\u003c/sup\u003e | :heavy_check_mark:                |\n| DDPG                        | :heavy_minus_sign:                | :heavy_minus_sign:                |\n| PPO1                        | :x:                               | :x:                               |\n| PPO2                        | :x:                               | :x:                               |\n| A2C                         | :x:                               | :x:                               |\n| SAC                         | :x:                               | :x:                               |\n| TD3                         | :x:                               | :x:                               |\n\n## 👀 Next steps\n\n* [x] Implement DQN\n* [x] Test DQN\n* [ ] Finish DDPG\n* [ ] Implement PP01\n* [ ] Improve documentation\n\n\n\n## ❤️ Contributing\nThis is an open source project, so feel free to contribute. How?\n- Open an [issue](https://github.com/FranckNdame/drlkit/issues/new).\n- Send feedback via [email](mailto://franck.mpouli@gmail.com).\n- Propose your own fixes, suggestions and open a pull request with the changes.\n\n\n## ✍🏾 Author\n\n* Franck Ndame\n\n## 🚨 License\n\n```\nMIT License\n\nCopyright (c) 2019 Franck Ndame\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranckndame%2Fdrlkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffranckndame%2Fdrlkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranckndame%2Fdrlkit/lists"}