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

improve flakey test reliability #2246

Closed
wants to merge 1 commit into from
Closed
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
10 changes: 9 additions & 1 deletion ax/core/tests/test_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
from typing import Dict, List, Type
from unittest.mock import MagicMock, patch

import numpy as np

import pandas as pd
import torch
from ax.core import BatchTrial, Trial
from ax.core.arm import Arm
from ax.core.base_trial import TrialStatus
Expand Down Expand Up @@ -1388,10 +1391,15 @@ def test_WarmStartMapData(self) -> None:
@fast_botorch_optimize
def test_batch_with_multiple_generator_runs(self) -> None:
exp = get_branin_experiment()
sobol = Models.SOBOL(experiment=exp, search_space=exp.search_space)
# set seed to avoid transient errors caused by duplicate arms,
# which leads to fewer arms in the trial than expected.
seed = 0
sobol = Models.SOBOL(experiment=exp, search_space=exp.search_space, seed=seed)
exp.new_batch_trial(generator_runs=[sobol.gen(n=7)]).run().complete()

data = exp.fetch_data()
torch.manual_seed(seed)
np.random.seed(seed)
gp = Models.BOTORCH_MODULAR(
experiment=exp, search_space=exp.search_space, data=data
)
Expand Down
Loading