RL Algorithms with examples in Python / Pytorch / Unity ML agents

Overview

Reinforcement Learning Project

This project was created to make it easier to get started with Reinforcement Learning. It now contains:

Getting Started

Install Basic Dependencies

To set up your python environment to run the code in the notebooks, follow the instructions below.

  • If you're on Windows I recommend installing Miniforge. It's a minimal installer for Conda. I also recommend using the Mamba package manager instead of Conda. It works almost the same as Conda, but only faster. There's a cheatsheet of Conda commands which also work in Mamba. To install Mamba, use this command:
conda install mamba -n base -c conda-forge 
  • Create (and activate) a new environment with Python 3.6 or later. I recommend using Python 3.9:

    • Linux or Mac:
    mamba create --name rl39 python=3.9 numpy
    source activate rl39
    • Windows:
    mamba create --name rl39 python=3.9 numpy
    activate rl39
  • Install PyTorch by following instructions on Pytorch.org. For example, to install PyTorch on Windows with GPU support, use this command:

mamba install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
  • Install additional packages:
mamba install jupyter notebook matplotlib
python -m ipykernel install --user --name rl39 --display-name "rl39"
  • Change the kernel to match the rl39 environment by using the drop-down menu Kernel -> Change kernel inside Jupyter Notebook.

Install Unity Machine Learning Agents

Note: In order to run the notebooks on Windows, it's not necessary to install the Unity Editor, because I have provided the standalone executables of the environments for you.

Unity ML Agents is the software that we use for the environments. The agents that we create in Python can interact with these environments. Unity ML Agents consists of several parts:

  • The Unity Editor is used for creating environments. To install:

    • Install Unity Hub.
    • Install the latest version of Unity by clicking on the green button Unity Hub on the download page.

    To start the Unity editor you must first have a project:

    • Start the Unity Hub.
    • Click on "Projects"
    • Create a new dummy project.
    • Click on the project you've just added in the Unity Hub. The Unity Editor should start now.
  • The Unity ML-Agents Toolkit. Download the latest release of the source code or use the Git command: git clone --branch release_18 https://github.com/Unity-Technologies/ml-agents.git.

  • The Unity ML Agents package is used inside the Unity Editor. Please read the instructions for installation.

  • The mlagents Python package is used as a bridge between Python and the Unity editor (or standalone executable). To install, use this command: python -m pip install mlagents==0.27.0. Please note that there's no conda package available for this.

Install an IDE for Python

For Windows, I would recommend using PyCharm (my choice), or Visual Studio Code. Inside those IDEs you can use the Conda environment you have just created.

Creating a custom Unity executable

Load the examples project

The Unity ML-Agents Toolkit contains several example environments. Here we will load them all inside the Unity editor:

  • Start the Unity Hub.
  • Click on "Projects"
  • Add a project by navigating to the Project folder inside the toolkit.
  • Click on the project you've just added in the Unity Hub. The Unity Editor should start now.

Create a 3D Ball executable

The 3D Ball example contains 12 environments in one, but this doesn't work very well in the Python API. The main problem is that there's no way to reset each environment individually. Therefore, we will remove the other 11 environments in the editor:

  • Load the 3D Ball scene, by going to the project window and navigating to Examples -> 3DBall -> Scenes-> 3DBall
  • In the Hierarchy window select the other 11 3DBall objects and delete them, so that only the 3DBall object remains.

Next, we will build the executable:

  • Go to File -> Build Settings
  • In the Build Settings window, click Build
  • Navigate to notebooks folder and add 3DBall to the folder name that is used for the build.

Instructions for running the notebooks

  1. Download the Unity executables for Windows. In case you're not on Windows, you have to build the executables yourself by following the instructions above.
  2. Place the Unity executable folders in the same folder as the notebooks.
  3. Load a notebook with Jupyter notebook. (The command to start Jupyter notebook is jupyter notebook)
  4. Follow further instructions in the notebook.
You might also like...
An example project demonstrating how the Autonomous Learning Library can be used to build new reinforcement learning agents.
An example project demonstrating how the Autonomous Learning Library can be used to build new reinforcement learning agents.

About This repository shows how Autonomous Learning Library can be used to build new reinforcement learning agents. In particular, it contains a model

​TextWorld is a sandbox learning environment for the training and evaluation of reinforcement learning (RL) agents on text-based games.

TextWorld A text-based game generator and extensible sandbox learning environment for training and testing reinforcement learning (RL) agents. Also ch

Pacman-AI - AI project designed by UC Berkeley. Designed reflex and minimax agents for the game Pacman.
Pacman-AI - AI project designed by UC Berkeley. Designed reflex and minimax agents for the game Pacman.

Pacman AI Jussi Doherty CAP 4601 - Introduction to Artificial Intelligence - Fall 2020 Python version 3.0+ Source of this project This repo contains a

Scripts of Machine Learning Algorithms from Scratch. Implementations of machine learning models and algorithms using nothing but NumPy with a focus on accessibility. Aims to cover everything from basic to advance.
Scripts of Machine Learning Algorithms from Scratch. Implementations of machine learning models and algorithms using nothing but NumPy with a focus on accessibility. Aims to cover everything from basic to advance.

Algo-ScriptML Python implementations of some of the fundamental Machine Learning models and algorithms from scratch. The goal of this project is not t

Official PyTorch implementation for Generic Attention-model Explainability for Interpreting Bi-Modal and Encoder-Decoder Transformers, a novel method to visualize any Transformer-based network. Including examples for DETR, VQA.
Official PyTorch implementation for Generic Attention-model Explainability for Interpreting Bi-Modal and Encoder-Decoder Transformers, a novel method to visualize any Transformer-based network. Including examples for DETR, VQA.

PyTorch Implementation of Generic Attention-model Explainability for Interpreting Bi-Modal and Encoder-Decoder Transformers 1 Using Colab Please notic

PyTorch implementation of Advantage async actor-critic Algorithms (A3C) in PyTorch
PyTorch implementation of Advantage async actor-critic Algorithms (A3C) in PyTorch

Advantage async actor-critic Algorithms (A3C) in PyTorch @inproceedings{mnih2016asynchronous, title={Asynchronous methods for deep reinforcement lea

TensorRT examples (Jetson, Python/C++)(object detection)
TensorRT examples (Jetson, Python/C++)(object detection)

TensorRT examples (Jetson, Python/C++)(object detection)

Hi Guys, here I am providing examples, which will help you in Lerarning Python

LearningPython Hi guys, here I am trying to include as many practice examples of Python Language, as i Myself learn, and hope these will help you in t

Releases(v1.0.0)
Owner
Rogier Wachters
Rogier Wachters
This is the repository of the NeurIPS 2021 paper "Curriculum Disentangled Recommendation withNoisy Multi-feedback"

Curriculum_disentangled_recommendation This is the repository of the NeurIPS 2021 paper "Curriculum Disentangled Recommendation with Noisy Multi-feedb

14 Dec 20, 2022
This is a collection of our NAS and Vision Transformer work.

AutoML - Neural Architecture Search This is a collection of our AutoML-NAS work iRPE (NEW): Rethinking and Improving Relative Position Encoding for Vi

Microsoft 832 Jan 08, 2023
UV matrix decompostion using movielens dataset

UV-matrix-decompostion-with-kfold UV matrix decompostion using movielens dataset upload the 'ratings.dat' file install the following python libraries

2 Oct 18, 2022
Prototype python implementation of the ome-ngff table spec

Prototype python implementation of the ome-ngff table spec

Kevin Yamauchi 8 Nov 20, 2022
Car Price Predictor App used to predict the price of the car based on certain input parameters created using python's scikit-learn, fastapi, numpy and joblib packages.

Pricefy Car Price Predictor App used to predict the price of the car based on certain input parameters created using python's scikit-learn, fastapi, n

Siva Prakash 1 May 10, 2022
Source code for our Paper "Learning in High-Dimensional Feature Spaces Using ANOVA-Based Matrix-Vector Multiplication"

NFFT4ANOVA Source code for our Paper "Learning in High-Dimensional Feature Spaces Using ANOVA-Based Matrix-Vector Multiplication" This package uses th

Theresa Wagner 1 Aug 10, 2022
Elevation Mapping on GPU.

Elevation Mapping cupy Overview This is a ros package of elevation mapping on GPU. Code are written in python and uses cupy for GPU calculation. * pla

Robotic Systems Lab - Legged Robotics at ETH Zürich 183 Dec 19, 2022
Individual Treatment Effect Estimation

CAPE Individual Treatment Effect Estimation Run CAPE python train_causal.py --loop 10 -m cape_cau -d NI --i_t 1 Run a baseline model python train_cau

S. Deng 4 Sep 02, 2022
Efficient and Scalable Physics-Informed Deep Learning and Scientific Machine Learning on top of Tensorflow for multi-worker distributed computing

Notice: Support for Python 3.6 will be dropped in v.0.2.1, please plan accordingly! Efficient and Scalable Physics-Informed Deep Learning Collocation-

tensordiffeq 74 Dec 09, 2022
Binary Stochastic Neurons in PyTorch

Binary Stochastic Neurons in PyTorch http://r2rt.com/binary-stochastic-neurons-in-tensorflow.html https://github.com/pytorch/examples/tree/master/mnis

Onur Kaplan 54 Nov 21, 2022
The deployment framework aims to provide a simple, lightweight, fast integrated, pipelined deployment framework that ensures reliability, high concurrency and scalability of services.

savior是一个能够进行快速集成算法模块并支持高性能部署的轻量开发框架。能够帮助将团队进行快速想法验证(PoC),避免重复的去github上找模型然后复现模型;能够帮助团队将功能进行流程拆解,很方便的提高分布式执行效率;能够有效减少代码冗余,减少不必要负担。

Tao Luo 125 Dec 22, 2022
Multi-Output Gaussian Process Toolkit

Multi-Output Gaussian Process Toolkit Paper - API Documentation - Tutorials & Examples The Multi-Output Gaussian Process Toolkit is a Python toolkit f

GAMES 113 Nov 25, 2022
Discretized Integrated Gradients for Explaining Language Models (EMNLP 2021)

Discretized Integrated Gradients for Explaining Language Models (EMNLP 2021) Overview of paths used in DIG and IG. w is the word being attributed. The

INK Lab @ USC 17 Oct 27, 2022
Dynamic Environments with Deformable Objects (DEDO)

DEDO - Dynamic Environments with Deformable Objects DEDO is a lightweight and customizable suite of environments with deformable objects. It is aimed

Rika 32 Dec 22, 2022
Implementation of ViViT: A Video Vision Transformer

ViViT: A Video Vision Transformer Unofficial implementation of ViViT: A Video Vision Transformer. Notes: This is in WIP. Model 2 is implemented, Model

Rishikesh (ऋषिकेश) 297 Jan 06, 2023
A bare-bones Python library for quality diversity optimization.

pyribs Website Source PyPI Conda CI/CD Docs Docs Status Twitter pyribs.org GitHub docs.pyribs.org A bare-bones Python library for quality diversity op

ICAROS 127 Jan 06, 2023
Datasets, tools, and benchmarks for representation learning of code.

The CodeSearchNet challenge has been concluded We would like to thank all participants for their submissions and we hope that this challenge provided

GitHub 1.8k Dec 25, 2022
Hybrid CenterNet - Hybrid-supervised object detection / Weakly semi-supervised object detection

Hybrid-Supervised Object Detection System Object detection system trained by hybrid-supervision/weakly semi-supervision (HSOD/WSSOD): This project is

5 Dec 10, 2022
TensorFlow implementation of "Variational Inference with Normalizing Flows"

[TensorFlow 2] Variational Inference with Normalizing Flows TensorFlow implementation of "Variational Inference with Normalizing Flows" [1] Concept Co

YeongHyeon Park 7 Jun 08, 2022
LOFO (Leave One Feature Out) Importance calculates the importances of a set of features based on a metric of choice,

LOFO (Leave One Feature Out) Importance calculates the importances of a set of features based on a metric of choice, for a model of choice, by iteratively removing each feature from the set, and eval

Ahmet Erdem 691 Dec 23, 2022