mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00

Removes all ML related code from `ray.util` Removes: - `ray.util.xgboost` - `ray.util.lightgbm` - `ray.util.horovod` - `ray.util.ray_lightning` Moves `ray.util.ml_utils` to other locations Closes #23900 Signed-off-by: Amog Kamsetty <amogkamsetty@yahoo.com> Signed-off-by: Kai Fricke <kai@anyscale.com> Co-authored-by: Kai Fricke <kai@anyscale.com>
64 lines
1.6 KiB
Python
64 lines
1.6 KiB
Python
"""Small cluster training
|
|
|
|
This training run will start 4 workers on 4 nodes (including head node).
|
|
|
|
Test owner: Yard1 (primary), krfricke
|
|
|
|
Acceptance criteria: Should run through and report final results.
|
|
"""
|
|
import json
|
|
import os
|
|
import time
|
|
|
|
import ray
|
|
from lightgbm_ray import RayParams
|
|
|
|
from release_test_util import train_ray
|
|
|
|
if __name__ == "__main__":
|
|
addr = os.environ.get("RAY_ADDRESS")
|
|
job_name = os.environ.get("RAY_JOB_NAME", "train_small")
|
|
|
|
runtime_env = {"working_dir": os.path.dirname(__file__)}
|
|
|
|
if addr.startswith("anyscale://"):
|
|
ray.init(address=addr, job_name=job_name, runtime_env=runtime_env)
|
|
else:
|
|
ray.init(address="auto", runtime_env=runtime_env)
|
|
|
|
output = os.environ["TEST_OUTPUT_JSON"]
|
|
ray_params = RayParams(
|
|
elastic_training=False,
|
|
max_actor_restarts=2,
|
|
num_actors=4,
|
|
cpus_per_actor=4,
|
|
gpus_per_actor=0,
|
|
)
|
|
|
|
start = time.time()
|
|
|
|
@ray.remote(num_cpus=0)
|
|
def train():
|
|
os.environ["TEST_OUTPUT_JSON"] = output
|
|
train_ray(
|
|
path="/data/classification.parquet",
|
|
num_workers=None,
|
|
num_boost_rounds=100,
|
|
num_files=25,
|
|
regression=False,
|
|
use_gpu=False,
|
|
ray_params=ray_params,
|
|
lightgbm_params=None,
|
|
)
|
|
|
|
ray.get(train.remote())
|
|
taken = time.time() - start
|
|
|
|
result = {
|
|
"time_taken": taken,
|
|
}
|
|
test_output_json = os.environ.get("TEST_OUTPUT_JSON", "/tmp/train_small.json")
|
|
with open(test_output_json, "wt") as f:
|
|
json.dump(result, f)
|
|
|
|
print("PASSED.")
|