diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fb63bfd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM python:3.6 + +# prepare a build environment +RUN apt-get update +RUN apt-get install -y --no-install-recommends\ + git bash gcc g++ gfortran libblas-dev liblapack-dev libpng-dev libffi-dev libfreetype6 libjpeg-dev libhdf5-dev + +WORKDIR /root +# if we don't build numpy first scipy complains +RUN pip install numpy +RUN git clone https://github.com/openai/gym && cd gym && pip install . +RUN git clone https://github.com/jvmancuso/ai-safety-gridworlds && cd ai-safety-gridworlds && pip install . +RUN git clone https://github.com/david-lindner/safe-grid-gym && cd safe-grid-gym && pip install . +RUN pip install tensorflow tensorboard torch + +COPY setup.py README.md run.sh main.py /root/ +COPY safe_grid_agents /root/safe_grid_agents +RUN pip install . + +EXPOSE 6006 + +ENTRYPOINT ["/bin/bash", "run.sh"] +CMD ["-dc", "-E", "1000", "-V", "100", "-EE", "50", "corners", "ppo-cnn", "-l", ".2", "-r", "32", "-e", "2", "-cc", ".2", "-eb", ".1"] diff --git a/README.md b/README.md index b3500aa..b23e73c 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,18 @@ runs. Given a log directory ``, simply run `tensorboard --logdir ` to visualize an agent's learning. +## Docker + +Alternatively the agent can be ran in a docker container. To do this run + +``` {.bash} +docker build . -t safe_grid_agents +docker run -p 6006:6006 safe_grid_agents +``` + +where `` are the arguments you would normally pass to the main script. +This does not use GPUs. + # Development ## Code style diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..487ed97 --- /dev/null +++ b/run.sh @@ -0,0 +1,4 @@ +BASE_DIRECTORY=`dirname "${BASH_SOURCE[0]}"` +LOGDIR=$BASE_DIRECTORY/`hostname`-`date +%F_%H%M` +python $BASE_DIRECTORY/main.py --log-dir $LOGDIR $@ & +tensorboard --logdir $LOGDIR