From cd43f296f2a7f4447114cd59c95802a20a6844a6 Mon Sep 17 00:00:00 2001 From: Federico Berto Date: Thu, 4 May 2023 22:43:48 +0900 Subject: [PATCH 1/3] Avoid bug when importing oracles without Mujoco --- design_bench/oracles/exact/__init__.py | 47 +++++++++++++++++++++----- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/design_bench/oracles/exact/__init__.py b/design_bench/oracles/exact/__init__.py index cf023cf..aefafc1 100644 --- a/design_bench/oracles/exact/__init__.py +++ b/design_bench/oracles/exact/__init__.py @@ -1,8 +1,39 @@ -from .hopper_controller_oracle import HopperControllerOracle -from .ant_morphology_oracle import AntMorphologyOracle -from .dkitty_morphology_oracle import DKittyMorphologyOracle -from .toy_continuous_oracle import ToyContinuousOracle -from .nas_bench_oracle import NASBenchOracle -from .tf_bind_8_oracle import TFBind8Oracle -from .tf_bind_10_oracle import TFBind10Oracle -from .toy_discrete_oracle import ToyDiscreteOracle +try: + from .hopper_controller_oracle import HopperControllerOracle +except ImportError: + pass + +try: + from .ant_morphology_oracle import AntMorphologyOracle +except ImportError: + pass + +try: + from .dkitty_morphology_oracle import DKittyMorphologyOracle +except ImportError: + pass + +try: + from .toy_continuous_oracle import ToyContinuousOracle +except ImportError: + pass + +try: + from .nas_bench_oracle import NASBenchOracle +except ImportError: + pass + +try: + from .tf_bind_8_oracle import TFBind8Oracle +except ImportError: + pass + +try: + from .tf_bind_10_oracle import TFBind10Oracle +except ImportError: + pass + +try: + from .toy_discrete_oracle import ToyDiscreteOracle +except ImportError: + pass From 4216fd005b3a770d336b4487801a441b2dd7385e Mon Sep 17 00:00:00 2001 From: Hengzhe Zhang Date: Mon, 25 Sep 2023 21:10:25 +1300 Subject: [PATCH 2/3] Update dataset_builder.py --- design_bench/datasets/dataset_builder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/design_bench/datasets/dataset_builder.py b/design_bench/datasets/dataset_builder.py index b987b0e..4d5102e 100644 --- a/design_bench/datasets/dataset_builder.py +++ b/design_bench/datasets/dataset_builder.py @@ -453,7 +453,7 @@ def __init__(self, x_shards, y_shards, internal_batch_size=32, self._disable_transform = False self._disable_subsample = False self.dataset_visible_mask = np.full( - [self.dataset_size], True, dtype=np.bool) + [self.dataset_size], True, dtype=np.bool_) # handle requests to normalize and subsample the dataset if is_normalized_x: @@ -1068,7 +1068,7 @@ def subsample(self, max_samples=None, distribution=None, indices.size, max_samples, replace=False, p=probs / probs.sum())] # binary mask that determines which samples are visible - visible_mask = np.full([y.shape[0]], False, dtype=np.bool) + visible_mask = np.full([y.shape[0]], False, dtype=np.bool_) visible_mask[indices] = True self.dataset_visible_mask = visible_mask self.dataset_size = indices.size From 50cd4ad175c6488bd458eb0da2f49519f6e091f1 Mon Sep 17 00:00:00 2001 From: Brandon Trabucco Date: Mon, 29 Jan 2024 13:24:11 -0500 Subject: [PATCH 3/3] adding error log when import fails --- design_bench/oracles/exact/__init__.py | 43 ++++++++++++++------------ 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/design_bench/oracles/exact/__init__.py b/design_bench/oracles/exact/__init__.py index aefafc1..5c103b9 100644 --- a/design_bench/oracles/exact/__init__.py +++ b/design_bench/oracles/exact/__init__.py @@ -1,39 +1,44 @@ try: - from .hopper_controller_oracle import HopperControllerOracle -except ImportError: - pass + from .ant_morphology_oracle import AntMorphologyOracle +except ImportError as e: + print("Skipping AntMorphologyOracle import:", e) try: - from .ant_morphology_oracle import AntMorphologyOracle -except ImportError: - pass + from .cifar_nas_oracle import CIFARNASOracle +except ImportError as e: + print("Skipping CIFARNASOracle import:", e) try: from .dkitty_morphology_oracle import DKittyMorphologyOracle -except ImportError: - pass +except ImportError as e: + print("Skipping DKittyMorphologyOracle import:", e) try: - from .toy_continuous_oracle import ToyContinuousOracle -except ImportError: - pass + from .hopper_controller_oracle import HopperControllerOracle +except ImportError as e: + print("Skipping HopperControllerOracle import:", e) try: from .nas_bench_oracle import NASBenchOracle -except ImportError: - pass +except ImportError as e: + print("Skipping NASBenchOracle import:", e) try: from .tf_bind_8_oracle import TFBind8Oracle -except ImportError: - pass +except ImportError as e: + print("Skipping TFBind8Oracle import:", e) try: from .tf_bind_10_oracle import TFBind10Oracle -except ImportError: - pass +except ImportError as e: + print("Skipping TFBind10Oracle import:", e) + +try: + from .toy_continuous_oracle import ToyContinuousOracle +except ImportError as e: + print("Skipping ToyContinuousOracle import:", e) try: from .toy_discrete_oracle import ToyDiscreteOracle -except ImportError: - pass +except ImportError as e: + print("Skipping ToyDiscreteOracle import:", e)