mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-01 14:10:30 +00:00
Control f chaneg of gym to gymnasium
This commit is contained in:
2
.github/ISSUE_TEMPLATE/bug.md
vendored
2
.github/ISSUE_TEMPLATE/bug.md
vendored
@@ -15,7 +15,7 @@ Please try to provide a minimal example to reproduce the bug. Error messages and
|
|||||||
|
|
||||||
**System Info**
|
**System Info**
|
||||||
Describe the characteristic of your environment:
|
Describe the characteristic of your environment:
|
||||||
* Describe how Gym was installed (pip, docker, source, ...)
|
* Describe how Gymnasium was installed (pip, docker, source, ...)
|
||||||
* What OS/version of Linux you're using. Note that while we will accept PRs to improve Window's support, we do not officially support it.
|
* What OS/version of Linux you're using. Note that while we will accept PRs to improve Window's support, we do not officially support it.
|
||||||
* Python version
|
* Python version
|
||||||
|
|
||||||
|
@@ -27,7 +27,7 @@ the list of included, excluded and strict files can be found in pyproject.toml (
|
|||||||
To run `pyright` for the project, run the pre-commit process (`pre-commit run --all-files`) or `pyright`
|
To run `pyright` for the project, run the pre-commit process (`pre-commit run --all-files`) or `pyright`
|
||||||
|
|
||||||
## Git hooks
|
## Git hooks
|
||||||
The CI will run several checks on the new code pushed to the Gym repository. These checks can also be run locally without waiting for the CI by following the steps below:
|
The CI will run several checks on the new code pushed to the Gymnasium repository. These checks can also be run locally without waiting for the CI by following the steps below:
|
||||||
1. [install `pre-commit`](https://pre-commit.com/#install),
|
1. [install `pre-commit`](https://pre-commit.com/#install),
|
||||||
2. Install the Git hooks by running `pre-commit install`.
|
2. Install the Git hooks by running `pre-commit install`.
|
||||||
|
|
||||||
|
@@ -4,9 +4,9 @@
|
|||||||
|
|
||||||
### Due to issues with the domain registration, the documentation has been moved to [https://www.gymlibrary.dev/](https://www.gymlibrary.dev/) as opposed to the old .ml address.
|
### Due to issues with the domain registration, the documentation has been moved to [https://www.gymlibrary.dev/](https://www.gymlibrary.dev/) as opposed to the old .ml address.
|
||||||
|
|
||||||
## Gym
|
## Gymnasium
|
||||||
|
|
||||||
Gym is an open source Python library for developing and comparing reinforcement learning algorithms by providing a standard API to communicate between learning algorithms and environments, as well as a standard set of environments compliant with that API. Since its release, Gym's API has become the field standard for doing this.
|
Gymnasium is an open source Python library for developing and comparing reinforcement learning algorithms by providing a standard API to communicate between learning algorithms and environments, as well as a standard set of environments compliant with that API. Since its release, Gym's API has become the field standard for doing this.
|
||||||
|
|
||||||
Gym documentation website is at [https://www.gymlibrary.dev/](https://www.gymlibrary.dev/), and you can propose fixes and changes to it [here](https://github.com/Farama-Foundation/gym-docs).
|
Gym documentation website is at [https://www.gymlibrary.dev/](https://www.gymlibrary.dev/), and you can propose fixes and changes to it [here](https://github.com/Farama-Foundation/gym-docs).
|
||||||
|
|
||||||
@@ -52,8 +52,8 @@ Gym keeps strict versioning for reproducibility reasons. All environments end in
|
|||||||
|
|
||||||
## MuJoCo Environments
|
## MuJoCo Environments
|
||||||
|
|
||||||
The latest "\_v4" and future versions of the MuJoCo environments will no longer depend on `mujoco-py`. Instead `mujoco` will be the required dependency for future gym MuJoCo environment versions. Old gym MuJoCo environment versions that depend on `mujoco-py` will still be kept but unmaintained.
|
The latest "\_v4" and future versions of the MuJoCo environments will no longer depend on `mujoco-py`. Instead `mujoco` will be the required dependency for future gymnasiumMuJoCo environment versions. Old gymnasiumMuJoCo environment versions that depend on `mujoco-py` will still be kept but unmaintained.
|
||||||
To install the dependencies for the latest gym MuJoCo environments use `pip install gym[mujoco]`. Dependencies for old MuJoCo environments can still be installed by `pip install gym[mujoco_py]`.
|
To install the dependencies for the latest gymnasium MuJoCo environments use `pip install gym[mujoco]`. Dependencies for old MuJoCo environments can still be installed by `pip install gym[mujoco_py]`.
|
||||||
|
|
||||||
## Citation
|
## Citation
|
||||||
|
|
||||||
|
@@ -24,7 +24,7 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
if sys.version_info[0:2] == (3, 6):
|
if sys.version_info[0:2] == (3, 6):
|
||||||
warn(
|
warn(
|
||||||
"Gym minimally supports python 3.6 as the python foundation not longer supports the version, please update your version to 3.7+"
|
"Gymnasium minimally supports python 3.6 as the python foundation not longer supports the version, please update your version to 3.7+"
|
||||||
)
|
)
|
||||||
|
|
||||||
ObsType = TypeVar("ObsType")
|
ObsType = TypeVar("ObsType")
|
||||||
@@ -33,7 +33,7 @@ RenderFrame = TypeVar("RenderFrame")
|
|||||||
|
|
||||||
|
|
||||||
class Env(Generic[ObsType, ActType]):
|
class Env(Generic[ObsType, ActType]):
|
||||||
r"""The main OpenAI Gym class.
|
r"""The main Gymnasium class.
|
||||||
|
|
||||||
It encapsulates an environment with arbitrary behind-the-scenes dynamics.
|
It encapsulates an environment with arbitrary behind-the-scenes dynamics.
|
||||||
An environment can be partially or fully observed.
|
An environment can be partially or fully observed.
|
||||||
@@ -370,7 +370,7 @@ class ObservationWrapper(Wrapper):
|
|||||||
def observation(self, obs):
|
def observation(self, obs):
|
||||||
return obs["target"] - obs["agent"]
|
return obs["target"] - obs["agent"]
|
||||||
|
|
||||||
Among others, Gym provides the observation wrapper :class:`TimeAwareObservation`, which adds information about the
|
Among others, Gymnasium provides the observation wrapper :class:`TimeAwareObservation`, which adds information about the
|
||||||
index of the timestep to the observation.
|
index of the timestep to the observation.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -452,7 +452,7 @@ class ActionWrapper(Wrapper):
|
|||||||
print(wrapped_env.action_space) #Discrete(4)
|
print(wrapped_env.action_space) #Discrete(4)
|
||||||
|
|
||||||
|
|
||||||
Among others, Gym provides the action wrappers :class:`ClipAction` and :class:`RescaleAction`.
|
Among others, Gymasnium provides the action wrappers :class:`ClipAction` and :class:`RescaleAction`.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def step(self, action):
|
def step(self, action):
|
||||||
|
@@ -284,7 +284,7 @@ def load_env_plugins(entry_point: str = "gymnasium.envs") -> None:
|
|||||||
finally:
|
finally:
|
||||||
if attr is None:
|
if attr is None:
|
||||||
raise error.Error(
|
raise error.Error(
|
||||||
f"Gym environment plugin `{module}` must specify a function to execute, not a root module"
|
f"Gymnasium environment plugin `{module}` must specify a function to execute, not a root module"
|
||||||
)
|
)
|
||||||
|
|
||||||
context = namespace(plugin.name)
|
context = namespace(plugin.name)
|
||||||
|
@@ -35,7 +35,7 @@ class Sequence(Space[Tuple]):
|
|||||||
"""
|
"""
|
||||||
assert isinstance(
|
assert isinstance(
|
||||||
space, gymnasium.Space
|
space, gymnasium.Space
|
||||||
), f"Expects the feature space to be instance of a gym Space, actual type: {type(space)}"
|
), f"Expects the feature space to be instance of a gymnasium Space, actual type: {type(space)}"
|
||||||
self.feature_space = space
|
self.feature_space = space
|
||||||
super().__init__(
|
super().__init__(
|
||||||
None, None, seed # type: ignore
|
None, None, seed # type: ignore
|
||||||
|
@@ -125,9 +125,9 @@ class AsyncVectorEnv(VectorEnv):
|
|||||||
except CustomSpaceError:
|
except CustomSpaceError:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Using `shared_memory=True` in `AsyncVectorEnv` "
|
"Using `shared_memory=True` in `AsyncVectorEnv` "
|
||||||
"is incompatible with non-standard Gym observation spaces "
|
"is incompatible with non-standard Gymnasium observation spaces "
|
||||||
"(i.e. custom spaces inheriting from `gymnasium.Space`), and is "
|
"(i.e. custom spaces inheriting from `gymnasium.Space`), and is "
|
||||||
"only compatible with default Gym spaces (e.g. `Box`, "
|
"only compatible with default Gymnasium spaces (e.g. `Box`, "
|
||||||
"`Tuple`, `Dict`) for batching. Set `shared_memory=False` "
|
"`Tuple`, `Dict`) for batching. Set `shared_memory=False` "
|
||||||
"if you use custom observation spaces."
|
"if you use custom observation spaces."
|
||||||
)
|
)
|
||||||
|
@@ -43,9 +43,9 @@ def create_shared_memory(
|
|||||||
raise CustomSpaceError(
|
raise CustomSpaceError(
|
||||||
"Cannot create a shared memory for space with "
|
"Cannot create a shared memory for space with "
|
||||||
f"type `{type(space)}`. Shared memory only supports "
|
f"type `{type(space)}`. Shared memory only supports "
|
||||||
"default Gym spaces (e.g. `Box`, `Tuple`, "
|
"default Gymnasium spaces (e.g. `Box`, `Tuple`, "
|
||||||
"`Dict`, etc...), and does not support custom "
|
"`Dict`, etc...), and does not support custom "
|
||||||
"Gym spaces."
|
"Gymnasium spaces."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -103,9 +103,9 @@ def read_from_shared_memory(
|
|||||||
raise CustomSpaceError(
|
raise CustomSpaceError(
|
||||||
"Cannot read from a shared memory for space with "
|
"Cannot read from a shared memory for space with "
|
||||||
f"type `{type(space)}`. Shared memory only supports "
|
f"type `{type(space)}`. Shared memory only supports "
|
||||||
"default Gym spaces (e.g. `Box`, `Tuple`, "
|
"default Gymnasium spaces (e.g. `Box`, `Tuple`, "
|
||||||
"`Dict`, etc...), and does not support custom "
|
"`Dict`, etc...), and does not support custom "
|
||||||
"Gym spaces."
|
"Gymnasium spaces."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -159,9 +159,9 @@ def write_to_shared_memory(
|
|||||||
raise CustomSpaceError(
|
raise CustomSpaceError(
|
||||||
"Cannot write to a shared memory for space with "
|
"Cannot write to a shared memory for space with "
|
||||||
f"type `{type(space)}`. Shared memory only supports "
|
f"type `{type(space)}`. Shared memory only supports "
|
||||||
"default Gym spaces (e.g. `Box`, `Tuple`, "
|
"default Gymnasium spaces (e.g. `Box`, `Tuple`, "
|
||||||
"`Dict`, etc...), and does not support custom "
|
"`Dict`, etc...), and does not support custom "
|
||||||
"Gym spaces."
|
"Gymnasium spaces."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@ class StepAPICompatibility(gymnasium.Wrapper):
|
|||||||
self.output_truncation_bool = output_truncation_bool
|
self.output_truncation_bool = output_truncation_bool
|
||||||
if not self.output_truncation_bool:
|
if not self.output_truncation_bool:
|
||||||
deprecation(
|
deprecation(
|
||||||
"Initializing environment in old step API which returns one bool instead of two."
|
"Initializing environment in (old) done step API which returns one bool instead of two."
|
||||||
)
|
)
|
||||||
|
|
||||||
def step(self, action):
|
def step(self, action):
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# A Dockerfile that sets up a full Gym install with test dependencies
|
# A Dockerfile that sets up a full Gymnasium install with test dependencies
|
||||||
ARG PYTHON_VERSION
|
ARG PYTHON_VERSION
|
||||||
FROM python:$PYTHON_VERSION
|
FROM python:$PYTHON_VERSION
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user