-
-
Notifications
You must be signed in to change notification settings - Fork 738
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
[Proposal] Deepcopy of an Environment Object #737
Comments
related to #94 |
This is certainly an interesting idea however I'm not sure how much Gymnasium can do as an API It might be possible to implement a However, I'm worried that this is too late in its development to do this and additionally the inconsistencies within environment implementations make this difficult. |
Is the fact that it is late in the development a reason not to do this as an optional feature? (related: #842). Maybe not all envs could/would support this feature, but is there value in standardizing how it would be done for envs that do support it? |
Proposal
I am proposing the addition of true deepcopy or snapshot functionality to the
utils.EzPickle
class in the Gymnasium library.Motivation
While working with the Gymnasium library, I realized that most environment classes inherit from the
utils.EzPickle
class. However, I've noticed a potential issue with this class. When using the deepcopy function, theEzPickle
class discards the current environment state and creates a new one instead. This behaviour seems problematic for use cases that require keeping the environment state after deepcopy.Is there a specific reason why
EzPickle
was designed in this way? Is it due to limitations that prevent real deepcopy from being implemented? I am asking this particularly because I am willing to draft a PR with the implementation of true deepcopy or snapshot functionality. I believe this feature would greatly benefit the library.Additionally, I noticed openai/gym#402 which could be related.
Pitch
Providing a true deepcopy or snapshot functionality would improve the usability of the Gymnasium library. This change would allow users to easily store the state of a certain environment, facilitating tasks such as training reinforcement learning algorithms, which often require the ability to interact with multiple environment instances.
Alternatives
An alternative solution could be to create a new class that implements true deepcopy or snapshot. Another possibility would be to support
clone_state
andrestore_state
functions, similar to the current Atari environment, that would cater to this functionality. However, sinceEzPickle
is already widely used in the library, and considering that this feature might be essential for several users, I believe modifying theEzPickle
class would be more beneficial.Additional context
No response
Checklist
The text was updated successfully, but these errors were encountered: