Replies: 2 comments 3 replies
-
There seems to be an issue with how gym's registration function works in some multiprocessed cases due to SWIGed objects. This seems to be worst when you try to register and "incomplete" environments and then pass other environment parameters when making the environment. The main workaround that I've found is to not use environment registration, which is a feature of gym that seems mostly useless imo. With many RL frameworks, you can pass the environment class and some kwargs dict that then gets unpacked and passed to the environment class constructor. However, RLLib in particular (I currently am using 2.6.3) has a strange API where the environment can only take one argument called
where
I plan to add some example training scripts when we get a major release of the repo together this summer. Hope this helps for now! |
Beta Was this translation helpful? Give feedback.
-
Hi, Mark and clementejuanoliver,
|
Beta Was this translation helpful? Give feedback.
-
From @clementejuanoliver:
When attempting to use custom environments based on GeneralSatelliteTasking class with Ray/RLlib, I encounter a TypeError: cannot pickle 'SwigPyObject' object during the environment's initialization phase. This issue arises when I attempt to build an APPO algorithm trainer with a configuration that includes the GeneralSatelliteTasking environment (with both Gym and RLlib) and uses >0 workers.
I managed to train several agents with 0 workers (RLlib creates num_workers + 1 copies of the environment) and several environments per worker, but when using a number greater than 0 workers, config.build(), which calls the deepcopy function (which internally uses pickle function), gives the error.
The custom environment GeneralSatelliteTasking relies on external libraries that use SWIG for Python bindings, so I guess it would be better to change the env_config to serializable objects, but I would really like to use these ones since they provide with more flexibility and automatised parameters.
Any help or references to documentation/examples that tackle similar challenges would be greatly appreciated.
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions