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

Added an additional parameter for including alignment in blstats #77

Merged
merged 1 commit into from
Mar 20, 2023

Conversation

samvelyan
Copy link
Member

Added an additional parameter to MiniHack environments for including alignment flag in blstats.

This is to ensure that models trained on earlier MiniHack versions can be executed following NLE 0.9.0 update.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 20, 2023
@github-actions github-actions bot added the core label Mar 20, 2023
@samvelyan
Copy link
Member Author

Example usage

>>> import gym, minihack
>>> env = gym.make("MiniHack-River-v0", include_alignment_blstats=True)
>>> o = env.reset()
>>> len(o['blstats'])
27
>>> o['blstats']
array([38, 13, 16, 16, 16, 12, 15,  8,  8,  0, 12, 12,  1,  0,  2,  2,  7,
        0,  1,  0,  1,  1,  0,  0,  1,  0, -1])
>>> env.close()
>>> env = gym.make("MiniHack-River-v0", include_alignment_blstats=False)
>>> o = env.reset()
>>> len(o['blstats'])
26
>>> o['blstats']
array([32, 10, 10, 10, 18, 14, 12, 10, 11,  0, 12, 12,  1,  0,  2,  2,  7,
        0,  1,  0,  1,  1,  0,  0,  1,  0])

@samvelyan samvelyan merged commit 8cff3a4 into main Mar 20, 2023
@samvelyan samvelyan deleted the samvelyan/action_space branch March 20, 2023 14:20
@SharathRaparthy
Copy link

This looks convenient now @samvelyan. Thank you.

@SharathRaparthy
Copy link

Hey @samvelyan ! Looks like include_alignment_blstats flag is not reflected in env.observation_space. Please see the following example -

>>> import minihack
>>> import gym
>>> env = gym.make("MiniHack-MultiRoom-N6-v0", include_alignment_blstats=False)
>>> env.observation_space
Dict(blstats:Box(27,), chars:Box(21, 79), chars_crop:Box(9, 9), colors:Box(21, 79), colors_crop:Box(9, 9), glyphs:Box(21, 79), glyphs_crop:Box(9, 9), message:Box(256,), specials:Box(21, 79), specials_crop:Box(9, 9))
>>> env = gym.make("MiniHack-MultiRoom-N6-v0", include_alignment_blstats=True)
>>> env.observation_space
Dict(blstats:Box(27,), chars:Box(21, 79), chars_crop:Box(9, 9), colors:Box(21, 79), colors_crop:Box(9, 9), glyphs:Box(21, 79), glyphs_crop:Box(9, 9), message:Box(256,), specials:Box(21, 79), specials_crop:Box(9, 9))

@samvelyan
Copy link
Member Author

Thanks @SharathRaparthy for pointing this out. #85 resolves this.

@SharathRaparthy
Copy link

Great! Thanks @samvelyan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants