-
Notifications
You must be signed in to change notification settings - Fork 937
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
Converting a pyspiel
game state to a dictionary of array-likes
#1254
Comments
That would be a great feature to have. You are correct: it does not currently exist. We don't have the time to add this ourselves, but it would make a welcome contribution to the code base! |
Someone has submitted an implementation: #1279 Can I ask a quick question about the technical path forward. My understanding from glancing over a few threads is that the use case for this is so that OpenSpiel environments can more easily be used by other RL frameworks that use array-of-dicts representation. However, wouldn't it be better to do this via our observer framework rather than directly over pyspiel states? The pyspiel states contain everything, including information that would be hidden to RL agents, whereas the observer is designed to exposes exactly the information that the RL agents should see. I just want to figure out this design choice before we get too far into core API additions, but I definitely want to support integration with RL frameworks. @elkhrt any opinions on this? |
I'm not completely clear what's needed here. If you want a structured view of the state from the point-of-view of a player, then we have the interfaces for that, but only a handful of games have implemented it.
This emits something like:
If the game doesn't support these structured observations, you'll just get a single tensor, e.g. tiny_hanabi:
Is the idea to add things like the action_mask to this? If so, then I suggest the right thing to do is to add a flag to
|
Would it be possible to convert a
pyspiel
game'sState
object to a dictionary of array-likes and back again, in an efficient way? If that is currently not supported, would it be possible to add this feature?At the moment, it seems to me that this is not possible.
pyspiel
states are implemented in C++ and bound to Python with pybind11, and it doesn't look like any of the bound methods or properties provide a dict-of-arrays representation of the state.I'm asking about this because I am looking into adding an environment wrapper class for OpenSpiel to TorchRL. Ideally, the wrapper would be stateless, so the state would need to be provided to the wrapper's step function as part of a TensorDict, which is a dictionary of array-likes.
Some other RL environment libraries support dict-of-arrays representations, like Brax and Jumanji. Just to give an example:
The text was updated successfully, but these errors were encountered: