2021-01-20 18:40:23 +01:00
|
|
|
"""Moderate Ray Tune run (32 trials, 4 actors).
|
|
|
|
|
|
|
|
This training run will start 32 Ray Tune trials, each starting 4 actors.
|
|
|
|
The cluster comprises 32 nodes.
|
|
|
|
|
|
|
|
Test owner: krfricke
|
|
|
|
|
|
|
|
Acceptance criteria: Should run through and report final results, as well
|
|
|
|
as the Ray Tune results table. No trials should error. All trials should
|
|
|
|
run in parallel.
|
|
|
|
"""
|
|
|
|
import ray
|
|
|
|
from ray import tune
|
|
|
|
|
|
|
|
from xgboost_ray import RayParams
|
|
|
|
|
|
|
|
from _train import train_ray
|
|
|
|
|
|
|
|
|
2021-05-04 23:10:04 +02:00
|
|
|
def train_wrapper(config, ray_params):
|
2021-01-20 18:40:23 +01:00
|
|
|
train_ray(
|
|
|
|
path="/data/classification.parquet",
|
|
|
|
num_workers=4,
|
|
|
|
num_boost_rounds=100,
|
|
|
|
num_files=64,
|
|
|
|
regression=False,
|
|
|
|
use_gpu=False,
|
|
|
|
ray_params=ray_params,
|
|
|
|
xgboost_params=config,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
search_space = {
|
|
|
|
"eta": tune.loguniform(1e-4, 1e-1),
|
|
|
|
"subsample": tune.uniform(0.5, 1.0),
|
|
|
|
"max_depth": tune.randint(1, 9)
|
|
|
|
}
|
|
|
|
|
|
|
|
ray.init(address="auto")
|
|
|
|
|
2021-05-04 23:10:04 +02:00
|
|
|
ray_params = RayParams(
|
|
|
|
elastic_training=False,
|
|
|
|
max_actor_restarts=2,
|
|
|
|
num_actors=4,
|
|
|
|
cpus_per_actor=1,
|
|
|
|
gpus_per_actor=0)
|
|
|
|
|
2021-01-20 18:40:23 +01:00
|
|
|
analysis = tune.run(
|
2021-05-04 23:10:04 +02:00
|
|
|
tune.with_parameters(train_wrapper, ray_params=ray_params),
|
2021-01-20 18:40:23 +01:00
|
|
|
config=search_space,
|
|
|
|
num_samples=32,
|
2021-05-04 23:10:04 +02:00
|
|
|
resources_per_trial=ray_params.get_tune_resources())
|
2021-02-17 23:00:49 +01:00
|
|
|
|
|
|
|
print("PASSED.")
|