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

Fix: unable to open shared memory object error in multiprocessing #145

Merged
merged 1 commit into from
Mar 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion handyrl/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ def server(self):
except:
# return latest model if failed to load specified model
pass
send_data.append(model)
send_data.append(pickle.dumps(model))

if not multi_req and len(send_data) == 1:
send_data = send_data[0]
Expand Down
3 changes: 2 additions & 1 deletion handyrl/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from socket import gethostname
from collections import deque
import multiprocessing as mp
import pickle

from .environment import prepare_env, make_env
from .connection import QueueCommunicator
Expand Down Expand Up @@ -47,7 +48,7 @@ def _gather_models(self, model_ids):
model_pool[model_id] = self.latest_model[1]
else:
# get model from server
model_pool[model_id] = send_recv(self.conn, ('model', model_id))
model_pool[model_id] = pickle.loads(send_recv(self.conn, ('model', model_id)))
# update latest model
if model_id > self.latest_model[0]:
self.latest_model = model_id, model_pool[model_id]
Expand Down