Skip to content

Commit

Permalink
Reap get_sequential_optimization_scheduler_options (facebook#2335)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: facebook#2335

Reviewed By: sdaulton

Differential Revision: D55875116
  • Loading branch information
esantorella authored and facebook-github-bot committed Apr 8, 2024
1 parent 541ae7a commit 21a3baf
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 23 deletions.
12 changes: 0 additions & 12 deletions ax/benchmark/benchmark_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,6 @@ def get_benchmark_scheduler_options(
)


def get_sequential_optimization_scheduler_options(
timeout_hours: int = 4,
) -> SchedulerOptions:
"""The typical SchedulerOptions used in benchmarking.
Args:
timeout_hours: The maximum amount of time (in hours) to run each
benchmark replication. Defaults to 4 hours.
"""
return get_benchmark_scheduler_options(timeout_hours=timeout_hours)


def _assign_frozen_attr(obj: Any, name: str, value: Any) -> None: # pyre-ignore [2]
"""Assign a new value to an attribute of a frozen dataclass.
This is an ugly hack and shouldn't be used broadly.
Expand Down
5 changes: 2 additions & 3 deletions ax/benchmark/methods/modular_botorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from ax.benchmark.benchmark_method import (
BenchmarkMethod,
get_sequential_optimization_scheduler_options,
get_benchmark_scheduler_options,
)
from ax.modelbridge.generation_strategy import GenerationStep, GenerationStrategy
from ax.modelbridge.registry import Models
Expand Down Expand Up @@ -89,7 +89,6 @@ def get_sobol_botorch_modular_acquisition(
return BenchmarkMethod(
name=generation_strategy.name,
generation_strategy=generation_strategy,
scheduler_options=scheduler_options
or get_sequential_optimization_scheduler_options(),
scheduler_options=scheduler_options or get_benchmark_scheduler_options(),
distribute_replications=distribute_replications,
)
5 changes: 2 additions & 3 deletions ax/benchmark/methods/sobol.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from ax.benchmark.benchmark_method import (
BenchmarkMethod,
get_sequential_optimization_scheduler_options,
get_benchmark_scheduler_options,
)
from ax.modelbridge.generation_strategy import GenerationStep, GenerationStrategy
from ax.modelbridge.registry import Models
Expand All @@ -28,7 +28,6 @@ def get_sobol_benchmark_method(
return BenchmarkMethod(
name=generation_strategy.name,
generation_strategy=generation_strategy,
scheduler_options=scheduler_options
or get_sequential_optimization_scheduler_options(),
scheduler_options=scheduler_options or get_benchmark_scheduler_options(),
distribute_replications=distribute_replications,
)
4 changes: 2 additions & 2 deletions ax/benchmark/tests/test_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
)
from ax.benchmark.benchmark_method import (
BenchmarkMethod,
get_sequential_optimization_scheduler_options,
get_benchmark_scheduler_options,
)
from ax.benchmark.benchmark_problem import SingleObjectiveBenchmarkProblem
from ax.benchmark.benchmark_result import BenchmarkResult
Expand Down Expand Up @@ -302,7 +302,7 @@ def test_replication_mbm(self) -> None:
get_sobol_botorch_modular_acquisition(
model_cls=SingleTaskGP,
acquisition_cls=qLogNoisyExpectedImprovement,
scheduler_options=get_sequential_optimization_scheduler_options(),
scheduler_options=get_benchmark_scheduler_options(),
distribute_replications=False,
),
get_single_objective_benchmark_problem(
Expand Down
6 changes: 3 additions & 3 deletions ax/benchmark/tests/test_benchmark_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from ax.benchmark.benchmark_method import (
BenchmarkMethod,
get_sequential_optimization_scheduler_options,
get_benchmark_scheduler_options,
)
from ax.modelbridge.generation_strategy import (
GenerationNode,
Expand All @@ -26,7 +26,7 @@ def test_benchmark_method(self) -> None:
steps=[GenerationStep(model=Models.SOBOL, num_trials=10)],
name="SOBOL",
)
options = get_sequential_optimization_scheduler_options()
options = get_benchmark_scheduler_options()
method = BenchmarkMethod(
name="Sobol10", generation_strategy=gs, scheduler_options=options
)
Expand All @@ -41,7 +41,7 @@ def test_benchmark_method(self) -> None:
self.assertEqual(options.min_seconds_before_poll, 0)
self.assertEqual(options.timeout_hours, 4)

options = get_sequential_optimization_scheduler_options(timeout_hours=10)
options = get_benchmark_scheduler_options(timeout_hours=10)
method = BenchmarkMethod(
name="Sobol10", generation_strategy=gs, scheduler_options=options
)
Expand Down

0 comments on commit 21a3baf

Please sign in to comment.