Closed A-Artemis closed 1 year ago
Hi @A-Artemis. Unfortunately, the Python interface to OpenSim is built on SWIG, so if SwigPyObject
is not picklable, I don't think any of the API will be picklable. It's possible that a different approach to the bindings (e.g., pybind11) might work, but we don't have plans to shift away from SWIG at the moment.
Hi @nickbianco thanks for the quick reply. Unfortunately different bindings did not solve the issue.
Would there be a way to implement methods to help serialize the objects? I've had a look at https://stackoverflow.com/questions/65942415/how-to-pickle-serialize-a-swigpyobject and https://github.com/uqfoundation/pathos/issues/148#issuecomment-506052407 are those possible approaches?
It might be possible to serialize the objects (the latter approach seems more promising). I'd be happy to review a PR if you want to give it a shot yourself, but internally we have no plans to make any changes to the bindings.
Closing due to inactivity.
Hi, I have made a opensim environment of type
gymnasium.Env
and I am trying to pickle this so that I can use multi-processing from the stable-baselines3 RL algorithms.Stable-baselines3 require that the env be pickled, however I encounter the following error:
The following components in my class that are Swig are:
Is there a way to pickle the opensim functions? Or serialize them in another way?
system details os - Linux 22.04 opensim - 4.4.1 (installed by building the source code from GitHub) python 3.11.4 cloudpickle 2.2.1