Skip to main content

MineRL environment and data loader for reinforcement learning from human demonstration in Minecraft

Project description

The MineRL Python Package

Dev Build status Downloads PyPI version "Open Issues" GitHub issues by-label Discord

Python package providing easy to use gym environments and a simple data api for the MineRLv0 dataset.

To get started please read the docs here!

Installation

With JDK-8 installed run this command

pip3 install --upgrade minerl

Basic Usage

Running an environment:

import minerl
import gym
env = gym.make('MineRLNavigateDense-v0')


obs = env.reset()

done = False
while not done:
    action = env.action_space.sample() 
 
    # One can also take a no_op action with
    # action =env.action_space.noop()
    
 
    obs, reward, done, info = env.step(
        action)

Sampling the dataset:

import minerl

# YOU ONLY NEED TO DO THIS ONCE!
minerl.data.download('/your/local/path')

data = minerl.data.make(
    'MineRLObtainDiamond-v0',
    data_dir='/your/local/path')

# Iterate through a single epoch gathering sequences of at most 32 steps
for current_state, action, reward, next_state, done \
    in data.sarsd_iter(
        num_epochs=1, max_sequence_len=32):

        # Print the POV @ the first step of the sequence
        print(current_state['pov'][0])

        # Print the final reward pf the sequence!
        print(reward[-1])

        # Check if final (next_state) is terminal.
        print(done[-1])

        # ... do something with the data.
        print("At the end of trajectories the length"
              "can be < max_sequence_len", len(reward))

Visualizing the dataset:

viewer|540x272

# Make sure your MINERL_DATA_ROOT is set!
export MINERL_DATA_ROOT='/your/local/path'

# Visualizes a random trajectory of MineRLObtainDiamondDense-v0
python3 -m minerl.viewer MineRLObtainDiamondDense-v0

MineRL Competition

If you're here for the MineRL competition. Please check the main competition website here.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

minerl-shwang-0.4.1.tar.gz (70.2 MB view details)

Uploaded Source

File details

Details for the file minerl-shwang-0.4.1.tar.gz.

File metadata

  • Download URL: minerl-shwang-0.4.1.tar.gz
  • Upload date:
  • Size: 70.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.5

File hashes

Hashes for minerl-shwang-0.4.1.tar.gz
Algorithm Hash digest
SHA256 8316ecacef95a36c12797a3a3dcf5f46e5b5491e45081218e636d64f18123986
MD5 06705594e5863d1f0c36d28ec84f7c54
BLAKE2b-256 da5c33192eac12b03b0517276a56e278d7b2ffdff48d3844c2e9112c6932e6bb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page