Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cascading series of CI dependency problems #746

Merged
merged 16 commits into from
May 21, 2024
Merged
16 changes: 9 additions & 7 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,18 @@ RUN umask 0002 \
&& /opt/conda/bin/conda install -v -y -n base conda-libmamba-solver \
&& /opt/conda/bin/conda config --set solver libmamba \
&& /opt/conda/bin/conda list -n base \
&& /opt/conda/bin/conda clean -v -y -a

# Update the base. This helps save space by making sure the same version
# python is used for both the base env and mlos env.
RUN umask 0002 \
&& /opt/conda/bin/conda update -v -y -n base -c defaults --all \
&& /opt/conda/bin/conda update -v -y -n base -c defaults conda python \
&& /opt/conda/bin/conda clean -v -y -a \
&& /opt/conda/bin/conda run -n base pip cache purge

# No longer relevant since we're using conda-forge in the environment files by default now.
## Update the base. This helps save space by making sure the same version
## python is used for both the base env and mlos env.
#RUN umask 0002 \
# && /opt/conda/bin/conda update -v -y -n base -c defaults --all \
# && /opt/conda/bin/conda update -v -y -n base -c defaults conda python \
# && /opt/conda/bin/conda clean -v -y -a \
# && /opt/conda/bin/conda run -n base pip cache purge

# Install some additional editor packages for the base environment.
RUN umask 0002 \
&& /opt/conda/bin/conda run -n base pip install --no-cache-dir -U pynvim
Expand Down
3 changes: 2 additions & 1 deletion conda-envs/mlos-3.10.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: mlos-3.10
channels:
- conda-forge
- defaults
dependencies:
# Basic dev environment packages.
Expand All @@ -10,7 +11,7 @@ dependencies:
- pydocstyle
- flake8
- setuptools
- setuptools-scm
- setuptools-scm>=8.1.0
- jupyter
- ipykernel
- nb_conda_kernels
Expand Down
3 changes: 2 additions & 1 deletion conda-envs/mlos-3.11.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: mlos-3.11
channels:
- conda-forge
- defaults
dependencies:
# Basic dev environment packages.
Expand All @@ -10,7 +11,7 @@ dependencies:
- pydocstyle
- flake8
- setuptools
- setuptools-scm
- setuptools-scm>=8.1.0
- jupyter
- ipykernel
- nb_conda_kernels
Expand Down
3 changes: 2 additions & 1 deletion conda-envs/mlos-3.8.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: mlos-3.8
channels:
- conda-forge
- defaults
dependencies:
# Basic dev environment packages.
Expand All @@ -10,7 +11,7 @@ dependencies:
- pydocstyle
- flake8
- setuptools
- setuptools-scm
- setuptools-scm>=8.1.0
- jupyter
- ipykernel
- nb_conda_kernels
Expand Down
3 changes: 2 additions & 1 deletion conda-envs/mlos-3.9.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: mlos-3.9
channels:
- conda-forge
- defaults
dependencies:
# Basic dev environment packages.
Expand All @@ -10,7 +11,7 @@ dependencies:
- pydocstyle
- flake8
- setuptools
- setuptools-scm
- setuptools-scm>=8.1.0
- jupyter
- ipykernel
- nb_conda_kernels
Expand Down
8 changes: 4 additions & 4 deletions conda-envs/mlos-windows.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: mlos
channels:
# Note: we have to reverse the channel priority for Windows to accomodate strict channel_priority setups.
# Hence, additional dependencies may differ from the Linux setup.
- conda-forge
- defaults
dependencies:
Expand All @@ -13,7 +12,7 @@ dependencies:
- pydocstyle
- flake8
- setuptools
- setuptools-scm
- setuptools-scm>=8.1.0
- jupyter
- ipykernel
- nb_conda_kernels
Expand All @@ -23,10 +22,11 @@ dependencies:
- pyarrow
- swig
- libpq
- python=3.11
# FIXME: https://github.com/microsoft/MLOS/issues/727
- python<3.12
# Install an SMAC requirement pre-compiled from conda-forge.
# This also requires a more recent vs2015_runtime from conda-forge.
- conda-forge::pyrfr>=0.9.0
- pyrfr>=0.9.0
- pip:
- autopep8>=1.7.0
- bump2version
Expand Down
6 changes: 4 additions & 2 deletions conda-envs/mlos.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: mlos
channels:
- conda-forge
- defaults
dependencies:
# Basic dev environment packages.
Expand All @@ -10,7 +11,7 @@ dependencies:
- pydocstyle
- flake8
- setuptools
- setuptools-scm
- setuptools-scm>=8.1.0
- jupyter
- ipykernel
- nb_conda_kernels
Expand All @@ -20,7 +21,8 @@ dependencies:
- pyarrow
- swig
- libpq
- python
# FIXME: https://github.com/microsoft/MLOS/issues/727
- python<3.12
- pip:
- autopep8>=1.7.0
- bump2version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SmacOptimizer(BaseBayesianOptimizer):
Wrapper class for SMAC based Bayesian optimization.
"""

def __init__(self, *, # pylint: disable=too-many-locals
def __init__(self, *, # pylint: disable=too-many-locals,too-many-arguments
parameter_space: ConfigSpace.ConfigurationSpace,
optimization_targets: List[str],
space_adapter: Optional[BaseSpaceAdapter] = None,
Expand Down Expand Up @@ -283,7 +283,7 @@ def _suggest(self, context: Optional[pd.DataFrame] = None) -> pd.DataFrame:
Pandas dataframe with a single row. Column names are the parameter names.
"""
if TYPE_CHECKING:
from smac.runhistory import TrialInfo # pylint: disable=import-outside-toplevel
from smac.runhistory import TrialInfo # pylint: disable=import-outside-toplevel,unused-import

if context is not None:
warn(f"Not Implemented: Ignoring context {list(context.columns)}", UserWarning)
Expand Down
2 changes: 1 addition & 1 deletion mlos_core/mlos_core/optimizers/flaml_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class FlamlOptimizer(BaseOptimizer):
Wrapper class for FLAML Optimizer: A fast library for AutoML and tuning.
"""

def __init__(self, *,
def __init__(self, *, # pylint: disable=too-many-arguments
parameter_space: ConfigSpace.ConfigurationSpace,
optimization_targets: List[str],
space_adapter: Optional[BaseSpaceAdapter] = None,
Expand Down
3 changes: 2 additions & 1 deletion mlos_core/mlos_core/spaces/adapters/llamatune.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from warnings import warn

import ConfigSpace
from ConfigSpace.hyperparameters import NumericalHyperparameter
import numpy as np
import numpy.typing as npt
import pandas as pd
Expand Down Expand Up @@ -222,7 +223,7 @@ def _transform(self, configuration: dict) -> dict:
index = max(0, min(len(param.choices) - 1, index))
# NOTE: potential rounding here would be unfair to first & last values
orig_value = param.choices[index]
elif isinstance(param, ConfigSpace.hyperparameters.NumericalHyperparameter):
elif isinstance(param, NumericalHyperparameter):
if param.name in self._special_param_values_dict:
value = self._special_param_value_scaler(param, value)

Expand Down
7 changes: 5 additions & 2 deletions mlos_core/mlos_core/spaces/converters/flaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Contains space converters for FLAML.
"""

from typing import Dict
from typing import Dict, TYPE_CHECKING

import sys

Expand All @@ -16,6 +16,9 @@
import flaml.tune
import flaml.tune.sample

if TYPE_CHECKING:
from ConfigSpace.hyperparameters import Hyperparameter

if sys.version_info >= (3, 10):
from typing import TypeAlias
else:
Expand Down Expand Up @@ -46,7 +49,7 @@ def configspace_to_flaml_space(config_space: ConfigSpace.ConfigurationSpace) ->
(ConfigSpace.UniformFloatHyperparameter, True): flaml.tune.loguniform,
}

def _one_parameter_convert(parameter: ConfigSpace.hyperparameters.Hyperparameter) -> FlamlDomain:
def _one_parameter_convert(parameter: "Hyperparameter") -> FlamlDomain:
if isinstance(parameter, ConfigSpace.UniformFloatHyperparameter):
# FIXME: upper isn't included in the range
return flaml_numeric_type[(type(parameter), parameter.log)](parameter.lower, parameter.upper)
Expand Down
4 changes: 2 additions & 2 deletions mlos_core/mlos_core/tests/spaces/spaces_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
import scipy

import ConfigSpace as CS
from ConfigSpace.hyperparameters import NormalIntegerHyperparameter
from ConfigSpace.hyperparameters import Hyperparameter, NormalIntegerHyperparameter

import flaml.tune.sample

from mlos_core.spaces.converters.flaml import configspace_to_flaml_space, FlamlDomain, FlamlSpace


OptimizerSpace = Union[FlamlSpace, CS.ConfigurationSpace]
OptimizerParam = Union[FlamlDomain, CS.hyperparameters.Hyperparameter]
OptimizerParam = Union[FlamlDomain, Hyperparameter]


def assert_is_uniform(arr: npt.NDArray) -> None:
Expand Down
2 changes: 1 addition & 1 deletion mlos_viz/mlos_viz/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def compute_zscore_for_group_agg(
compute_zscore_for_group_agg(results_groups_perf, stats_df, result_col, "var")
quantiles = [0.50, 0.75, 0.90, 0.95, 0.99]
for quantile in quantiles: # TODO: can we do this in one pass?
quantile_col = result_col + f".p{int(quantile*100)}"
quantile_col = f"{result_col}.p{int(quantile * 100)}"
stats_df[quantile_col] = results_groups_perf.transform("quantile", quantile)
augmented_results_df = pandas.concat([augmented_results_df, stats_df], axis=1)
return augmented_results_df
Expand Down
Loading