From 01e7f89f3a8b03185832e5ce9de5b65e950b1b7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20R=C4=85czy?= Date: Sun, 4 Feb 2024 16:14:31 -0800 Subject: [PATCH] Unpin numpy and gymnasium (#630) * Use item() where applicable * Unpin numpy * Unpin gymnasium --- metadrive/policy/replay_policy.py | 4 ++-- metadrive/scenario/parse_object_state.py | 3 ++- setup.py | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/metadrive/policy/replay_policy.py b/metadrive/policy/replay_policy.py index f565f7615..80f54d8a7 100644 --- a/metadrive/policy/replay_policy.py +++ b/metadrive/policy/replay_policy.py @@ -55,10 +55,10 @@ def act(self, *args, **kwargs): if "throttle_brake" in info: if hasattr(self.control_object, "set_throttle_brake"): - self.control_object.set_throttle_brake(float(info["throttle_brake"])) + self.control_object.set_throttle_brake(float(info["throttle_brake"].item())) if "steering" in info: if hasattr(self.control_object, "set_steering"): - self.control_object.set_steering(float(info["steering"])) + self.control_object.set_steering(float(info["steering"].item())) self.control_object.set_position(info["position"]) self.control_object.set_velocity(info["velocity"], in_local_frame=self._velocity_local_frame) self.control_object.set_heading_theta(info["heading"]) diff --git a/metadrive/scenario/parse_object_state.py b/metadrive/scenario/parse_object_state.py index 4726ff733..af1dffe3e 100644 --- a/metadrive/scenario/parse_object_state.py +++ b/metadrive/scenario/parse_object_state.py @@ -1,4 +1,5 @@ import copy +import warnings from metadrive.component.lane.point_lane import PointLane from metadrive.utils.math import compute_angular_velocity @@ -50,7 +51,7 @@ def parse_object_state(object_dict, time_idx, check_last_state=False, sim_time_i # optional keys with scalar value: for k in ["length", "width", "height"]: if k in states: - ret[k] = float(states[k][time_idx]) + ret[k] = float(states[k][time_idx].item()) ret["valid"] = states["valid"][time_idx] if time_idx < len(states["position"]) - 1 and states["valid"][time_idx] and states["valid"][time_idx + 1]: diff --git a/setup.py b/setup.py index df19ee8cb..da5e82984 100644 --- a/setup.py +++ b/setup.py @@ -38,8 +38,8 @@ def is_win(): install_requires = [ "requests", - "gymnasium>=0.28, <0.29", - "numpy>=1.21.6, <=1.24.2", + "gymnasium>=0.28", + "numpy>=1.21.6", "matplotlib", "pandas", "pygame", @@ -118,7 +118,7 @@ def is_win(): 5. Get wheel python setup.py sdist bdist_wheel -6. Upload to production channel +6. Upload to production channel twine upload dist/* 7. Draft a release on github with new version number and upload assets.zip and the generated .whl files to the release. @@ -127,6 +127,6 @@ def is_win(): 9. Merge this branch into main -!!!!!!!!!!!!! NOTE: please make sure that unzip assets.zip will generate a folder called assets instead of files +!!!!!!!!!!!!! NOTE: please make sure that unzip assets.zip will generate a folder called assets instead of files """