Skip to content

Commit

Permalink
Unpin numpy and gymnasium (#630)
Browse files Browse the repository at this point in the history
* Use item() where applicable

* Unpin numpy

* Unpin gymnasium
  • Loading branch information
fredyshox committed Feb 5, 2024
1 parent eea6a95 commit 01e7f89
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions metadrive/policy/replay_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down
3 changes: 2 additions & 1 deletion metadrive/scenario/parse_object_state.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import copy
import warnings

from metadrive.component.lane.point_lane import PointLane
from metadrive.utils.math import compute_angular_velocity
Expand Down Expand Up @@ -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]:
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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.
Expand All @@ -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
"""

0 comments on commit 01e7f89

Please sign in to comment.