Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrapper with event_level_control = True #97

Open
astelmach01 opened this issue Sep 15, 2023 · 3 comments
Open

wrapper with event_level_control = True #97

astelmach01 opened this issue Sep 15, 2023 · 3 comments

Comments

@astelmach01
Copy link

When running the following simple script:

import minedojo


if __name__ == "__main__":
    env = minedojo.make(
        task_id="techtree_from_barehand_to_archery", image_size=(160, 256),
    )
    obs = env.reset()
    for i in range(50):
        act = env.action_space.no_op()
        act[0] = 1  # forward/backward
        if i % 10 == 0:
            act[2] = 1  # jump
    obs, reward, done, info = env.step(act)
    env.close()

I get the following error trace

[INFO:minedojo.tasks] Loaded 1581 Programmatic tasks, 1560 Creative tasks, and 1 special task: "Playthrough". Totally 3142 tasks loaded.
Traceback (most recent call last):
  File "/Users/andrewstelmach/Desktop/MineDojo/scripts/validate_install.py", line 5, in <module>
    env = minedojo.make(
          ^^^^^^^^^^^^^^
  File "/Users/andrewstelmach/Desktop/MineDojo/minedojo/tasks/__init__.py", line 539, in make
    return ARNNWrapper(env_obj, cam_interval=cam_interval)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/andrewstelmach/Desktop/MineDojo/minedojo/sim/wrappers/ar_nn/ar_nn_wrapper.py", line 26, in __init__
    _NNActionSpaceWrapper(
  File "/Users/andrewstelmach/Desktop/MineDojo/minedojo/sim/wrappers/ar_nn/nn_action_space_wrapper.py", line 27, in __init__
    and "swap_slot" not in env.action_space.keys()
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: please use this wrapper with event_level_control = True
@hxsnow10
Copy link

hello, do you find the solution?

@thomashopkins32
Copy link

I think I fixed this in #105.

You might have to wrap env.action_space.keys() in a list() like list(env.action_space.keys()) for it to work. This worked for me on gym version 0.22.0.

@hxsnow10
Copy link

I find if correctly install gym=0.21.0, no more error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants