From 4538f366e7862667ad1a1d7d8f4a9820ee7f2ea7 Mon Sep 17 00:00:00 2001 From: NM512 Date: Tue, 24 Sep 2024 00:33:02 +0900 Subject: [PATCH] updated requirements --- Dockerfile | 38 +++++++++------------------------ README.md | 4 +++- envs/setup_scripts/atari.sh | 10 +++++++++ envs/setup_scripts/minecraft.sh | 16 ++++++++++++++ requirements.txt | 16 ++++---------- 5 files changed, 43 insertions(+), 41 deletions(-) create mode 100644 envs/setup_scripts/atari.sh create mode 100644 envs/setup_scripts/minecraft.sh diff --git a/Dockerfile b/Dockerfile index 73b4834..ac8e14f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,30 @@ # 1. Test setup: -# docker run -it --rm --gpus all pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime nvidia-smi +# docker run -it --rm --gpus all pytorch/pytorch:2.4.1-cuda12.4-cudnn9-runtime nvidia-smi # # If the above does not work, try adding the --privileged flag # and changing the command to `sh -c 'ldconfig -v && nvidia-smi'`. # # 2. Start training: # docker build -f Dockerfile -t img . && \ -# docker run -it --rm --gpus all -v $PWD:/workspace -u $(id -u):$(id -g) img \ +# docker run -it --rm --gpus all -v $PWD:/workspace img \ # sh xvfb_run.sh python3 dreamer.py \ # --configs dmc_vision --task dmc_walker_walk \ # --logdir "./logdir/dmc_walker_walk" # # 3. See results: # tensorboard --logdir ~/logdir +# +# 4. To set up Atari or Minecraft environments, please check the scripts located in "env/setup_scripts". # System -FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime +FROM pytorch/pytorch:2.4.1-cuda12.4-cudnn9-runtime ARG DEBIAN_FRONTEND=noninteractive ENV TZ=America/San_Francisco ENV PYTHONUNBUFFERED 1 ENV PIP_DISABLE_PIP_VERSION_CHECK 1 ENV PIP_NO_CACHE_DIR 1 RUN apt-get update && apt-get install -y \ - vim libglew2.1 libgl1-mesa-glx libosmesa6 \ + vim libgl1-mesa-glx libosmesa6 \ wget unrar cmake g++ libgl1-mesa-dev \ libx11-6 openjdk-8-jdk x11-xserver-utils xvfb \ && apt-get clean @@ -31,28 +33,8 @@ RUN pip3 install --upgrade pip # Envs ENV NUMBA_CACHE_DIR=/tmp -# dmc setup -RUN pip3 install tensorboard -RUN pip3 install gym==0.19.0 -RUN pip3 install mujoco==2.3.5 -RUN pip3 install dm_control==1.0.9 -RUN pip3 install moviepy +WORKDIR /workspace +COPY requirements.txt . -# crafter setup -RUN pip3 install crafter==1.8.0 - -# atari setup -RUN pip3 install atari-py==0.2.9 -RUN pip3 install opencv-python==4.7.0.72 -RUN mkdir roms && cd roms -RUN wget -L -nv http://www.atarimania.com/roms/Roms.rar -RUN unrar x -o+ Roms.rar -RUN python3 -m atari_py.import_roms ROMS -RUN cd .. && rm -rf roms - -# memorymaze setup -RUN pip3 install memory_maze==1.0.3 - -# minecraft setup -RUN pip3 install minerl==0.4.4 -RUN pip3 install numpy==1.21.0 +# Install requiremqnts +RUN pip3 install -r requirements.txt \ No newline at end of file diff --git a/README.md b/README.md index 51c8e34..0ea528a 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Pytorch implementation of [Mastering Diverse Domains through World Models](https ### Method 1: Manual -Get dependencies with python 3.9: +Get dependencies with python 3.11: ``` pip install -r requirements.txt ``` @@ -17,6 +17,8 @@ Monitor results: ``` tensorboard --logdir ./logdir ``` +To set up Atari or Minecraft environments, please check the scripts located in [env/setup_scripts](https://github.com/NM512/dreamerv3-torch/tree/main/envs/setup_scripts). + ### Method 2: Docker Please refer to the Dockerfile for the instructions, as they are included within. diff --git a/envs/setup_scripts/atari.sh b/envs/setup_scripts/atari.sh new file mode 100644 index 0000000..5963714 --- /dev/null +++ b/envs/setup_scripts/atari.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# Run this script to install Atari +pip3 install atari-py==0.2.9 +pip3 install opencv-python==4.7.0.72 +mkdir roms && cd roms +wget -L -nv http://www.atarimania.com/roms/Roms.rar +unrar x -o+ Roms.rar +python3 -m atari_py.import_roms ROMS +cd .. && rm -rf roms diff --git a/envs/setup_scripts/minecraft.sh b/envs/setup_scripts/minecraft.sh new file mode 100644 index 0000000..4462354 --- /dev/null +++ b/envs/setup_scripts/minecraft.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# Install Java 8 before running this script by either of the following methods. + +# 1. Use docker +# $ apt-get update +# $ apt-get install -y openjdk-8-jdk +# 2. Use conda +# $ conda install -c conda-forge openjdk=8 + +pip3 install https://github.com/NM512/minerl/releases/download/v0.4.4-patched/minerl_mirror-0.4.4-cp311-cp311-linux_x86_64.whl +# Downgrade to install old gym +pip3 install setuptools==60.0.0 +pip3 install pip==22.0 +pip3 install gym==0.19.0 +pip3 install cloudpickle==2.2.1 diff --git a/requirements.txt b/requirements.txt index e9797d4..1f373c2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,22 +1,14 @@ -setuptools==60.0.0 -torch==2.0.0 -torchvision==0.15.1 -pandas==1.2.4 +torch==2.4.1 matplotlib==3.5.0 ruamel.yaml==0.17.4 moviepy==1.0.3 einops==0.3.0 protobuf==3.20.0 -gym==0.19.0 +gym==0.22.0 mujoco==2.3.5 dm_control==1.0.9 -scipy==1.8.0 memory_maze==1.0.3 -atari-py==0.2.9 crafter==1.8.0 opencv-python==4.7.0.72 -numpy==1.21.0 -tensorboard -# minerl==0.4.4 -# This was needed for minerl -# conda install -c conda-forge openjdk=8 +numpy==1.23.5 +tensorboard==2.17.1