This repo contains an education workshop developed to allow students to build an understanding of reinforced learning. In the workshop the students learn aspects of machine learning required to land a lunar lander which is part of the OpenAI Gym environment. Step by step they can build an AI and see it working. The workshop takes around 2 hours and is intended to be run on Chromebooks.
In addition there is a particular focus on how to measure the 'fitness' of the resulting AI.
Install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"Install Python3, cmake and zlib
brew install python3 cmake zlib libompNow install pip3
# download and install setuptools
curl -O https://bootstrap.pypa.io/ez_setup.py
python3 ez_setup.py
# download and install pip
curl -O https://bootstrap.pypa.io/get-pip.py
python3 get-pip.pyNow install OpenAI Gym, Jupyter notebooks and the rest
pip3 install 'gym'
pip3 install 'gym[box2d]'
pip3 install 'gym[atari]'
pip3 install numpy torch matplotlib JSAnimation tensorflow ipywidgets jupyterLaunch! Now you should be able to open and run the notebooks in this project
jupyter notebookInstall Python3, Pip3, iPython3 and Python3 Tkinter
sudo apt install python3-pip python3-dev ipython3 python3-tkInstall OpenAI Gym Pre-req
sudo apt-get install -y zlib1g-dev libjpeg-dev cmake swig python-pyglet python3-opengl libboost-all-dev libsdl2-dev libosmesa6-dev patchelf ffmpeg xvfbNow add to your .bashrc file
export PATH=$PATH:~/.local/bin/Install Jupyter
pip3 install jupyterInstall OpenAI Gym itself, and some default environments and the notebook requirements
pip3 install gym
pip3 install 'gym[box2d]'
pip3 install 'gym[atari]'
pip3 install 'gym[classic_control]' If you have Nvidia CUDA installed then use GPU version of tensorflow like this
pip3 install tensorflow-gpuOtherwise install the CPU version
pip3 install tensorflowFinal remaining items.
pip3 install torch matplotlib JSAnimation ipywidgetsEnable progress bar extensions
jupyter nbextension enable --py widgetsnbextensionFollow these steps to install on a remotely hostly machine
Install Python3, Pip3, iPython3, Python3 Tkinter,
sudo apt install python3-pip python3-dev ipython3 python3-tkInstall OpenAI Gym Pre-req
sudo apt-get install -y zlib1g-dev libjpeg-dev cmake swig python-pyglet python3-opengl libboost-all-dev libsdl2-dev libosmesa6-dev patchelf ffmpeg xvfbNow install NPM, NodeJS
sudo apt install nodejssudo apt install npmRun all the following as root sudo su
Install JupyterHub
python3 -m pip install jupyterhubInstall HTTP Proxy
sudo npm install -g configurable-http-proxyInstall Notebook
python3 -m pip install notebookInstall the OpenAI Gym stuff and our notebook dependancies
pip3 install gym 'gym[box2d]' 'gym[atari]' 'gym[classic_control]' numpy torch matplotlib JSAnimation tensorflow ipywidgetsNow add to your .bashrc file
export PATH=$PATH:~/.local/bin/Follow your install specific needs to setup your server. Refer to the followig URL for all the options.
https://jupyterhub.readthedocs.io/en/latest/getting-started/index.html
Hints:
- Get an SSL certificate for your install
- Create a configuration file called jupyterhub_config.py
- Set your certificate details and any login details in the config file (lots of options)
- If your server has no physical video card or screen, like say you are running in the cloud, then you need to use xvfb when you spawn new notebeook servers
- Create user accounts
- Enjoy!
Create a file called xvfb-jupyterhub-singleuser, edit
touch ~/.local/bin/xvfb-jupyterhub-singleuser
nano ~/.local/bin/xvfb-jupyterhub-singleuserAdd the following code to the file
#!/bin/bash
xvfb-run -a jupyterhub-singleuser $1Now make it executable
chmod +x ~/.local/bin/xvfb-jupyterhub-singleuserNow edit jupyterhub_config.py and change the Spawner command for jupyterhub-singleuser to xvfb-jupyterhub-singleuser
c.Spawner.cmd = ['xvfb-jupyterhub-singleuser']Read and do this. https://github.com/jupyterhub/jupyterhub/wiki/Run-jupyterhub-as-a-system-service#ubuntudebian-anaconda3-with-systemd
Then
sudo systemctl enable jupyterhub