Skip to content

Commit a5bba06

Browse files
authored
Merge pull request #21 from Sohambasu07/main
Update to ConfigSpace>=1.0
2 parents 0c7498b + 7c87864 commit a5bba06

File tree

22 files changed

+122
-66
lines changed

22 files changed

+122
-66
lines changed

.github/workflows/pre-commit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ jobs:
1919
- uses: actions/checkout@v4
2020
with:
2121
submodules: recursive
22-
- name: Setup Python 3.8
22+
- name: Setup Python 3.10
2323
uses: actions/setup-python@v4
2424
with:
25-
python-version: 3.8
25+
python-version: "3.10"
2626
- run: pip install pre-commit
2727
- run: pre-commit install
2828
- run: pre-commit run --all-files

.github/workflows/pytest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
python-version: ["3.8", "3.9", "3.10", "3.11"]
19+
python-version: ["3.10", "3.11"]
2020
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
2121
steps:
2222
- uses: actions/checkout@v4

pyproject.toml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
name = "mf-prior-bench"
55
dependencies = [
66
"pyyaml",
7-
"numpy",
8-
"configspace<=0.7",
7+
"numpy<2.0",
8+
"configspace>=1.0",
99
"pandas",
1010
"more_itertools",
1111
"pyarrow"
@@ -15,7 +15,7 @@ description = "A wrapper for multi-fidelity benchmarks with priors"
1515
authors = [{name = "Eddie Bergman", email="[email protected]"}]
1616
readme = "README.md"
1717
license = { file = "LICENSE.txt" }
18-
requires-python = ">=3.8"
18+
requires-python = ">=3.10"
1919
classifiers = [
2020
'Intended Audience :: Science/Research',
2121
'Intended Audience :: Developers',
@@ -32,11 +32,13 @@ classifiers = [
3232
[project.optional-dependencies]
3333
yahpo = ["yahpo-gym==1.0.1"]
3434
jahs-bench = [
35-
"jahs_bench==1.1",
36-
"pandas<1.4",
35+
"jahs_bench==1.2.0",
36+
"pandas<2.0",
37+
"numpy<2.0.0"
3738
]
3839
tabular = ["pandas>2", "pyarrow"]
39-
pd1 = ["xgboost>=1.7"]
40+
pd1 = ["xgboost[scikit-learn]>=1.7"]
41+
taskset_tabular = ["tensorflow<=2.18.0"]
4042
surrogates = ["dehb"]
4143
docs = [
4244
"mkdocs",
@@ -82,10 +84,10 @@ exclude_lines = [
8284
] # These are lines to exclude from coverage
8385

8486
[tool.black]
85-
target-version = ['py38']
87+
target-version = ['py310']
8688

8789
[tool.ruff]
88-
target-version = "py38"
90+
target-version = "py310"
8991
line-length = 88
9092
src = ["src", "tests"]
9193

@@ -224,7 +226,7 @@ convention = "google"
224226
max-args = 10 # Changed from default of 5
225227

226228
[tool.mypy]
227-
python_version = "3.8"
229+
python_version = "3.10"
228230
packages = ["src/mfpbench", "tests"]
229231

230232
show_error_codes = true

src/mfpbench/config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ def set_as_default_prior(self, configspace: ConfigurationSpace) -> None:
146146
)
147147
# No need to do anything here
148148
else:
149-
hp.default_value = hp.check_default(v)
149+
if not hp.legal_value(v):
150+
raise ValueError(f"Value {v} is not legal for {k}")
151+
hp.default_value = v
150152

151153
@classmethod
152154
def from_file(cls, path: str | Path) -> Self:

src/mfpbench/jahs/benchmark.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def _jahs_configspace(
264264
) from e
265265

266266
space = ConfigurationSpace(name=name, seed=seed)
267-
space.add_hyperparameters(
267+
space.add(
268268
[
269269
Constant(
270270
"N",
@@ -342,5 +342,5 @@ def _jahs_configspace(
342342
log=True,
343343
)
344344

345-
space.add_hyperparameters([optimizers, lr, weight_decay])
345+
space.add([optimizers, lr, weight_decay])
346346
return space

src/mfpbench/lcbench_tabular/benchmark.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def _get_raw_lcbench_space(
4343
"""
4444
# obtained from https://github.com/automl/lcbench#dataset-overview
4545
cs = ConfigurationSpace(name=name, seed=seed)
46-
cs.add_hyperparameters(
46+
cs.add(
4747
[
4848
UniformIntegerHyperparameter(
4949
"batch_size",
@@ -98,7 +98,7 @@ def _get_raw_lcbench_space(
9898
)
9999

100100
if with_constants:
101-
cs.add_hyperparameters(
101+
cs.add(
102102
[
103103
Constant("cosine_annealing_T_max", 50),
104104
Constant("cosine_annealing_eta_min", 0.0),

src/mfpbench/nb201_tabular/benchmark.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
"""
66
from __future__ import annotations
77

8+
from collections.abc import Mapping
89
from dataclasses import dataclass
910
from pathlib import Path
10-
from typing import Any, ClassVar, Literal, Mapping
11+
from typing import Any, ClassVar, Literal
1112

1213
import numpy as np
1314
import pandas as pd
@@ -28,7 +29,7 @@ def _raw_space(name: str, *, seed: int | None = None) -> ConfigurationSpace:
2829
"avg_pool_3x3",
2930
]
3031
cs = ConfigurationSpace(name=name, seed=seed)
31-
cs.add_hyperparameters(
32+
cs.add(
3233
[
3334
CategoricalHyperparameter("edge_0_1", choices=choices.copy()),
3435
CategoricalHyperparameter("edge_0_2", choices=choices.copy()),

src/mfpbench/pd1/benchmarks/cifar100.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class PD1cifar100_wideresnet_2048(PD1Benchmark):
1313
@classmethod
1414
def _create_space(cls, seed: int | None = None) -> ConfigurationSpace:
1515
cs = ConfigurationSpace(seed=seed)
16-
cs.add_hyperparameters(
16+
cs.add(
1717
[
1818
UniformFloatHyperparameter(
1919
"lr_decay_factor",

src/mfpbench/pd1/benchmarks/imagenet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class PD1imagenet_resnet_512(PD1Benchmark):
1313
@classmethod
1414
def _create_space(cls, seed: int | None = None) -> ConfigurationSpace:
1515
cs = ConfigurationSpace(seed=seed)
16-
cs.add_hyperparameters(
16+
cs.add(
1717
[
1818
UniformFloatHyperparameter(
1919
"lr_decay_factor",

src/mfpbench/pd1/benchmarks/lm1b.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class PD1lm1b_transformer_2048(PD1Benchmark):
1313
@classmethod
1414
def _create_space(cls, seed: int | None = None) -> ConfigurationSpace:
1515
cs = ConfigurationSpace(seed=seed)
16-
cs.add_hyperparameters(
16+
cs.add(
1717
[
1818
UniformFloatHyperparameter(
1919
"lr_decay_factor",

0 commit comments

Comments
 (0)