From 60adad3b89d6cf7552cea90dcc89afcd3f69760e Mon Sep 17 00:00:00 2001 From: Neeratyoy Mallik Date: Tue, 18 Jun 2024 12:09:16 +0200 Subject: [PATCH 1/5] Update pyproject.toml for PyTorch versions --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 421c7eda..caec46ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,7 +55,8 @@ pandas = "^2" networkx = "^2.6.3" nltk = "^3.6.4" scipy = "^1" -torch = ">=1.7.0,<=2.1, !=2.0.1, !=2.1.0" # fix from: https://stackoverflow.com/a/76647180 +# torch = ">=1.7.0,<=2.1, !=2.0.1, !=2.1.0" # fix from: https://stackoverflow.com/a/76647180 +torch = ">1.7.0" matplotlib = "^3" more-itertools = "*" portalocker = "^2" From 4f41366712af7aaf5effa161b33ef7e91d716472 Mon Sep 17 00:00:00 2001 From: Neeratyoy Mallik Date: Tue, 18 Jun 2024 12:38:54 +0200 Subject: [PATCH 2/5] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index caec46ad..56ca5ab0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,7 +56,7 @@ networkx = "^2.6.3" nltk = "^3.6.4" scipy = "^1" # torch = ">=1.7.0,<=2.1, !=2.0.1, !=2.1.0" # fix from: https://stackoverflow.com/a/76647180 -torch = ">1.7.0" +torch = ">1.7.0,!=2.0.1, !=2.1.0" matplotlib = "^3" more-itertools = "*" portalocker = "^2" From 6f539e8fa01ac147f6f2baff4bce29376050dea7 Mon Sep 17 00:00:00 2001 From: karibbov Date: Tue, 18 Jun 2024 18:03:35 +0200 Subject: [PATCH 3/5] Update pyproject.toml `torchvision` - `torch` compatability --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 56ca5ab0..fa98a4d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,7 +71,7 @@ pre-commit = "^3" mypy = "^1" pytest = "^7" types-PyYAML = "^6" -torchvision = "<0.16.0" # Used in examples +torchvision = ">=0.8.0" # Used in examples mkdocs-material = "*" mkdocs-autorefs = "*" mkdocs-gen-files = "*" From e8a18683d966620b9e9849db7042ac0c2a06bb8f Mon Sep 17 00:00:00 2001 From: karibbov Date: Tue, 18 Jun 2024 19:11:10 +0200 Subject: [PATCH 4/5] Cast Path to str --- tests/test_examples.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_examples.py b/tests/test_examples.py index 6b5e2299..721365b2 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -51,9 +51,9 @@ def no_logs_gte_error(caplog): def test_core_examples(example): if example.name == "analyse.py": # Run hyperparameters example to have something to analyse - runpy.run_path(core_examples_scripts[0], run_name="__main__") + runpy.run_path(str(core_examples_scripts[0]), run_name="__main__") - runpy.run_path(example, run_name="__main__") + runpy.run_path(str(example), run_name="__main__") @pytest.mark.ci_examples From ade69db7c23673fcbe9d2ac2b6dc348810b45bd0 Mon Sep 17 00:00:00 2001 From: karibbov Date: Tue, 18 Jun 2024 22:28:03 +0200 Subject: [PATCH 5/5] Fix AttributeError: 'int' object has no attribute 'nodes' --- .../bayesian_optimization/kernels/utils.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/neps/optimizers/bayesian_optimization/kernels/utils.py b/neps/optimizers/bayesian_optimization/kernels/utils.py index 1441f0f7..92ee1817 100644 --- a/neps/optimizers/bayesian_optimization/kernels/utils.py +++ b/neps/optimizers/bayesian_optimization/kernels/utils.py @@ -33,11 +33,16 @@ def extract_configs(configs: list[SearchSpace]) -> Tuple[list, list]: """ config_hps = [conf.get_normalized_hp_categories() for conf in configs] graphs = [hps["graphs"] for hps in config_hps] - - _nested_graphs = np.array(graphs, dtype=object) - if _nested_graphs.ndim == 3: - graphs = _nested_graphs[:, :, 0].reshape(-1).tolist() - + # Don't call np.array on structured objects + # https://github.com/numpy/numpy/issues/24546#issuecomment-1693913119 + # _nested_graphs = np.array(graphs, dtype=object) + # if _nested_graphs.ndim == 3 + # graphs = _nested_graphs[:, :, 0].reshape(-1).tolist() + # Long hand way of doing the above + if (len(graphs) > 0 and isinstance(graphs[0], list) + and len(graphs[0]) > 0 and isinstance(graphs[0][0], list)): + res = [_list for list_of_list in graphs for _list in list_of_list] + graphs = res return graphs, config_hps