native support for fancy_gym

This commit is contained in:
Dominik Moritz Roth 2024-05-31 13:11:09 +02:00
parent 2e7859f068
commit bd507c37c3
2 changed files with 5 additions and 1 deletions

View File

@ -30,7 +30,7 @@ Fancy RL provides two main components:
ppo.train() ppo.train()
``` ```
For environments, you can pass any gymnasium environment ID as a string, a function returning a gymnasium environment, or an already instantiated gymnasium environment. Future plans include supporting other torchrl environments. For environments, you can pass any [gymnasium](https://gymnasium.farama.org/) or [Fancy Gym](https://alrhub.github.io/fancy_gym/) environment ID as a string, a function returning a gymnasium environment, or an already instantiated gymnasium environment. Future plans include supporting other torchrl environments.
Check 'example/example.py' for a more complete usage example. Check 'example/example.py' for a more complete usage example.
2. **Additional Modules for TRPL**: Designed to integrate with torchrl's primitives-first approach, these modules are ideal for building custom algorithms with precise trust region projections. 2. **Additional Modules for TRPL**: Designed to integrate with torchrl's primitives-first approach, these modules are ideal for building custom algorithms with precise trust region projections.

View File

@ -9,6 +9,10 @@ from torchrl.envs import ExplorationType, set_exploration_type
from torchrl.envs.libs.gym import GymWrapper from torchrl.envs.libs.gym import GymWrapper
from torchrl.record import VideoRecorder from torchrl.record import VideoRecorder
import gymnasium as gym import gymnasium as gym
try:
import fancy_gym
except ImportError:
pass
class OnPolicy(ABC): class OnPolicy(ABC):
def __init__( def __init__(