Skip to content

Commit

Permalink
Merging
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucaweihs committed Aug 9, 2024
2 parents b92f806 + 5c23fc6 commit d0d640b
Show file tree
Hide file tree
Showing 179 changed files with 20,247 additions and 11,817 deletions.
1 change: 0 additions & 1 deletion ai2thor/benchmarking.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ def __create_experiments(self):
return experiment_list

def benchmark(self, action_map={}):

env, controller_params = self.__init_env()
experiment_list = self.__create_experiments()
hostname = ""
Expand Down
2 changes: 0 additions & 2 deletions ai2thor/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ def base_dir(self):

class Build(object):
def __init__(self, platform, commit_id, include_private_scenes, releases_dir=None):

if type(platform) is str:
if platform in STR_PLATFORM_MAP:
platform = STR_PLATFORM_MAP[platform]
Expand All @@ -126,7 +125,6 @@ def __init__(self, platform, commit_id, include_private_scenes, releases_dir=Non
self.tmp_dir = os.path.normpath(self.releases_dir + "/../tmp")

def download(self):

makedirs(self.releases_dir)
makedirs(self.tmp_dir)

Expand Down
2 changes: 0 additions & 2 deletions ai2thor/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def nvidia_version():


def generate_dockerfile(tag):

driver_url = "http://us.download.nvidia.com/XFree86/Linux-x86_64/{version}/NVIDIA-Linux-x86_64-{version}.run".format(
version=nvidia_version()
)
Expand Down Expand Up @@ -127,7 +126,6 @@ def kill_container(container_id):


def build_image():

version = nvidia_version()
image_name = "ai2thor/ai2thor-nvidia-%s:%s" % (version, COMMIT_ID)

Expand Down
1 change: 0 additions & 1 deletion ai2thor/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


def download(url, sha256_digest, include_private_scenes=False):

auth = None
if include_private_scenes:
auth = ai2thor.build.boto_auth()
Expand Down
3 changes: 2 additions & 1 deletion ai2thor/hooks/metadata_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@


class MetadataHook(Protocol):
def __call__(self, metadata: Dict[str, Any], controller: "Controller"): ...
def __call__(self, metadata: Dict[str, Any], controller: "Controller"):
...
2 changes: 0 additions & 2 deletions ai2thor/interact.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def interact(
color_frame=False,
metadata=False,
):

if not sys.stdout.isatty():
raise RuntimeError("controller.interact() must be run from a terminal")

Expand Down Expand Up @@ -198,7 +197,6 @@ def add_command(cc, action, **args):
print(" ".join(command_info))

def next_interact_command(self):

current_buffer = ""
while True:
commands = self._interact_commands
Expand Down
3 changes: 0 additions & 3 deletions ai2thor/offline_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

class Controller(object):
def __init__(self, base_dir, grid_size=0.25):

self.grid_size = grid_size
self.base_dir = base_dir
if grid_size < 0.25:
Expand Down Expand Up @@ -153,7 +152,6 @@ def inc(self):


def write_frame(event, base_dir, scene_name, frame_name):

events_dir = "%s/%s/events" % (base_dir, scene_name)
met_dir = "%s/%s/metadata" % (base_dir, scene_name)
os.makedirs(met_dir, exist_ok=True)
Expand All @@ -167,7 +165,6 @@ def write_frame(event, base_dir, scene_name, frame_name):


def look_up_down_write(controller, base_dir, fc, scene_name):

fc.inc()
write_frame(controller.step(action="LookUp"), base_dir, scene_name, fc.counter)
fc.inc()
Expand Down
3 changes: 0 additions & 3 deletions ai2thor/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def __init__(self, system, width, height, x_display, headless):


class BasePlatform:

enabled = True

@classmethod
Expand Down Expand Up @@ -65,7 +64,6 @@ def dependency_instructions(cls, request):

@classmethod
def _select_x_display(cls, width, height):

valid_displays = cls._valid_x_displays(width, height)
if valid_displays:
return valid_displays[0]
Expand Down Expand Up @@ -173,7 +171,6 @@ def executable_path(cls, base_dir, name):

@classmethod
def parse_plist(cls, base_dir, name):

plist_path = os.path.join(base_dir, name + ".app", "Contents/Info.plist")

with open(plist_path) as f:
Expand Down
1 change: 0 additions & 1 deletion ai2thor/robot_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ def reset(self, scene_name=None):
return self.last_event

def step(self, action=None, **action_args):

if type(action) is dict:
action = copy.deepcopy(action) # prevent changes from leaking
else:
Expand Down
8 changes: 0 additions & 8 deletions ai2thor/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ def default(self, obj):


class LazyMask(Mapping):

def __contains__(self, key: object) -> bool:
return self.mask(cast(str, key)) is not None

def __getitem__(self, key: str):

m = self.mask(key)

if m is None:
Expand All @@ -59,7 +57,6 @@ def __len__(self):


class LazyInstanceSegmentationMasks(LazyMask):

def __init__(self, image_ids_data: bytes, metadata: dict):
self._masks: Dict[str, np.ndarray] = {}
self._loaded = False
Expand Down Expand Up @@ -213,7 +210,6 @@ def mask(self, key: str, default: Optional[np.ndarray] = None) -> Optional[np.nd

class LazyDetections2D(Mapping):
def __init__(self, instance_masks: LazyInstanceSegmentationMasks):

self.instance_masks = instance_masks

def mask_bounding_box(self, mask: np.ndarray) -> Optional[Tuple[int, int, int, int]]:
Expand All @@ -239,7 +235,6 @@ def __eq__(self, other: object):


class LazyInstanceDetections2D(LazyDetections2D):

def __init__(self, instance_masks: LazyInstanceSegmentationMasks):
super().__init__(instance_masks)
self._detections2d: Dict[str, Optional[Tuple[int, int, int, int]]] = {}
Expand Down Expand Up @@ -282,9 +277,7 @@ def __iter__(self):


class LazyClassDetections2D(LazyDetections2D):

def __init__(self, instance_masks: LazyInstanceSegmentationMasks):

super().__init__(instance_masks)
self._loaded = False
self._detections2d: Dict[str, Optional[Tuple[Tuple[int, int, int, int], ...]]] = {}
Expand Down Expand Up @@ -533,7 +526,6 @@ def objects_by_type(self, object_type):
return [obj for obj in self.metadata["objects"] if obj["objectType"] == object_type]

def process_colors_ids(self, image_ids_data):

self.instance_masks = LazyInstanceSegmentationMasks(image_ids_data, self.metadata)
self.class_masks = LazyClassSegmentationMasks(self.instance_masks)
self.class_detections2D = LazyClassDetections2D(self.instance_masks)
Expand Down
8 changes: 0 additions & 8 deletions ai2thor/tests/test_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def empty(self):


def controller(**args):

# delete display so the tests can run on Linux
if "DISPLAY" in os.environ:
del os.environ["DISPLAY"]
Expand Down Expand Up @@ -171,7 +170,6 @@ def test_linux_explicit_xdisplay(mocker):


def test_linux_invalid_linux64_invalid_cr(mocker):

mocker.patch("ai2thor.controller.platform_system", fake_linux_system)
mocker.patch("ai2thor.controller.ai2thor.build.Build.exists", fake_exists)
mocker.patch("ai2thor.controller.ai2thor.build.Build.download", noop_download)
Expand All @@ -195,7 +193,6 @@ def test_linux_invalid_linux64_invalid_cr(mocker):


def test_linux_invalid_linux64_valid_cr(mocker):

mocker.patch("ai2thor.controller.platform_system", fake_linux_system)
mocker.patch("ai2thor.controller.ai2thor.build.Build.exists", fake_exists)
mocker.patch("ai2thor.controller.ai2thor.build.Build.download", noop_download)
Expand All @@ -215,7 +212,6 @@ def test_linux_invalid_linux64_valid_cr(mocker):


def test_linux_valid_linux64_valid_cloudrendering(mocker):

mocker.patch("ai2thor.controller.platform_system", fake_linux_system)
mocker.patch("ai2thor.controller.ai2thor.build.Build.exists", fake_exists)
mocker.patch("ai2thor.controller.ai2thor.build.Build.download", noop_download)
Expand All @@ -229,7 +225,6 @@ def test_linux_valid_linux64_valid_cloudrendering(mocker):


def test_linux_valid_linux64_valid_cloudrendering_enabled_cr(mocker):

mocker.patch("ai2thor.controller.platform_system", fake_linux_system)
mocker.patch("ai2thor.controller.ai2thor.build.Build.exists", fake_exists)
mocker.patch("ai2thor.controller.ai2thor.build.Build.download", noop_download)
Expand All @@ -246,7 +241,6 @@ def test_linux_valid_linux64_valid_cloudrendering_enabled_cr(mocker):


def test_linux_valid_linux64_invalid_cloudrendering(mocker):

mocker.patch("ai2thor.controller.platform_system", fake_linux_system)
mocker.patch("ai2thor.controller.ai2thor.build.Build.exists", fake_exists)
mocker.patch("ai2thor.controller.ai2thor.build.Build.download", noop_download)
Expand All @@ -263,7 +257,6 @@ def test_linux_valid_linux64_invalid_cloudrendering(mocker):


def test_linux_missing_linux64(mocker):

mocker.patch("ai2thor.controller.platform_system", fake_linux_system)
mocker.patch("ai2thor.controller.ai2thor.build.Build.exists", fake_cr_exists)
mocker.patch("ai2thor.controller.ai2thor.build.Build.download", noop_download)
Expand All @@ -278,7 +271,6 @@ def test_linux_missing_linux64(mocker):


def test_linux_missing_cloudrendering(mocker):

mocker.patch("ai2thor.controller.platform_system", fake_linux_system)
mocker.patch("ai2thor.controller.ai2thor.build.Build.exists", fake_linux64_exists)
mocker.patch("ai2thor.controller.ai2thor.build.Build.download", noop_download)
Expand Down
1 change: 0 additions & 1 deletion ai2thor/tests/test_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -3602,7 +3602,6 @@ def test_lazy_class_segmentation(event_with_segmentation):

@pytest.mark.parametrize("event_with_segmentation", segmentation_events)
def test_lazy_class_segmentation_missing(event_with_segmentation):

with pytest.raises(KeyError):
event_with_segmentation.class_masks["Stove"]

Expand Down
3 changes: 0 additions & 3 deletions ai2thor/tests/test_fifo_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


def test_multi_agent_train():

s = ai2thor.fifo_server.FifoServer(width=300, height=300)
s.send(dict(action="RotateRight"))
c = FifoClient(s.server_pipe_path, s.client_pipe_path)
Expand All @@ -25,7 +24,6 @@ def test_multi_agent_train():


def test_train_numpy_action():

s = ai2thor.fifo_server.FifoServer(width=300, height=300)
s.send(
dict(
Expand Down Expand Up @@ -56,7 +54,6 @@ def generate_multi_agent_metadata_payload(metadata, sequence_id):


def test_simple():

s = ai2thor.fifo_server.FifoServer(width=300, height=300)
s.send(dict(action="RotateRight"))
c = FifoClient(s.server_pipe_path, s.client_pipe_path)
Expand Down
5 changes: 0 additions & 5 deletions ai2thor/tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def test_ping(client):


def test_multi_agent_train():

s = ai2thor.wsgi_server.WsgiServer(host="127.0.0.1")
s.send(dict(action="RotateRight"))
c = s.app.test_client()
Expand All @@ -89,7 +88,6 @@ def test_multi_agent_train():


def test_train_numpy_action():

s = ai2thor.wsgi_server.WsgiServer(host="127.0.0.1")
s.send(
dict(
Expand Down Expand Up @@ -118,7 +116,6 @@ def test_train_numpy_action():


def test_train():

s = ai2thor.wsgi_server.WsgiServer(host="127.0.0.1")
s.send(dict(action="RotateRight"))
c = s.app.test_client()
Expand All @@ -132,7 +129,6 @@ def test_train():


def test_client_token_mismatch():

s = ai2thor.wsgi_server.WsgiServer(host="127.0.0.1")
s.send(dict(action="RotateRight"))
s.client_token = "123456"
Expand Down Expand Up @@ -166,7 +162,6 @@ def test_non_multipart():


def test_sequence_id_mismatch():

s = ai2thor.wsgi_server.WsgiServer(host="127.0.0.1")
s.send(dict(action="RotateRight"))
c = s.app.test_client()
Expand Down
7 changes: 0 additions & 7 deletions ai2thor/tests/test_unity.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ def test_third_party_camera_with_image_synthesis(fifo_controller):


def test_rectangle_aspect(fifo_controller):

fifo_controller.reset(TEST_SCENE, width=600, height=300)
event = fifo_controller.step(dict(action="Initialize", gridSize=0.25))
assert event.frame.shape == (300, 600, 3)
Expand Down Expand Up @@ -385,7 +384,6 @@ def test_lookdown(controller):

@pytest.mark.parametrize("controller", fifo_wsgi)
def test_no_leak_params(controller):

action = dict(action="RotateLook", rotation=0, horizon=0)
e = controller.step(action)
assert "sequenceId" not in action
Expand All @@ -404,7 +402,6 @@ def test_target_invocation_exception(controller):

@pytest.mark.parametrize("controller", fifo_wsgi)
def test_lookup(controller):

e = controller.step(dict(action="RotateLook", rotation=0, horizon=0))
position = controller.last_event.metadata["agent"]["position"]
horizon = controller.last_event.metadata["agent"]["cameraHorizon"]
Expand All @@ -419,7 +416,6 @@ def test_lookup(controller):

@pytest.mark.parametrize("controller", fifo_wsgi)
def test_rotate_left(controller):

e = controller.step(dict(action="RotateLook", rotation=0, horizon=0))
position = controller.last_event.metadata["agent"]["position"]
rotation = controller.last_event.metadata["agent"]["rotation"]
Expand All @@ -435,7 +431,6 @@ def test_rotate_left(controller):

@pytest.mark.parametrize("controller", fifo_wsgi)
def test_simobj_filter(controller):

objects = controller.last_event.metadata["objects"]
unfiltered_object_ids = sorted([o["objectId"] for o in objects])
filter_object_ids = sorted([o["objectId"] for o in objects[0:3]])
Expand Down Expand Up @@ -645,7 +640,6 @@ def test_update_third_party_camera(fifo_controller):

@pytest.mark.parametrize("controller", fifo_wsgi)
def test_rotate_look(controller):

e = controller.step(dict(action="RotateLook", rotation=0, horizon=0))
position = controller.last_event.metadata["agent"]["position"]
rotation = controller.last_event.metadata["agent"]["rotation"]
Expand All @@ -660,7 +654,6 @@ def test_rotate_look(controller):

@pytest.mark.parametrize("controller", fifo_wsgi)
def test_rotate_right(controller):

e = controller.step(dict(action="RotateLook", rotation=0, horizon=0))
position = controller.last_event.metadata["agent"]["position"]
rotation = controller.last_event.metadata["agent"]["rotation"]
Expand Down
1 change: 0 additions & 1 deletion ai2thor/tests/test_unity_procedural.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ def test_determinism(controller_args):
print(f"{pos}")
object_positions.append(pos)
if prev_pos:

diffs = list(diff(pos, prev_pos, tolerance=0.00001))
print(diffs)
assert [] == diffs
1 change: 0 additions & 1 deletion ai2thor/util/depth.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def generate_noise_indices(img_size):
corner = t

for i, c in enumerate(corner):

offset = 0
i_offset = 0
if j % 2 != 0:
Expand Down
1 change: 0 additions & 1 deletion ai2thor/util/scene_yaml_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def GetSceneNames(start_index, last_index, nameTemplate="", prefix_path="unity/A


def main():

# testSceneNames = GetRoboSceneNames(3, 5, "Val")
# valSceneNames = GetRoboSceneNames(2, 2, "test-dev", "unity/Assets/Private/Scenes")
# trainSceneNames = GetRoboSceneNames(12, 5, "Train")
Expand Down
Loading

0 comments on commit d0d640b

Please sign in to comment.