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

Cached Environment Wrapper #33

Merged
merged 4 commits into from
Nov 19, 2021
Merged

Cached Environment Wrapper #33

merged 4 commits into from
Nov 19, 2021

Conversation

samvelyan
Copy link
Contributor

CachedEnvWrapper by @heiner that uses two queues to emulate a single environment. By making use of several threads, this allows to swap the underlying environment during resetting. Consequently, the tasks where reset() could be a bottleneck can be made substantially faster.

Also added a script that compares the SPS of environments with or without the wrapper. On MiniHack-MultiRoom-N2-Lava-v0 which features comparatively long reset()* , CachedEnvWrapper speeds up the SPS approximately two times on a random policy.

*This is due to the fact that it triggers a reset() on MiniGrid's side, recompiles the des-file, and generally has short episodes given all the lava tiles on the grid that instantly kill the agent.

@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 Nov 17, 2021
Copy link

@heiner heiner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent code, I couldn't have written it better myself!

@samvelyan samvelyan merged commit a971025 into main Nov 19, 2021
@samvelyan samvelyan deleted the samvelyan/cached_wrapper branch November 19, 2021 12:38
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants