diff --git a/scico/test/test_ray_tune.py b/scico/test/test_ray_tune.py index 682592934..dde5b1d37 100644 --- a/scico/test/test_ray_tune.py +++ b/scico/test/test_ray_tune.py @@ -7,19 +7,18 @@ try: import ray - from scico.ray import report, tune + from scico.ray import train, tune ray.init(num_cpus=1) except ImportError as e: pytest.skip("ray.tune not installed", allow_module_level=True) -@pytest.mark.filterwarnings("ignore::DeprecationWarning") def test_random_run(): - def eval_params(config, reporter): + def eval_params(config): x, y = config["x"], config["y"] cost = x**2 + (y - 0.5) ** 2 - reporter(cost=cost) + train.report({"cost": cost}) config = {"x": tune.uniform(-1, 1), "y": tune.uniform(-1, 1)} resources = {"gpu": 0, "cpu": 1} @@ -40,12 +39,11 @@ def eval_params(config, reporter): assert np.abs(best_config["y"] - 0.5) < 0.25 -@pytest.mark.filterwarnings("ignore::DeprecationWarning") def test_random_tune(): def eval_params(config): x, y = config["x"], config["y"] cost = x**2 + (y - 0.5) ** 2 - report({"cost": cost}) + train.report({"cost": cost}) config = {"x": tune.uniform(-1, 1), "y": tune.uniform(-1, 1)} resources = {"gpu": 0, "cpu": 1} @@ -66,12 +64,11 @@ def eval_params(config): assert np.abs(best_config["y"] - 0.5) < 0.25 -@pytest.mark.filterwarnings("ignore::DeprecationWarning") def test_hyperopt_run(): - def eval_params(config, reporter): + def eval_params(config): x, y = config["x"], config["y"] cost = x**2 + (y - 0.5) ** 2 - reporter(cost=cost) + train.report({"cost": cost}) config = {"x": tune.uniform(-1, 1), "y": tune.uniform(-1, 1)} resources = {"gpu": 0, "cpu": 1} @@ -90,12 +87,11 @@ def eval_params(config, reporter): assert np.abs(best_config["y"] - 0.5) < 0.25 -@pytest.mark.filterwarnings("ignore::DeprecationWarning") def test_hyperopt_tune(): def eval_params(config): x, y = config["x"], config["y"] cost = x**2 + (y - 0.5) ** 2 - report({"cost": cost}) + train.report({"cost": cost}) config = {"x": tune.uniform(-1, 1), "y": tune.uniform(-1, 1)} resources = {"gpu": 0, "cpu": 1} @@ -115,12 +111,11 @@ def eval_params(config): assert np.abs(best_config["y"] - 0.5) < 0.25 -@pytest.mark.filterwarnings("ignore::DeprecationWarning") def test_hyperopt_tune_alt_init(): def eval_params(config): x, y = config["x"], config["y"] cost = x**2 + (y - 0.5) ** 2 - report({"cost": cost}) + train.report({"cost": cost}) config = {"x": tune.uniform(-1, 1), "y": tune.uniform(-1, 1)} tuner = tune.Tuner(