From 7d2e94bbe2764e8cfdb64c96f5b897ff6b9bd1ac Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sat, 23 Mar 2024 18:27:14 +0100 Subject: [PATCH] Limit `ray<2.9.3` due to bug in `ray==2.10.0` (#9254) Signed-off-by: Glenn Jocher --- .github/workflows/ci.yaml | 3 ++- docs/en/integrations/ray-tune.md | 2 +- ultralytics/utils/tuner.py | 7 ++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4eadc3ba..bec6c611 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -187,7 +187,8 @@ jobs: run: | slow="" if [[ "${{ github.event_name }}" == "schedule" ]] || [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then - pip install mlflow pycocotools 'ray[tune]' + # WARNING bug in ray>=2.10.0 + pip install mlflow pycocotools "ray[tune]<=2.9.3" slow="--slow" fi pytest $slow --cov=ultralytics/ --cov-report xml tests/ diff --git a/docs/en/integrations/ray-tune.md b/docs/en/integrations/ray-tune.md index 3825cf7f..cc39682b 100644 --- a/docs/en/integrations/ray-tune.md +++ b/docs/en/integrations/ray-tune.md @@ -34,7 +34,7 @@ To install the required packages, run: ```bash # Install and update Ultralytics and Ray Tune packages - pip install -U ultralytics "ray[tune]" + pip install -U ultralytics "ray[tune]<=2.9.3" # Optionally install W&B for logging pip install wandb diff --git a/ultralytics/utils/tuner.py b/ultralytics/utils/tuner.py index 20e3b756..efcf6766 100644 --- a/ultralytics/utils/tuner.py +++ b/ultralytics/utils/tuner.py @@ -3,7 +3,7 @@ import subprocess from ultralytics.cfg import TASK2DATA, TASK2METRIC, get_save_dir -from ultralytics.utils import DEFAULT_CFG, DEFAULT_CFG_DICT, LOGGER, NUM_THREADS +from ultralytics.utils import DEFAULT_CFG, DEFAULT_CFG_DICT, LOGGER, NUM_THREADS, checks def run_ray_tune( @@ -40,7 +40,7 @@ def run_ray_tune( train_args = {} try: - subprocess.run("pip install ray[tune]".split(), check=True) + subprocess.run("pip install ray[tune]<=2.9.3".split(), check=True) # do not add single quotes here import ray from ray import tune @@ -48,7 +48,7 @@ def run_ray_tune( from ray.air.integrations.wandb import WandbLoggerCallback from ray.tune.schedulers import ASHAScheduler except ImportError: - raise ModuleNotFoundError('Tuning hyperparameters requires Ray Tune. Install with: pip install "ray[tune]"') + raise ModuleNotFoundError('Ray Tune required but not found. To install run: pip install "ray[tune]<=2.9.3"') try: import wandb @@ -57,6 +57,7 @@ def run_ray_tune( except (ImportError, AssertionError): wandb = False + checks.check_version(ray.__version__, "<=2.9.3", "ray") default_space = { # 'optimizer': tune.choice(['SGD', 'Adam', 'AdamW', 'NAdam', 'RAdam', 'RMSProp']), "lr0": tune.uniform(1e-5, 1e-1),