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

chore: fix unit test #678

Merged
merged 2 commits into from
May 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions tst/benchmarking/benchmark_commons/test_hpo_main_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
nas201_mo_benchmark,
)
from benchmarking.nursery.benchmark_multiobjective.hpo_main import main
from syne_tune.config_space import choice


class HPOMainLocalTests(unittest.TestCase):
Expand All @@ -32,11 +33,11 @@ class HPOMainLocalTests(unittest.TestCase):
)
@patch("benchmarking.commons.hpo_main_simulator.Tuner", new_callable=MagicMock)
@patch(
"benchmarking.commons.hpo_main_simulator.BlackboxRepositoryBackend",
"benchmarking.commons.hpo_main_simulator.BlackboxRepositoryBackend.blackbox",
new_callable=MagicMock,
)
def test_tuner_is_run_the_expected_number_of_times(
self, mock_blackbox_repository_backend, mock_tuner, mock_config_from_argparse
self, mock_blackbox, mock_tuner, mock_config_from_argparse
):
methods = {
Methods.RS: lambda method_arguments: RandomSearch(method_arguments),
Expand All @@ -50,27 +51,42 @@ def test_tuner_is_run_the_expected_number_of_times(
"nas201-ImageNet16-120": nas201_mo_benchmark("ImageNet16-120"),
}

hp_cols = ["hp_x0", "hp_x1", "hp_x2", "hp_x3", "hp_x4", "hp_x5"]

config_space = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let us at least use the correct space for these benchmarks:

    hp_cols = ["hp_x0", "hp_x1", "hp_x2", "hp_x3", "hp_x4", "hp_x5"]

    config_space = {
        node: choice(
            ["avg_pool_3x3", "nor_conv_3x3", "skip_connect", "nor_conv_1x1", "none"]
        )
        for node in hp_cols
    }
    config_space["epochs"] = 200

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

node: choice(
["avg_pool_3x3", "nor_conv_3x3", "skip_connect", "nor_conv_1x1", "none"]
)
for node in hp_cols
}

config_space["epochs"] = 200

mock_blackbox.configuration_space_with_max_resource_attr.return_value = (
config_space
)

seeds = [1, 2]

mock_config_from_argparse.return_value = ConfigDict.from_dict(
{
"experiment_tag": "my-new-experiment",
"num_seeds": len(seeds),
"start_seed": 0,
"start_seed": False,
"method": None,
"save_tuner": 0,
"save_tuner": False,
"n_workers": None,
"max_wallclock_time": None,
"random_seed": None,
"max_size_data_for_model": None,
"scale_max_wallclock_time": 0,
"scale_max_wallclock_time": False,
"use_long_tuner_name_prefix": True,
"launched_remotely": False,
"benchmark": None,
"verbose": False,
"support_checkpointing": 1,
"support_checkpointing": True,
"fcnet_ordinal": "nn-log",
"restrict_configurations": 0,
"restrict_configurations": False,
"seeds": seeds,
}
)
Expand Down