-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c1d21b0
Showing
9 changed files
with
285 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
![AIcrowd-Logo](https://raw.githubusercontent.com/AIcrowd/AIcrowd/master/app/assets/images/misc/aicrowd-horizontal.png) | ||
|
||
# NeurIPS 2019 : MineRL Challenge Starter Kit | ||
|
||
Instructions to make submissions to the [NeurIPS 2019 : MineRL Challenge](https://www.aicrowd.com/challenges/neurips-2019-minerl-competition). | ||
|
||
Participants will have to submit their code, with packaging specifications, and the evaluator will automatically build a docker image and execute their code against a series of secret datasets. | ||
|
||
![](https://i.imgur.com/XB1WORT.gif) | ||
|
||
### Setup | ||
|
||
- **Anaconda** (By following instructions [here](https://www.anaconda.com/download)) At least version `4.5.11` is required to correctly populate `environment.yml`. | ||
|
||
* **Create your new conda environment** | ||
|
||
```sh | ||
conda create --name minerl_challenge | ||
conda activate minerl_challenge | ||
``` | ||
|
||
* **Your code specific dependencies** | ||
|
||
```sh | ||
conda install <your-package> | ||
``` | ||
|
||
### Clone repository | ||
|
||
``` | ||
git clone git@github.com:AIcrowd/neurips2019_minerl_challenge_starter_kit.git | ||
cd neurips2019_minerl_challenge_starter_kit | ||
pip install -r requirements.txt | ||
``` | ||
|
||
### Your Submission | ||
|
||
To get started with the environment and dataset [please check out our quick start guide here](http://minerl.io/docs/tutorials/getting_started.html)! | ||
|
||
This competition uses a set of Gym environments based on [Malmo](https://github.com/Microsoft/malmo). The environment and dataset loader will be available through a pip package. | ||
|
||
The main task of the competition is solving the `ObtainDiamond` environment. In this environment, the agent begins in a random starting location without any items, and is tasked with obtaining a diamond. This task can only be accomplished by navigating the complex item hierarchy of Minecraft. | ||
|
||
|
||
# How do I specify my software runtime ? | ||
|
||
The software runtime is specified by exporting your `conda` env to the root | ||
of your repository by doing : | ||
|
||
``` | ||
conda env export --no-build > environment.yml | ||
# It might make sense here to remove the requirements.txt here to avoid confusion as environment.yml takes precedence over requirements.txt | ||
``` | ||
|
||
This `environment.yml` file will be used to recreate the `conda environment`. This repository includes an example `environment.yml` | ||
|
||
# What should my code structure be like ? | ||
|
||
Please follow the structure documented in the included [agent.py](https://github.com/AIcrowd/neurips2019_minerl_challenge_starter_kit/blob/master/agent.py) to adapt | ||
the required structure for this round. | ||
|
||
## Important Concepts | ||
|
||
### Repository Structure | ||
|
||
- `aicrowd.json` | ||
Each repository should have a `aicrowd.json` with the following content : | ||
|
||
```json | ||
{ | ||
"challenge_id": "aicrowd-neurips-2019-minerl-challenge", | ||
"grader_id": "aicrowd-neurips-2019-minerl-challenge", | ||
"authors": ["your-aicrowd-username"], | ||
"description": "sample description about your awesome agent", | ||
"license": "MIT", | ||
"gpu": true | ||
} | ||
``` | ||
|
||
This is used to map your submission to the said challenge, so please remember to use the correct `challenge_id` and `grader_id` as specified above. | ||
|
||
Please specify if your code will a GPU or not for the evaluation of your model. If you specify `true` for the GPU, a **NVIDIA Tesla K80 GPU** will be provided and used for the evaluation. | ||
|
||
### Packaging of your software environment | ||
|
||
The recommended way is to use Anaconda configuration files using **environment.yml** files. | ||
|
||
```sh | ||
# The included environment.yml is generated by the command below, and you do not need to run it again | ||
# if you did not add any custom dependencies | ||
|
||
conda env export --no-build > environment.yml | ||
|
||
# Note the `--no-build` flag, which is important if you want your anaconda env to be replicable across all | ||
# Or if you have a rather simple softwar runtime, then even a : | ||
# | ||
# pip freeze > requirements.txt | ||
# | ||
# could work. | ||
``` | ||
|
||
### Code Entrypoint | ||
|
||
The evaluator will use `/home/aicrowd/run.sh` as the entrypoint, so please remember to have a `run.sh` at the root, which can instantitate any necessary environment variables, and also start executing your actual code. This repository includes a sample `run.sh` file. | ||
If you are using a Dockerfile to specify your software environment, please remember to create a `aicrowd` user, and place the entrypoint code at `run.sh`. | ||
|
||
## Submission | ||
|
||
To make a submission, you will have to create a private repository on [https://gitlab.aicrowd.com/](https://gitlab.aicrowd.com/). | ||
|
||
You will have to add your SSH Keys to your GitLab account by following the instructions [here](https://docs.gitlab.com/ee/gitlab-basics/create-your-ssh-keys.html). | ||
If you do not have SSH Keys, you will first need to [generate one](https://docs.gitlab.com/ee/ssh/README.html#generating-a-new-ssh-key-pair). | ||
|
||
Then you can create a submission by making a _tag push_ to your repository on [https://gitlab.aicrowd.com/](https://gitlab.aicrowd.com/). | ||
**Any tag push (where the tag name begins with "submission-") to your private repository is considered as a submission** | ||
Then you can add the correct git remote, and finally submit by doing : | ||
|
||
``` | ||
cd neurips2019_minerl_challenge_starter_kit | ||
# Add AIcrowd git remote endpoint | ||
git remote add aicrowd git@gitlab.aicrowd.com:<YOUR_AICROWD_USER_NAME>/neurips2019_minerl_challenge_starter_kit.git | ||
git push aicrowd master | ||
# Create a tag for your submission and push | ||
git tag -am "submission-v0.1" submission-v0.1 | ||
git push aicrowd master | ||
git push aicrowd submission-v0.1 | ||
# Note : If the contents of your repository (latest commit hash) does not change, | ||
# then pushing a new tag will **not** trigger a new evaluation. | ||
``` | ||
|
||
You now should be able to see the details of your submission at : | ||
[gitlab.aicrowd.com/<YOUR_AICROWD_USER_NAME>/neurips2019_minerl_challenge_starter_kit/issues](gitlab.aicrowd.com//<YOUR_AICROWD_USER_NAME>/neurips2019_minerl_challenge_starter_kit/issues) | ||
|
||
**NOTE**: Remember to update your username in the link above :wink: | ||
|
||
In the link above, you should start seeing something like this take shape (each of the steps can take a bit of time, so please be patient too :wink: ) : | ||
![](https://i.imgur.com/FqScw4m.png) | ||
|
||
and if everything works out correctly, then you should be able to see the final scores like this : | ||
![](https://i.imgur.com/u00qcif.png) | ||
|
||
**Best of Luck** :tada: :tada: | ||
|
||
# Author | ||
|
||
Shivam Khandelwal <https://twitter.com/skbly7> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Simple env test. | ||
import json | ||
import select | ||
import time | ||
import logging | ||
|
||
import gym | ||
import matplotlib.pyplot as plt | ||
import minerl | ||
import numpy as np | ||
from minerl.env.core import MineRLEnv | ||
|
||
import coloredlogs | ||
coloredlogs.install(logging.DEBUG) | ||
|
||
|
||
#import minerl.env.bootstrap | ||
#minerl.env.bootstrap._check_port_avail = lambda _,__: True | ||
|
||
NUM_EPISODES = int(os.getenv('MINERL_NUM_EPISODES', 1)) | ||
MINERL_GYM_ENV = os.getenv('MINERL_GYM_ENV', 'MineRLNavigateDense-v0') | ||
|
||
def main(): | ||
""" | ||
Tests running a simple environment. | ||
""" | ||
env = gym.make(MINERL_GYM_ENV) | ||
|
||
actions = [env.action_space.sample() for _ in range(2000)] | ||
xposes = [] | ||
for _ in range(NUM_EPISODES): | ||
obs, info = env.reset() | ||
done = False | ||
netr = 0 | ||
while not done: | ||
random_act = env.action_space.noop() | ||
|
||
random_act['camera'] = [0, 0.1*obs["compassAngle"]] | ||
random_act['back'] = 0 | ||
random_act['forward'] = 1 | ||
random_act['jump'] = 1 | ||
random_act['attack'] = 1 | ||
# print(random_act) | ||
obs, reward, done, info = env.step( | ||
random_act) | ||
# print(obs["compassAngle"]) | ||
netr += reward | ||
print(reward, netr) | ||
env.render() | ||
|
||
|
||
|
||
print("Demo complete.") | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"challenge_id": "aicrowd-neurips-2019-minerl-challenge", | ||
"grader_id": "aicrowd-neurips-2019-minerl-challenge", | ||
"authors": ["aicrowd-bot"], | ||
"description": "Test Model for MineRL Challenge", | ||
"gpu": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
curl | ||
git | ||
vim | ||
ssh | ||
gcc | ||
python-dev | ||
libsm6 | ||
libxext6 | ||
libxrender-dev | ||
libglib2.0-0 | ||
openjdk-8-jdk | ||
xvfb | ||
x11vnc | ||
freeglut3-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
|
||
if [ -e environ_secret.sh ] | ||
then | ||
source environ_secret.sh | ||
else | ||
source environ.sh | ||
fi | ||
|
||
# Expected Env variables : in environ.sh | ||
|
||
REPO2DOCKER="$(which aicrowd-repo2docker)" | ||
|
||
sudo ${REPO2DOCKER} --no-run \ | ||
--user-id 1001 \ | ||
--user-name aicrowd \ | ||
--image-name ${IMAGE_NAME}:${IMAGE_TAG} \ | ||
--debug . | ||
|
||
#sudo docker push "${IMAGE_NAME}:${IMAGE_TAG}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
|
||
if [ -e environ_secret.sh ] | ||
then | ||
echo "Note: Gathering environment variables from environ_secret.sh" | ||
source environ_secret.sh | ||
else | ||
echo "Note: Gathering environment variables from environ.sh" | ||
source environ.sh | ||
fi | ||
|
||
# Expected Env variables : in environ.sh | ||
sudo nvidia-docker run \ | ||
--net=host \ | ||
-v $(pwd)/../gradle-data-init/downloads:/home/aicrowd/.gradle:z \ | ||
-v /tmp/shared:/shared:z \ | ||
--user 0 \ | ||
-e CROWDAI_IS_GRADING=True \ | ||
-e CROWDAI_DEBUG_MODE=True \ | ||
-it ${IMAGE_NAME}:${IMAGE_TAG} \ | ||
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \ | ||
/home/aicrowd/run.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
|
||
# debug_build.sh | ||
export IMAGE_NAME="aicrowd/neurips2019-minerl-challenge" | ||
export IMAGE_TAG="agent" | ||
|
||
# docker_run.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
crowdai_api | ||
minerl==0.1.18 | ||
coloredlogs | ||
matplotlib | ||
opencv-python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
python ./agent.py |