This commit adds a basic random action gym environment which can be built
into a Docker image using CrowdAI's repo2docker.
This commit is contained in:
Jonathan Harper 2018-11-26 13:52:07 -08:00
Родитель e2f97c7d2a
Коммит 9203a11f63
9 изменённых файлов: 91 добавлений и 2 удалений

3
.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,3 @@
UnitySDK.log
__pycache__
.DS_STORE

Просмотреть файл

@ -1,2 +1,28 @@
# obstacle-tower-challenge
Repository for the MLAgents Obstacle Tower challenge
# Obstacle Tower Challenge Starter Kit
## Setup
* **repo2docker**
```
pip install crowdai-repo2docker
```
## Build Docker image
```
./build.sh
```
## Run Docker image
```
docker run -it obstacle_tower_challenge:latest
docker exec -it [CONTAINER_ID] ./run.sh
```
## Local Run
```
./run.sh
```

3
apt.txt Normal file
Просмотреть файл

@ -0,0 +1,3 @@
curl
git
xvfb

7
build.sh Executable file
Просмотреть файл

@ -0,0 +1,7 @@
export IMAGE_NAME="obstacle_tower_challenge"
crowdai-repo2docker --no-run \
--user-id 1001 \
--user-name crowdai \
--image-name ${IMAGE_NAME} \
--debug .

7
crowdai.json Normal file
Просмотреть файл

@ -0,0 +1,7 @@
{
"challenge_id" : "crowdai-mlagents-2018-obstacletower",
"grader_id": "crowdai-mlagents-2018-obstacletower",
"authors" : ["harperj"],
"description" : "Obstacle Tower random agent",
"gpu": false
}

6
postBuild Executable file
Просмотреть файл

@ -0,0 +1,6 @@
#!/bin/bash
set -ex
curl https://storage.googleapis.com/obstacle-tower-build/obstacletower_linux.zip > obstacletower_linux.zip
unzip obstacletower_linux.zip

1
requirements.txt Normal file
Просмотреть файл

@ -0,0 +1 @@
git+git://github.com/Unity-Technologies/obstacle-tower-env@master

28
run.py Normal file
Просмотреть файл

@ -0,0 +1,28 @@
from obstacle_tower_env import ObstacleTowerEnv
import sys
def run_episode(env):
env.reset()
done = False
reward = 0.0
while not done:
action = env.action_space.sample()
obs, reward, done, info = env.step(action)
return reward
if __name__ == '__main__':
environment_filename = \
sys.argv[1] if len(sys.argv) > 1 else './ObstacleTower/obstacletower'
env = ObstacleTowerEnv(environment_filename)
if env.is_grading():
score = run_episode(env)
else:
while True:
reward = run_episode(env)
print("Episode reward: " + str(reward))
env.close()

8
run.sh Executable file
Просмотреть файл

@ -0,0 +1,8 @@
#!/bin/bash
# Use This line would work in case of the docker container
# Else the relevant env variables will not be loaded during evaluatino
source activate base
echo "root"
python run.py