Skip to content

Commit

Permalink
Downgrade error to beta-warning for gs selection in AxClient (#2551)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #2551

Previously we added this error in D56048665 in response to a github issue, however now that we are adding support for GenerationStrategy selection for BatchTrials this can be a warning that this method is in development.

In the future we should be able to fully remove the method

Reviewed By: Balandat

Differential Revision: D59143308

fbshipit-source-id: c3c8bde2eb02c8fc301694573e85f976eaf7fd36
  • Loading branch information
mgarrard authored and facebook-github-bot committed Jul 1, 2024
1 parent 83f23a4 commit d6ed7a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
6 changes: 3 additions & 3 deletions ax/service/ax_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1732,9 +1732,9 @@ def _set_generation_strategy(
"use_batch_trials" in choose_generation_strategy_kwargs
and type(self) is AxClient
):
raise UnsupportedError(
"AxClient API does not support batch trials yet."
" We plan to add this support in coming versions."
logger.warning(
"Selecting a GenerationStrategy when using BatchTrials is in beta. "
"Double check the recommended strategy matches your expectations."
)
random_seed = choose_generation_strategy_kwargs.pop(
"random_seed", self._random_seed
Expand Down
13 changes: 7 additions & 6 deletions ax/telemetry/tests/test_ax_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

# pyre-strict

import logging
from typing import Dict, List, Sequence, Union

import numpy as np

from ax.core.types import TParamValue
from ax.exceptions.core import UnsupportedError
from ax.service.ax_client import AxClient, ObjectiveProperties
from ax.telemetry.ax_client import AxClientCompletedRecord, AxClientCreatedRecord
from ax.telemetry.experiment import ExperimentCompletedRecord, ExperimentCreatedRecord
Expand Down Expand Up @@ -133,11 +133,8 @@ def test_ax_client_completed_record_from_ax_client(self) -> None:

def test_batch_trial_warning(self) -> None:
ax_client = AxClient()
error_msg = (
"AxClient API does not support batch trials yet."
" We plan to add this support in coming versions."
)
with self.assertRaisesRegex(UnsupportedError, error_msg):
warning_msg = "GenerationStrategy when using BatchTrials is in beta."
with self.assertLogs(AxClient.__module__, logging.WARNING) as logger:
ax_client.create_experiment(
name="test_experiment",
parameters=[
Expand All @@ -149,6 +146,10 @@ def test_batch_trial_warning(self) -> None:
"use_batch_trials": True,
},
)
self.assertTrue(
any(warning_msg in output for output in logger.output),
logger.output,
)

def _compare_axclient_completed_records(
self, record: AxClientCompletedRecord, expected: AxClientCompletedRecord
Expand Down

0 comments on commit d6ed7a6

Please sign in to comment.