ai-traineree

PyTorch agents and tools for (Deep) Reinforcement Learning

https://github.com/laszukdawid/ai-traineree

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org, zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.1%) to scientific vocabulary

Keywords

agents artificial-intelligence-algorithms ddpg deep dqn-pytorch multi-agents ppo pytorch rainbow reinforcement-learning
Last synced: 6 months ago · JSON representation ·

Repository

PyTorch agents and tools for (Deep) Reinforcement Learning

Basic Info
Statistics
  • Stars: 25
  • Watchers: 2
  • Forks: 6
  • Open Issues: 5
  • Releases: 4
Topics
agents artificial-intelligence-algorithms ddpg deep dqn-pytorch multi-agents ppo pytorch rainbow reinforcement-learning
Created over 5 years ago · Last pushed about 1 year ago
Metadata Files
Readme License Citation

README.md

ai-traineree

DocStatus codecov Codacy Badge Discord chat DOI

The intention is to have a zoo of Deep Reinforcment Learning methods and showcasing their application on some environments.

Read more in the doc: ReadTheDocs AI-Traineree.

CartPole-v1 Snek

Why another?

The main reason is the implemention philosophy. We strongly believe that agents should be emerged in the environment and not the other way round. Majority of the popular implementations pass environment instance to the agent as if the agent was the focus point. This might ease implementation of some algorithms but it isn't representative of the world; agents want to control the environment but that doesn't mean they can/should.

That, and using PyTorch instead of Tensorflow or JAX.

Quick start

To get started with training your RL agent you need three things: an agent, an environment and a runner. Let's say you want to train a DQN agent on OpenAI CartPole-v1: ```python from aitraineree.agents.dqn import DQNAgent from aitraineree.runners.env_runner import EnvRunner from aitraineree.tasks import GymTask

task = GymTask('CartPole-v1') agent = DQNAgent(task.obsspace, task.actionspace) env_runner = EnvRunner(task, agent)

scores = env_runner.run() ```

or execute one of provided examples

\$ python -m examples.cart_dqn

That's it.

Installation

PyPi (recommended)

The quickest way to install package is through pip.

\$ pip install ai-traineree

Git repository clone

As usual with Python, the expectation is to have own virtual environment and then pip install requirements. For example, ```bash

python -m venv .venv git clone git@github.com:laszukdawid/ai-traineree.git source .venv/bin/activate python setup.py install ```

Current state

Playing gym

One way to improve learning speed is to simply show them how to play or, more researchy/creepy, provide a proper seed. This isn't a general rule, since some algorithms train better without any human interaction, but since you're on GitHub... that's unlikely your case. Currently there's a script interact.py which uses OpenAI Gym's play API to record moves and AI Traineree to store them in a buffer. Such buffers can be loaded by agents on initiation.

This is just a beginning and there will be more work on these interactions.

Requirement: Install pygame.

Agents

| Short | Progress | Link | Full name | Doc | | ------- | --------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- | ------------------------------------------------------------------------ | | DQN | Implemented | DeepMind | Deep Q-learning Network | Doc | | DDPG | Implemented | arXiv | Deep Deterministic Policy Gradient | Doc | | D4PG | Implemented | arXiv | Distributed Distributional Deterministic Policy Gradients | Doc | | TD3 | Implemented | arXiv | Twine Delayed Deep Deterministic policy gradient | Doc | | PPO | Implemented | arXiv | Proximal Policy Optimization | Doc | | SAC | Implemented | arXiv | Soft Actor Critic | Doc | | TRPO | | arXiv | Trust Region Policy Optimization | | RAINBOW | Implemented | arXiv | DQN with a few improvements | Doc |

Multi agents

We provide both Multi Agents agents entities and means to execute them against supported (below) environements. However, that doesn't mean one can be used without the other.

| Short | Progress | Link | Full name | Doc | | ------ | ------------------------------------------------- | ----------------------------------------- | ---------------------- | ---------------------------------------------------------------------------- | | IQL | Implemented | | Independent Q-Learners | Doc | | MADDPG | Implemented | arXiv | Multi agent DDPG | Doc |

Loggers

Supports using Tensorboard (via PyTorch's SummaryWriter) and Neptune to display metrics. Wrappers are provided as TensorboardLogger and NeptuneLogger.

Note: In order to use Neptune one needs to install neptune-client (pip install neptune-client).

Environments

| Name | Progress | Link | | -------------------- | ------------------ | -------------------------------------------------------------------------------------------- | | OpenAI Gym - Classic | Done | | OpenAI Gym - Atari | Done | | OpenAI Gym - MuJoCo | Not interested. | | PettingZoo | Initial support | Page / GitHub | | Unity ML | Somehow supported. | Page | | MAME Linux emulator | Interested. | Official page |

Development

We are open to any contributions. If you want to contribute but don't know what then feel free to reach out (see Contact below). The best way to start is through updating documentation and adding tutorials. In addition there are many other things that we know of which need improvement but also plenty that we don't know of.

Setting up development environment requires installing dev and test extra packages. The dev extras are for mainly for linting and formatting, and the test is for running tests. We recommend using pip so to install everything requires for development run

bash $ pip install -e .[dev,test]

Once installed, please configure your IDE to use black as formatter, pycodestyle as linter, and isort for sorting imports. All these are included in the dev extra packages.

Contact

Should we focus on something specificallly? Let us know by opening a feature request GitHub issue or contacting through ai-traineree@dawid.lasz.uk.

Citing project

latex @misc{ai-traineree, author = {Laszuk, Dawid}, title = {AI Traineree: Reinforcement learning toolset}, year = {2020}, publisher = {GitHub}, journal = {GitHub repository}, howpublished = {\url{https://github.com/laszukdawid/ai-traineree}}, }

Owner

  • Name: Dawid Laszuk
  • Login: laszukdawid
  • Kind: user
  • Location: BC, Canada

Now SDE/MLE, ex-academic. Data processing orientation.

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Laszuk"
  given-names: "Dawid"
  orcid: "https://orcid.org/0000-0001-6811-3253"
title: "AI Traineree: Reinforcement learning toolset"
version: 0.3.5
date-released: 2020-09-13
doi: 10.5281/zenodo.5459885 
url: "https://github.com/laszukdawid/ai-traineree"

GitHub Events

Total
  • Issues event: 3
  • Watch event: 1
  • Delete event: 5
  • Push event: 20
  • Pull request event: 6
  • Fork event: 1
  • Create event: 9
Last Year
  • Issues event: 3
  • Watch event: 1
  • Delete event: 5
  • Push event: 20
  • Pull request event: 6
  • Fork event: 1
  • Create event: 9

Committers

Last synced: about 2 years ago

All Time
  • Total Commits: 210
  • Total Committers: 4
  • Avg Commits per committer: 52.5
  • Development Distribution Score (DDS): 0.052
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Dawid Laszuk l****d@g****m 199
Dawid Laszuk 1****d 8
Luis 4****l 2
Francois Gergaud f****d@a****x 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 16
  • Total pull requests: 15
  • Average time to close issues: about 2 months
  • Average time to close pull requests: about 13 hours
  • Total issue authors: 4
  • Total pull request authors: 3
  • Average comments per issue: 0.88
  • Average comments per pull request: 0.73
  • Merged pull requests: 13
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • laszukdawid (11)
  • LuisFMCuriel (3)
  • stevens68 (1)
  • Ademord (1)
Pull Request Authors
  • laszukdawid (14)
  • LuisFMCuriel (2)
  • francoisgergaud (2)
Top Labels
Issue Labels
bug (1) documentation (1)
Pull Request Labels
bug (3) enhancement (2)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 192 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 25
  • Total maintainers: 1
pypi.org: ai-traineree

Yet another zoo of (Deep) Reinforcement Learning methods in Python using PyTorch

  • Versions: 25
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 192 Last month
Rankings
Dependent packages count: 10.1%
Stargazers count: 12.4%
Forks count: 13.3%
Average: 15.7%
Downloads: 20.9%
Dependent repos count: 21.6%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/ci-lint.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v5 composite
  • astral-sh/setup-uv v5 composite
.github/workflows/ci-test.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v5 composite
  • astral-sh/setup-uv v4 composite
.github/workflows/pip-publish.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v5 composite
  • astral-sh/setup-uv v5 composite
pyproject.toml pypi
  • gymnasium ==1.0.0
  • jsons >=1.4
  • matplotlib >=3.7.5
  • numpy >=2.0
  • torch >=2.0
requirements.txt pypi
  • gym *
  • jsons >=1.4
  • numpy >=1.19.0
  • torch >=1.9.0
uv.lock pypi
  • 155 dependencies