Upgrade gym to gymnasium

This commit is contained in:
Simon Alibert 2024-03-25 15:12:21 +01:00
parent 5ef813ff1e
commit dc89166bee
10 changed files with 11 additions and 88 deletions

40
.github/poetry/cpu/poetry.lock generated vendored
View File

@ -793,44 +793,6 @@ files = [
[package.extras] [package.extras]
protobuf = ["grpcio-tools (>=1.62.1)"] protobuf = ["grpcio-tools (>=1.62.1)"]
[[package]]
name = "gym"
version = "0.26.2"
description = "Gym: A universal API for reinforcement learning environments"
optional = false
python-versions = ">=3.6"
files = [
{file = "gym-0.26.2.tar.gz", hash = "sha256:e0d882f4b54f0c65f203104c24ab8a38b039f1289986803c7d02cdbe214fbcc4"},
]
[package.dependencies]
cloudpickle = ">=1.2.0"
gym_notices = ">=0.0.4"
numpy = ">=1.18.0"
[package.extras]
accept-rom-license = ["autorom[accept-rom-license] (>=0.4.2,<0.5.0)"]
all = ["ale-py (>=0.8.0,<0.9.0)", "box2d-py (==2.3.5)", "imageio (>=2.14.1)", "lz4 (>=3.1.0)", "matplotlib (>=3.0)", "moviepy (>=1.0.0)", "mujoco (==2.2)", "mujoco_py (>=2.1,<2.2)", "opencv-python (>=3.0)", "pygame (==2.1.0)", "pytest (==7.0.1)", "swig (==4.*)"]
atari = ["ale-py (>=0.8.0,<0.9.0)"]
box2d = ["box2d-py (==2.3.5)", "pygame (==2.1.0)", "swig (==4.*)"]
classic-control = ["pygame (==2.1.0)"]
mujoco = ["imageio (>=2.14.1)", "mujoco (==2.2)"]
mujoco-py = ["mujoco_py (>=2.1,<2.2)"]
other = ["lz4 (>=3.1.0)", "matplotlib (>=3.0)", "moviepy (>=1.0.0)", "opencv-python (>=3.0)"]
testing = ["box2d-py (==2.3.5)", "imageio (>=2.14.1)", "lz4 (>=3.1.0)", "matplotlib (>=3.0)", "moviepy (>=1.0.0)", "mujoco (==2.2)", "mujoco_py (>=2.1,<2.2)", "opencv-python (>=3.0)", "pygame (==2.1.0)", "pytest (==7.0.1)", "swig (==4.*)"]
toy-text = ["pygame (==2.1.0)"]
[[package]]
name = "gym-notices"
version = "0.0.8"
description = "Notices for gym"
optional = false
python-versions = "*"
files = [
{file = "gym-notices-0.0.8.tar.gz", hash = "sha256:ad25e200487cafa369728625fe064e88ada1346618526102659b4640f2b4b911"},
{file = "gym_notices-0.0.8-py3-none-any.whl", hash = "sha256:e5f82e00823a166747b4c2a07de63b6560b1acb880638547e0cabf825a01e463"},
]
[[package]] [[package]]
name = "gymnasium" name = "gymnasium"
version = "0.29.1" version = "0.29.1"
@ -3254,4 +3216,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = "^3.10" python-versions = "^3.10"
content-hash = "2c49c37a048b4298ca81f3c0a304021129148a0b4746208c14117b3423d9a67f" content-hash = "93c406139c456780b3d309d7ed3d68ea60cc0e8893c1ee717692984e573d3404"

View File

@ -42,7 +42,6 @@ torch = {version = "^2.2.1", source = "torch-cpu"}
tensordict = {git = "https://github.com/pytorch/tensordict"} tensordict = {git = "https://github.com/pytorch/tensordict"}
torchrl = {git = "https://github.com/pytorch/rl", rev = "13bef426dcfa5887c6e5034a6e9697993fa92c37"} torchrl = {git = "https://github.com/pytorch/rl", rev = "13bef426dcfa5887c6e5034a6e9697993fa92c37"}
mujoco = "^2.3.7" mujoco = "^2.3.7"
gym = "^0.26.2"
opencv-python = "^4.9.0.80" opencv-python = "^4.9.0.80"
diffusers = "^0.26.3" diffusers = "^0.26.3"
torchvision = {version = "^0.17.1", source = "torch-cpu"} torchvision = {version = "^0.17.1", source = "torch-cpu"}
@ -52,6 +51,7 @@ dm-control = "1.0.14"
robomimic = "0.2.0" robomimic = "0.2.0"
huggingface-hub = "^0.21.4" huggingface-hub = "^0.21.4"
gymnasium-robotics = "^1.2.4" gymnasium-robotics = "^1.2.4"
gymnasium = "^0.29.1"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]

View File

@ -31,7 +31,7 @@ from lerobot.common.envs.aloha.tasks.sim_end_effector import (
from lerobot.common.envs.aloha.utils import sample_box_pose, sample_insertion_pose from lerobot.common.envs.aloha.utils import sample_box_pose, sample_insertion_pose
from lerobot.common.utils import set_seed from lerobot.common.utils import set_seed
_has_gym = importlib.util.find_spec("gym") is not None _has_gym = importlib.util.find_spec("gymnasium") is not None
class AlohaEnv(AbstractEnv): class AlohaEnv(AbstractEnv):

View File

@ -18,7 +18,7 @@ from torchrl.envs.libs.gym import _gym_to_torchrl_spec_transform
from lerobot.common.envs.abstract import AbstractEnv from lerobot.common.envs.abstract import AbstractEnv
from lerobot.common.utils import set_seed from lerobot.common.utils import set_seed
_has_gym = importlib.util.find_spec("gym") is not None _has_gym = importlib.util.find_spec("gymnasium") is not None
class PushtEnv(AbstractEnv): class PushtEnv(AbstractEnv):

View File

@ -1,14 +1,14 @@
import collections import collections
import cv2 import cv2
import gym import gymnasium as gym
import numpy as np import numpy as np
import pygame import pygame
import pymunk import pymunk
import pymunk.pygame_util import pymunk.pygame_util
import shapely.geometry as sg import shapely.geometry as sg
import skimage.transform as st import skimage.transform as st
from gym import spaces from gymnasium import spaces
from pymunk.vec2d import Vec2d from pymunk.vec2d import Vec2d
from lerobot.common.envs.pusht.pymunk_override import DrawOptions from lerobot.common.envs.pusht.pymunk_override import DrawOptions

View File

@ -1,5 +1,5 @@
import numpy as np import numpy as np
from gym import spaces from gymnasium import spaces
from lerobot.common.envs.pusht.pusht_env import PushTEnv from lerobot.common.envs.pusht.pusht_env import PushTEnv

View File

@ -20,7 +20,6 @@ from lerobot.common.utils import set_seed
MAX_NUM_ACTIONS = 4 MAX_NUM_ACTIONS = 4
_has_gym = importlib.util.find_spec("gymnasium") is not None _has_gym = importlib.util.find_spec("gymnasium") is not None
# _has_simxarm = importlib.util.find_spec("simxarm") is not None and _has_gym
class SimxarmEnv(AbstractEnv): class SimxarmEnv(AbstractEnv):

View File

@ -1,8 +1,8 @@
from collections import OrderedDict, deque from collections import OrderedDict, deque
import gym import gymnasium as gym
import numpy as np import numpy as np
from gym.wrappers import TimeLimit from gymnasium.wrappers import TimeLimit
from lerobot.common.envs.simxarm.simxarm.task.base import Base as Base from lerobot.common.envs.simxarm.simxarm.task.base import Base as Base
from lerobot.common.envs.simxarm.simxarm.task.lift import Lift from lerobot.common.envs.simxarm.simxarm.task.lift import Lift

40
poetry.lock generated
View File

@ -783,44 +783,6 @@ files = [
[package.extras] [package.extras]
protobuf = ["grpcio-tools (>=1.62.1)"] protobuf = ["grpcio-tools (>=1.62.1)"]
[[package]]
name = "gym"
version = "0.26.2"
description = "Gym: A universal API for reinforcement learning environments"
optional = false
python-versions = ">=3.6"
files = [
{file = "gym-0.26.2.tar.gz", hash = "sha256:e0d882f4b54f0c65f203104c24ab8a38b039f1289986803c7d02cdbe214fbcc4"},
]
[package.dependencies]
cloudpickle = ">=1.2.0"
gym_notices = ">=0.0.4"
numpy = ">=1.18.0"
[package.extras]
accept-rom-license = ["autorom[accept-rom-license] (>=0.4.2,<0.5.0)"]
all = ["ale-py (>=0.8.0,<0.9.0)", "box2d-py (==2.3.5)", "imageio (>=2.14.1)", "lz4 (>=3.1.0)", "matplotlib (>=3.0)", "moviepy (>=1.0.0)", "mujoco (==2.2)", "mujoco_py (>=2.1,<2.2)", "opencv-python (>=3.0)", "pygame (==2.1.0)", "pytest (==7.0.1)", "swig (==4.*)"]
atari = ["ale-py (>=0.8.0,<0.9.0)"]
box2d = ["box2d-py (==2.3.5)", "pygame (==2.1.0)", "swig (==4.*)"]
classic-control = ["pygame (==2.1.0)"]
mujoco = ["imageio (>=2.14.1)", "mujoco (==2.2)"]
mujoco-py = ["mujoco_py (>=2.1,<2.2)"]
other = ["lz4 (>=3.1.0)", "matplotlib (>=3.0)", "moviepy (>=1.0.0)", "opencv-python (>=3.0)"]
testing = ["box2d-py (==2.3.5)", "imageio (>=2.14.1)", "lz4 (>=3.1.0)", "matplotlib (>=3.0)", "moviepy (>=1.0.0)", "mujoco (==2.2)", "mujoco_py (>=2.1,<2.2)", "opencv-python (>=3.0)", "pygame (==2.1.0)", "pytest (==7.0.1)", "swig (==4.*)"]
toy-text = ["pygame (==2.1.0)"]
[[package]]
name = "gym-notices"
version = "0.0.8"
description = "Notices for gym"
optional = false
python-versions = "*"
files = [
{file = "gym-notices-0.0.8.tar.gz", hash = "sha256:ad25e200487cafa369728625fe064e88ada1346618526102659b4640f2b4b911"},
{file = "gym_notices-0.0.8-py3-none-any.whl", hash = "sha256:e5f82e00823a166747b4c2a07de63b6560b1acb880638547e0cabf825a01e463"},
]
[[package]] [[package]]
name = "gymnasium" name = "gymnasium"
version = "0.29.1" version = "0.29.1"
@ -3513,4 +3475,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = "^3.10" python-versions = "^3.10"
content-hash = "abe6fc1c5b99d6f51f2efb0adda0e7cd1fcfe7b2d789879dafa441869e555745" content-hash = "f5251fd5ddf3f13fce8a8a0c14131a5ff3d1f433d030598b9e4cefdaaddbd4f8"

View File

@ -42,7 +42,6 @@ torch = "^2.2.1"
tensordict = {git = "https://github.com/pytorch/tensordict"} tensordict = {git = "https://github.com/pytorch/tensordict"}
torchrl = {git = "https://github.com/pytorch/rl", rev = "13bef426dcfa5887c6e5034a6e9697993fa92c37"} torchrl = {git = "https://github.com/pytorch/rl", rev = "13bef426dcfa5887c6e5034a6e9697993fa92c37"}
mujoco = "2.3.7" mujoco = "2.3.7"
gym = "^0.26.2"
opencv-python = "^4.9.0.80" opencv-python = "^4.9.0.80"
diffusers = "^0.26.3" diffusers = "^0.26.3"
torchvision = "^0.17.1" torchvision = "^0.17.1"
@ -51,6 +50,7 @@ dm-control = "1.0.14"
huggingface-hub = {extras = ["hf-transfer"], version = "^0.21.4"} huggingface-hub = {extras = ["hf-transfer"], version = "^0.21.4"}
robomimic = "0.2.0" robomimic = "0.2.0"
gymnasium-robotics = "^1.2.4" gymnasium-robotics = "^1.2.4"
gymnasium = "^0.29.1"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]