Use this file to discover Exa products, pricing, evaluations, comparisons, use cases, agent interfaces, and technical documentation before exploring further.
Python reinforcement learning libraries train agents that learn a policy by acting in an environment and receiving rewards. A library supplies algorithms such as PPO, a training loop that collects rollouts, and wrappers that connect it to simulated environments. These libraries let robotics teams and researchers train control policies in simulation.
Popularity
RLlib has the most monthly downloads in this comparison, at 15.7M, a count that covers all of Ray.
def learn(self, model: BaseAlgorithm) -> None:
"""
:param model: an initialized RL model
"""
kwargs: dict[str, Any] = {}
# log_interval == -1 -> default # < -2 -> no auto-logging if self.log_interval > -1:
kwargs = {"log_interval": self.log_interval}
elif self.log_interval < -1:
# Deactivate auto-logging, helpful when using callback like LogEveryNTimesteps kwargs = {"log_interval": None}
if len(self.callbacks) > 0:
kwargs["callback"] = self.callbacks
# Special case for ARS if self.algo == "ars" and self.n_envs > 1:
kwargs["async_eval"] = AsyncEval(
[lambda: self.create_envs(n_envs=1, no_log=True) for _ in range(self.n_envs)], model.policy
)
try:
model.learn(self.n_timesteps, **kwargs)
except KeyboardInterrupt:
# this allows to save the model when interrupting training pass
finally:
# Clean progress bar if len(self.callbacks) > 0:
self.callbacks[0].on_training_end()
# Release resources try:
assert model.env is not None
model.env.close()
except EOFError:
pass
TorchRL
Provides modular PyTorch building blocks for reinforcement learning.
stable-baselines3 suits training with maintained PyTorch algorithms behind one training and prediction interface. RLlib suits distributed and multi-agent training on Ray. TorchRL suits researchers who assemble their own PyTorch training loop.
stable-baselines3 is a set of PyTorch reinforcement learning algorithms with a shared training and prediction interface. Experimental algorithms live in the separate SB3-Contrib package.
Tianshou is a deep reinforcement learning library built on PyTorch and Gymnasium, with high-level experiment builders and a lower-level algorithm API.
RLax is a library of reinforcement learning building blocks in JAX. It supplies operations for building agents rather than complete algorithms.
TorchRL is a modular PyTorch library for reinforcement learning with replay buffers, data collectors, environments, and loss functions.
For coding agents
Found your reinforcement learning library? Help your agent use it.
Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.