diff --git a/requirements.txt b/requirements.txt index b0b9ac9a7..9df7456c4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,4 +8,4 @@ matplotlib # used in examples and tests pytest # tests runner pytest-xdist # allows running parallel testing with pytest -n black # check code format -ConfigSpace~=0.6.1 \ No newline at end of file +ConfigSpace~=0.7.1 \ No newline at end of file diff --git a/smt/utils/design_space.py b/smt/utils/design_space.py index 3b9458d89..d8127d327 100644 --- a/smt/utils/design_space.py +++ b/smt/utils/design_space.py @@ -23,7 +23,7 @@ ForbiddenInClause, ForbiddenAndConjunction, ) - from ConfigSpace.exceptions import ForbiddenValueError + from ConfigSpace.exceptions import ForbiddenValueError, InactiveHyperparameter from ConfigSpace.util import get_random_neighbor HAS_CONFIG_SPACE = True @@ -967,9 +967,9 @@ def _get_correct_config(self, vector: np.ndarray) -> Configuration: config.is_valid_configuration() return config - except ValueError as e: + except Exception as e: error_str = str(e) - if "Inactive hyperparameter" in error_str: + if isinstance(e, InactiveHyperparameter): # Deduce which parameter is inactive inactive_param_name = error_str.split("'")[1] param_idx = self._cs.get_idx_by_hyperparameter_name(