From 3c67e0e8970a022fe71270530e0331872873f3c2 Mon Sep 17 00:00:00 2001 From: William Guss Date: Tue, 16 Jun 2020 04:09:22 -0700 Subject: [PATCH] Hotfix for act wrapping error (#315) --- minerl/env/core.py | 2 +- minerl/herobraine/envs.py | 10 +++++++--- setup.py | 2 +- tests/excluded/no_op_test.py | 4 ++++ 4 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 tests/excluded/no_op_test.py diff --git a/minerl/env/core.py b/minerl/env/core.py index f9f6a1321..8b7dc87f5 100644 --- a/minerl/env/core.py +++ b/minerl/env/core.py @@ -420,7 +420,7 @@ def _process_action(self, action_in) -> str: subact = " ".join(str(x) for x in subact) action_in[act] = subact - elif isinstance(self.action_space.spaces[act], gym.spaces.Discrete): + elif isinstance(bottom_env_spec.action_space.spaces[act], gym.spaces.Discrete): action_in[act] = int(action_in[act]) action_str.append( diff --git a/minerl/herobraine/envs.py b/minerl/herobraine/envs.py index ef0c82ff8..ea963f288 100644 --- a/minerl/herobraine/envs.py +++ b/minerl/herobraine/envs.py @@ -10,6 +10,8 @@ import minerl.data.version import os + + # Must load non-obfuscated envs first! # Publish.py depends on this order for black-listing streams MINERL_TREECHOP_V0 = Treechop() @@ -25,9 +27,6 @@ MINERL_OBTAIN_IRON_PICKAXE_V0 = ObtainIronPickaxe(dense=False) MINERL_OBTAIN_IRON_PICKAXE_DENSE_V0 = ObtainIronPickaxe(dense=True) -# # Survival envs -# MINERL_OBTAIN_DIAMOND_SURVIVAL_V0 = ObtainDiamondSurvival(dense=False) - # # prototype envs # # TODO: Actually make these work and correct, it'll be good to release these. # MINERL_OBTAIN_MEAT_V0 = Obtain(target_item='meat', dense=False, reward_schedule={ @@ -50,6 +49,9 @@ # TODO FORMAT THIS AUTOMATICALLY USING CIRCULAR IMPORTS os.path.dirname(os.path.abspath(__file__)), "env_specs", "obfuscators", "comp", "v3") +# # Survival envs +MINERL_OBTAIN_DIAMOND_SURVIVAL_V0 = Obfuscated(Vectorized(ObtainDiamondSurvival(dense=True), common_envs=comp_envs), comp_obfuscator_dir, 'MineRLObtainDiamondSurvivalVectorObf-v0') + MINERL_TREECHOP_OBF_V0 = Obfuscated(Vectorized(MINERL_TREECHOP_V0, common_envs=comp_envs), comp_obfuscator_dir) @@ -65,6 +67,8 @@ MINERL_OBTAIN_IRON_PICKAXE_OBF_V0 = Obfuscated(Vectorized(MINERL_OBTAIN_IRON_PICKAXE_V0, common_envs=comp_envs), comp_obfuscator_dir) MINERL_OBTAIN_IRON_PICKAXE_DENSE_OBF_V0 = Obfuscated(Vectorized(MINERL_OBTAIN_IRON_PICKAXE_DENSE_V0, common_envs=comp_envs), comp_obfuscator_dir) + + # ENVS = [MINERL_OBTAIN_IRON_PICKAXE_OBF_V0] diff --git a/setup.py b/setup.py index 5c20230eb..05e0fae8a 100644 --- a/setup.py +++ b/setup.py @@ -88,7 +88,7 @@ def package_files(directory): setuptools.setup( name='minerl', - version='0.3.0', + version='0.3.1', description='MineRL environment and data loader for reinforcement learning from human demonstration in Minecraft', long_description=markdown, long_description_content_type="text/markdown", diff --git a/tests/excluded/no_op_test.py b/tests/excluded/no_op_test.py new file mode 100644 index 000000000..d37a88848 --- /dev/null +++ b/tests/excluded/no_op_test.py @@ -0,0 +1,4 @@ +import minerl, gym +env = gym.make("MineRLObtainDiamondVectorObf-v0") +obs = env.reset() +_ = env.step(env.action_space.noop()) # Also happens if you try to feed in {'vector': np.random.random((64,))} \ No newline at end of file