The "visualization.ipynb" notebook runs the OpenAi basleines implementation of the PPO algorithm for 1 Million steps (using the Hyperparameters given on the PPO paper) on the Hopper-V2 enviroment (MuJoCo and PyBullet versions) and Visualizes the results comparing them to the original paper and to the baselines given by OpenAi baselines.
- Linux specifically Ubuntu 18.04 LTS and Pop!_OS 20.04 ; and Mac OS Catalina were tested other versions could need different modules (OpenAi Baselines has problems under Windows and MuJoCo only runs on Linux or OS x (theoretically), windows is deprecated. I couldn't make MuJoCo run on Mac OS Catalina but PyBullet does.)
- python3 (3.6 or 3.7 , i.e. 3.5 and 3.8 don't work )
- Tensorflow 1.14 (Intel optimized version is used)
- Jupyter notebooks
- OpenAi Gym
- OpenAi baselines (https://github.com/openai/baselines)
- matplotlib
- pandas
- MuJoCo
- PyBullet
Download the implementation folder.
Best visualized as Jupyter Notebook.
Mujoco, i.e. mujoco-py, is currently not working on MacOs Catalina; there are several Issues , but PyBullet works.
Assuming python3 (3.6 or 3.7) and conda are installed.
Note I used all the conda versions of the packages, it could be possible that issues arise with the pip packages.
-
Create a conda enviroment using the "enviromet.yml" included as follows
conda env create -f environment.yml conda activate LR-tf1
LR-tf1: Learning Robots using tesorflow 1.14 (the intel optimized version. No GPU support.)
-
Conda install the notebook with:
conda install -c conda-forge notebook -
pip install with:
pip install notebook
The master branch of OpenAi baselines supports Tensorflow from version 1.4 to 1.14. Here version 1.14 will be used
-
Conda
Using anaconda the intel optimized cpu version of tensorflow 1.14 was used.
- Linux and MacOS
conda install tensorflow==1.14 -c anaconda- Windows
conda install tensorflow-mkl==1.14 -c anaconda -
alternative pip
Alternative the normal version of tensorflow can be installed although this was not tested.
pip install tensorflow-gpu==1.14 # if a CUDA-compatible gpu with proper drivers is availableor
pip install tensorflow==1.14
-
Conda install the notebook with:
conda install -c conda-forge matplotlib -
pip install with:
pip install -U matplotlib
-
Conda install the notebook with:
conda install pandas -
pip install with:
pip install pandas
Instead of using the git version of OpenAi baselines a slightly modified one is inside the project. (Modified defaults.py in ppo2 and other small changes)
Note: no explicit instructions for windows are given, I didn't test it on windows only on Ubuntu 18.04, 20.04 and MacOs Catalina.
Following system packages CMake, OpenMPI and zlib are needed. Those can be installed as follows
-
Linux
sudo apt-get update && sudo apt-get install cmake libopenmpi-dev python3-dev zlib1g-dev # All one line -
Mac OS X
Installation of system packages on Mac requires Homebrew. With Homebrew installed, run the following: bash brew install cmake openmpi
- Install baselines package
Inside the implementation folder do: bash cd baselines pip install -e . cd ..
-
Obtain a 30-day free trial on the MuJoCo website or free license if you are a student. The license key will arrive in an email with your username and password.
-
Unzip the downloaded
mujoco200directory into~/.mujoco/mujoco200, (make sure that it is mujoco200 and not e.g. mujoco200_macos) and place your license key (themjkey.txtfile from your email) at~/.mujoco/mjkey.txt. -
Run:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/"REEPLACE WITH PATH TO"/.mujoco/mujoco200/bin ```
-
Linux
To install mujoco-py on Ubuntu, make sure you have the following libraries installed:
sudo apt install libosmesa6-dev libgl1-mesa-glx libglfw3 patchelf pip install -U 'mujoco-py<2.1,>=2.0'-
Mac OS X
Currently mujoco-py is not working on MacOs Catalina; there are several Issues , but PyBullet works.
-
If you want to specify a nonstandard location for the key and package, use the env variables MUJOCO_PY_MJKEY_PATH and MUJOCO_PY_MUJOCO_PATH.
For further details or issues see MuJoCo GitHub
Troubleshooting if training does not work see if in the Jupyter console, i.e. the console running the jupyter server, the MuJoCo path is recognized, otherwise follow the given instructions in the error.
-
pip install the package with:
pip3 install pybullet --upgrade --user # or pip install pybulletFor further details or issues see PyBullet GitHub or the PyBullet Quickstart Guide
-
Mac OS X install the package with:
brew install ffmpeg -
Linux install the package with:
sudo apt-get install ffmpegExtra for Ubuntu 14.04:
sudo apt-get install libav-tools
Inside the implementation folder using a console run:
# If following the installation make sure to go out of the baseline folder and then
jupyter notebook
and open the "visualization.ipynb" notebook.