@ray.remote
def fstep():
for _ in range(128//32):
actions, values, self.states, neglogpacs = self.model.step(self.obs, self.states, self.dones)
return 1
final_sample = ray.get([fstep.remote() for _ in range(32)])
when i run the code there is the problem:
TypeError: can't pickle _thread.RLock objects
if i remove the self.model.step, like that:
@ray.remote
def fstep():
for _ in range(128//32):
print("hello")
return 1
final_sample = ray.get([fstep.remote() for _ in range(32)])
there is no problem
i want to know why there is a problem when i add the above code: actions, values, self.states, neglogpacs = self.model.step(self.obs, self.states, self.dones)
which is a tensorflow model.
Thanks
The issue is that TensorFlow models can't be serialized and shipped from one machine to another. Instead, you should probably create the TensorFlow model inside of the remote function. If that's too heavyweight (in terms of performance), then you should use Ray actors and create the TensorFlow model in the actor constructor.
Most helpful comment
The issue is that TensorFlow models can't be serialized and shipped from one machine to another. Instead, you should probably create the TensorFlow model inside of the remote function. If that's too heavyweight (in terms of performance), then you should use Ray actors and create the TensorFlow model in the actor constructor.