Skip to content

Implementing Deep Reinforcement Learning Algorithms in Python for use in the MuJoCo Physics Simulator

Notifications You must be signed in to change notification settings

cubrink/mujoco-2.1-rl-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mujoco-2.1-rl-project

Implementations of different deep reinforcement learning algorithms in PyTorch using OpenAI Gym and MuJoCo as training environments

Algorithms Implemented:

  • REINFORCE
  • A2C (discrete)
  • A2C (continuous)
  • DDPG
  • SAC

Environments used:

  • CartPole-v0
  • Pendulum-v1
  • Ant-v3
  • Humanoid-v3

Examples

Ant-v3

DDPG Ant after 500k environment interactions SAC Ant after 480k environment interactions

Humanoid-v3:

SAC Humanoid after 240k environment interactions SAC Humanoid after 1250k environment interactions

Installation Instructions

These instructions assume you are using Ubuntu 20.04 LTS

Installing dependencies

sudo apt install build-essential libx11-dev libglew-dev patchelf

Install MuJoCo

MuJoCo is available for free. Download it from their website or run

wget -c https://mujoco.org/download/mujoco210-linux-x86_64.tar.gz -O - | tar -xz
mkdir -p ~/.mujoco
mv ./mujoco210 ~/.mujoco

Then, configure the following environment variables

echo export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/$USER/.mujoco/mujoco210/bin:/usr/lib/nvidia >> ~/.bashrc
echo export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so >> ~/.bashrc
source ~/.bashrc

Install Python dependencies

conda is used to manage dependencies in the development environment. Create an anaconda environment then use install the following packages:

conda install python==3.8.12
conda install -c conda-forge gym[all]
conda install -c pytorch pytorch
conda install matplotlib 
pip3 install mujoco-py>=2.1.2.14 more_itertools tqdm

Verify MuJoCo installation

python3 ./examples/mujoco_render/render_test.py

If the installation is successful you should see the model make random movements for several seconds