-
Notifications
You must be signed in to change notification settings - Fork 328
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
[Feature,Refactor] Chess improvements: fen, pgn, pixels, san #2702
base: gh/vmoens/71/base
Are you sure you want to change the base?
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/2702
Note: Links to docs will display an error until the docs builds have been completed. ❌ 5 New Failures, 7 Pending, 2 Unrelated FailuresAs of commit 6f1d43d with merge base 256a700 (): NEW FAILURES - The following jobs have failed:
BROKEN TRUNK - The following jobs failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
ghstack-source-id: 81dba82c14ae94c3c25b1a2e78fc3b478cddcc8d Pull Request resolved: #2702
ghstack-source-id: 87c458ebe69a21569719d12ad17fb3d7a356da0d Pull Request resolved: #2702
@@ -90,28 +115,76 @@ class ChessEnv(EnvBase): | |||
""" | |||
|
|||
_hash_table: Dict[int, str] = {} | |||
_PNG_RESTART = """[Event "?"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
_PNG_RESTART = """[Event "?"] | |
_PGN_RESTART = """[Event "?"] |
# Generate the PGN string | ||
pgn_string = str(game) | ||
return pgn_string | ||
|
||
@classmethod | ||
def _get_fen(cls, tensordict): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this function can be removed, in favor of a direct TensorDict.get
call?
fen = self._get_fen(tensordict).data | ||
dest = tensordict.empty() | ||
if self.include_pgn: | ||
fen = self._get_pgn(tensordict).data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fen = self._get_pgn(tensordict).data | |
pgn = self._get_pgn(tensordict).data |
Also _get_pgn
doesn't exist, but I figure you realize that
@classmethod | ||
def _get_tensor_image(cls, board): | ||
try: | ||
svg = board._repr_svg_() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could have another option that has a more minimal representation as well, if we want to train without vision. For instance, OpenSpiel's chess env has a representation where each square of the board is given a size 20 array of ones and zeros, which is somehow used to represent which piece is in that square and which color it is
Stack from ghstack (oldest at bottom):
example_data
for NonTensor spec #2698