-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Fix environment factory pickling on Windows #1912
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
Conversation
SubprocessUnityEnvironment sends an environment factory function to each worker which it can use to create a UnityEnvironment to interact with. We use Python's standard multiprocessing library, which pickles all data sent to the subprocess. The built-in pickle library doesn't pickle function objects on Windows machines (tested with Python 3.6 on Windows 10 Pro). This PR adds cloudpickle as a dependency in order to serialize the environment factory. Other implementations of subprocess environments do the same: https://github.com/openai/baselines/blob/master/baselines/common/vec_env/subproc_vec_env.py
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.
LGTM
@harperj Just to make sure, does the model get saved under Windows for these two cases?
Also have you tested the Linux environment for these two cases? |
Test Environment: Windows 10 |
@SetoKaiba Thanks for testing this for us! @harperj Just showed me a fix yesterday afternoon, which works for case 2 and case 3 now, I believe he will test the case 1 and then update this branch. |
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.
Changes needed to fix the ctrl+c and max_step reached errors.
@xiaomaogy @SetoKaiba Those are different (unrelated) issues which I'll shortly make subsequent PRs for. |
SubprocessUnityEnvironment sends an environment factory function to each worker which it can use to create a UnityEnvironment to interact with. We use Python's standard multiprocessing library, which pickles all data sent to the subprocess. The built-in pickle library doesn't pickle function objects on Windows machines (tested with Python 3.6 on Windows 10 Pro). This PR adds cloudpickle as a dependency in order to serialize the environment factory. Other implementations of subprocess environments do the same: https://github.com/openai/baselines/blob/master/baselines/common/vec_env/subproc_vec_env.py
SubprocessUnityEnvironment sends an environment factory function to
each worker which it can use to create a UnityEnvironment to interact
with. We use Python's standard multiprocessing library, which pickles
all data sent to the subprocess. The built-in pickle library doesn't
pickle function objects on Windows machines (tested with Python 3.6 on
Windows 10 Pro).
This PR adds cloudpickle as a dependency in order to serialize the
environment factory. Other implementations of subprocess environments
do the same:
https://github.com/openai/baselines/blob/master/baselines/common/vec_env/subproc_vec_env.py