* EnvFactory now uses the creation of a single environment as
the basic functionality which the more high-level functions build
upon
* Introduce enum EnvMode to indicate the purpose for which an env
is created, allowing the factory creation process to change its
behaviour accordingly
* Add EnvFactoryGymnasium to provide direct support for envs that
can be created via gymnasium.make
- EnvPool is supported via an injectible EnvPoolFactory
- Existing EnvFactory implementations are now derived from
EnvFactoryGymnasium
* Use a separate environment (which uses new EnvMode.WATCH) for
watching agent performance after training (instead of using test
environments, which the user may want to configure differently)
15 lines
409 B
Python
15 lines
409 B
Python
from tianshou.highlevel.env import (
|
|
EnvFactoryGymnasium,
|
|
VectorEnvType,
|
|
)
|
|
|
|
|
|
class DiscreteTestEnvFactory(EnvFactoryGymnasium):
|
|
def __init__(self):
|
|
super().__init__(task="CartPole-v0", seed=42, venv_type=VectorEnvType.DUMMY)
|
|
|
|
|
|
class ContinuousTestEnvFactory(EnvFactoryGymnasium):
|
|
def __init__(self):
|
|
super().__init__(task="Pendulum-v1", seed=42, venv_type=VectorEnvType.DUMMY)
|