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

NetHack: fix rendering, handle timeouts #294

Merged
merged 3 commits into from
Mar 5, 2024

Conversation

BartekCupial
Copy link
Collaborator

This PR itroduces two small changes to the NetHack example

Fix rendering

Not sure if this is the best way to do this, but I wanted to correctly handle rendering.
There is an issue when using GymV21CompatibilityV0 from shimmy library. Precisely in reset() they call env.render() before env.reset() which throws an error in NLE.

To fix this I've added modified GymV21CompatibilityV0 wrapper which swaps the order of env.reset() and env.render().

Handle timeouts

NLE is compatible with gym==0.21 and it doesn't distinguish between termination and truncation. Normally GymV21CompatibilityV0 handles this, but it needs info["TimeLimit.truncated"] to do so. I made it work by adding a simple wrapper.

@BartekCupial BartekCupial force-pushed the fix_rendering branch 2 times, most recently from 1577f05 to fed3596 Compare March 2, 2024 13:19
@codecov-commenter
Copy link

codecov-commenter commented Mar 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.85%. Comparing base (23df343) to head (e1bf6d2).
Report is 2 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #294      +/-   ##
==========================================
+ Coverage   77.83%   77.85%   +0.02%     
==========================================
  Files         101      101              
  Lines        7773     7773              
==========================================
+ Hits         6050     6052       +2     
+ Misses       1723     1721       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@BartekCupial BartekCupial changed the title Fix rendering for NetHack, handle timeouts NetHack: fix rendering, handle timeouts Mar 2, 2024
@BartekCupial BartekCupial merged commit 6c3ee69 into alex-petrenko:master Mar 5, 2024
9 of 10 checks passed
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

Successfully merging this pull request may close these issues.

4 participants