nnaisense / evotorch

Advanced evolutionary computation library built directly on top of PyTorch, created at NNAISENSE.
https://evotorch.ai
Apache License 2.0
1.01k stars 63 forks source link

Update vectorized reinforcement learning #104

Closed engintoklu closed 4 months ago

engintoklu commented 4 months ago

This pull request updates vectorized reinforcement functionalities of EvoTorch, so that they are compatible with the gymnasium 1.0.x API (while preserving compatibility with gymnasium 0.29.x).

In more details, this pull request introduces an EvoTorch-specific SyncVectorEnv implementation (as an alternative to gymnasium's SyncVectorEnv class). This custom SyncVectorEnv preserves the classical auto-reset behavior on which EvoTorch relies, allowing us to transition to gymnasium 1.0.x.

Having our custom SyncVectorEnv allows us to introduce these performance-related improvements as well:

Brax-related notebook examples are also refactored. Instead of including the entire brax example in a single notebook, there are now two notebooks, one focusing on the training and the other focusing on the visualization. The visualization example is updated so that it works correctly with the latest version of brax.