diff --git a/.github/workflows/platform_tests-command.yml b/.github/workflows/platform_tests-command.yml index 43e8774ae24..41ba9d3ad41 100644 --- a/.github/workflows/platform_tests-command.yml +++ b/.github/workflows/platform_tests-command.yml @@ -48,8 +48,8 @@ jobs: fail-fast: false matrix: os: [macos-latest, windows-latest, ubuntu-latest] - python: ["3.8", "3.9", "3.10"] - steps: + python: ["3.8", "3.9", "3.10", "3.11"] + steps: - name: Checkout repository for PR if: (github.event_name == 'workflow_dispatch') uses: actions/checkout@v2 @@ -80,7 +80,7 @@ jobs: fail-fast: false matrix: os: [macos-latest, windows-latest, ubuntu-latest] - python: ["3.8", "3.9", "3.10"] + python: ["3.8", "3.9", "3.10", "3.11"] steps: - name: Checkout repository for PR if: (github.event_name == 'workflow_dispatch') @@ -112,7 +112,7 @@ jobs: fail-fast: false matrix: os: [macos-latest, windows-latest, ubuntu-latest] - python: ["3.8", "3.9", "3.10"] + python: ["3.8", "3.9", "3.10", "3.11"] steps: - name: Checkout repository for PR if: (github.event_name == 'workflow_dispatch') @@ -144,7 +144,7 @@ jobs: # fail-fast: false # matrix: # os: [macos-latest, windows-latest, ubuntu-latest] - # python: ["3.8", "3.9", "3.10"] + # python: ["3.8", "3.9", "3.10", "3.11"] # steps: # - name: Checkout repository for PR # if: (github.event_name == 'workflow_dispatch') @@ -177,7 +177,7 @@ jobs: fail-fast: false matrix: os: [macos-latest, windows-latest, ubuntu-latest] - python: ["3.8", "3.9", "3.10"] + python: ["3.8", "3.9", "3.10", "3.11"] steps: - name: Checkout repository for PR if: (github.event_name == 'workflow_dispatch') @@ -260,7 +260,7 @@ jobs: fail-fast: false matrix: os: [macos-latest, windows-latest, ubuntu-latest] - python: ["3.8", "3.9", "3.10"] + python: ["3.8", "3.9", "3.10", "3.11"] steps: - name: Checkout repository for PR if: (github.event_name == 'workflow_dispatch') diff --git a/common/src/autogluon/common/utils/try_import.py b/common/src/autogluon/common/utils/try_import.py index be27db503fd..5893e1a0bc6 100644 --- a/common/src/autogluon/common/utils/try_import.py +++ b/common/src/autogluon/common/utils/try_import.py @@ -1,5 +1,6 @@ import logging import platform +import sys from types import ModuleType from ..version import __version__ @@ -30,7 +31,7 @@ def try_import_mxboard(): def try_import_ray() -> ModuleType: - RAY_MAX_VERSION = "2.7.0" + RAY_MAX_VERSION = "2.7.0" # sync with core/setup.py ray_max_version_os_map = dict( Darwin=RAY_MAX_VERSION, Windows=RAY_MAX_VERSION, @@ -62,7 +63,12 @@ def try_import_catboost(): try: import catboost except ImportError as e: - raise ImportError("`import catboost` failed. " f"A quick tip is to install via `pip install autogluon.tabular[catboost]=={__version__}`.") + error_msg = "`import catboost` failed. " + if sys.version_info >= (3, 11) and sys.platform == "darwin": + error_msg += f"Detected your env as {sys.platform}. Please either downgrade your python version to below 3.11 or move to another platform. Then install via ``pip install autogluon.tabular[catboost]=={__version__}``" + else: + error_msg += f"A quick tip is to install via `pip install autogluon.tabular[catboost]=={__version__}`." + raise ImportError() except ValueError as e: raise ImportError( "Import catboost failed. Numpy version may be outdated, " @@ -122,7 +128,9 @@ def try_import_torch(): import torch except ImportError as e: raise ImportError( - "Unable to import dependency torch\n" "A quick tip is to install via `pip install torch`.\n" "The minimum torch version is currently 1.6." + "Unable to import dependency torch\n" + "A quick tip is to install via `pip install torch`.\n" + "The minimum torch version is currently 2.0." # sync with core/_setup_utils.py ) diff --git a/core/setup.py b/core/setup.py index 994cf8149eb..389eda08e9c 100644 --- a/core/setup.py +++ b/core/setup.py @@ -48,10 +48,9 @@ extras_require = { "ray": [ "ray[default]>=2.6.3,<2.7", - "pydantic>=1.10.4,<2.0", # https://github.com/ray-project/ray/issues/36990 ], "raytune": [ - "ray[tune]>=2.6.3,<2.7", + "ray[default,tune]>=2.6.3,<2.7", # TODO: consider alternatives as hyperopt is not actively maintained. "hyperopt>=0.2.7,<0.2.8", # This is needed for the bayes search to work. # 'GPy>=1.10.0,<1.11.0' # TODO: Enable this once PBT/PB2 are supported by ray lightning diff --git a/core/src/autogluon/core/_setup_utils.py b/core/src/autogluon/core/_setup_utils.py index 7cee566f5ad..4f010a51a25 100644 --- a/core/src/autogluon/core/_setup_utils.py +++ b/core/src/autogluon/core/_setup_utils.py @@ -11,7 +11,7 @@ AUTOGLUON_ROOT_PATH = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "..", "..")) -PYTHON_REQUIRES = ">=3.8, <3.11" +PYTHON_REQUIRES = ">=3.8, <3.12" # Only put packages here that would otherwise appear multiple times across different module's setup.py files. @@ -26,7 +26,7 @@ "networkx": ">=3.0,<4", # Major version cap "tqdm": ">=4.38,<5", # Major version cap "Pillow": ">=9.3,<9.6", # "<{N+2}" upper cap - "torch": ">=2.0,<2.1", # "<{N+1}" upper cap + "torch": ">=2.0,<2.1", # "<{N+1}" upper cap, sync with common/src/autogluon/common/utils/try_import.py "lightning": ">=2.0.0,<2.1", # "<{N+1}" upper cap } if LITE_MODE: @@ -137,6 +137,7 @@ def default_setup_args(*, version, submodule): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Topic :: Software Development", "Topic :: Scientific/Engineering :: Artificial Intelligence", "Topic :: Scientific/Engineering :: Information Analysis", diff --git a/docs/install-cpu-pip.md b/docs/install-cpu-pip.md index f04890f2541..04d2600c3e7 100644 --- a/docs/install-cpu-pip.md +++ b/docs/install-cpu-pip.md @@ -4,7 +4,7 @@ pip install -U setuptools wheel # CPU version of pytorch has smaller footprint - see installation instructions in # pytorch documentation - https://pytorch.org/get-started/locally/ -pip install torch==1.13.1+cpu torchvision==0.14.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html +pip install torchvision~=0.15.1 --force-reinstall --extra-index-url https://download.pytorch.org/whl/cpu pip install autogluon ``` diff --git a/docs/install-cpu-source.md b/docs/install-cpu-source.md index fbb7d4dcd42..68859b8682b 100644 --- a/docs/install-cpu-source.md +++ b/docs/install-cpu-source.md @@ -4,7 +4,7 @@ pip install -U setuptools wheel # CPU version of pytorch has smaller footprint - see installation instructions in # pytorch documentation - https://pytorch.org/get-started/locally/ -pip install torch==1.13.1+cpu torchvision==0.14.1+cpu --extra-index-url https://download.pytorch.org/whl/cpu +pip install torchvision~=0.15.1 --force-reinstall --extra-index-url https://download.pytorch.org/whl/cpu git clone https://github.com/autogluon/autogluon cd autogluon && ./full_install.sh diff --git a/docs/install-gpu-pip.md b/docs/install-gpu-pip.md index 84dbcca7381..5b5e141b2f0 100644 --- a/docs/install-gpu-pip.md +++ b/docs/install-gpu-pip.md @@ -3,7 +3,7 @@ pip install -U pip pip install -U setuptools wheel # Install the proper version of PyTorch following https://pytorch.org/get-started/locally/ -pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117 +pip install torchvision~=0.15.1 --force-reinstall --extra-index-url https://download.pytorch.org/whl/cu118 pip install autogluon ``` diff --git a/docs/install-gpu-source.md b/docs/install-gpu-source.md index 2a6c46808e7..7db68dc6dad 100644 --- a/docs/install-gpu-source.md +++ b/docs/install-gpu-source.md @@ -3,7 +3,7 @@ pip install -U pip pip install -U setuptools wheel # Install the proper version of PyTorch following https://pytorch.org/get-started/locally/ -pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117 +pip install torchvision~=0.15.1 --force-reinstall --extra-index-url https://download.pytorch.org/whl/cu118 git clone https://github.com/autogluon/autogluon cd autogluon && ./full_install.sh diff --git a/docs/install-windows-gpu.md b/docs/install-windows-gpu.md index e72586fdfbb..2de07bb2333 100644 --- a/docs/install-windows-gpu.md +++ b/docs/install-windows-gpu.md @@ -11,7 +11,7 @@ conda activate myenv 4. Install the proper GPU PyTorch version by following the [PyTorch Install Documentation](https://pytorch.org/get-started/locally/) (Recommended). Alternatively, use the following command: ```bash -pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117 +pip install torchvision~=0.15.1 --force-reinstall --extra-index-url https://download.pytorch.org/whl/cu118 ``` 5. Sanity check that your installation is valid and can detect your GPU via testing in Python: diff --git a/examples/automm/object_detection/detection_eval.py b/examples/automm/object_detection/detection_eval.py index f7b355be618..2b13a0a885d 100644 --- a/examples/automm/object_detection/detection_eval.py +++ b/examples/automm/object_detection/detection_eval.py @@ -10,9 +10,6 @@ python detection_eval.py \ --test_path ./VOCdevkit/VOC2007/Annotations/test_cocoformat.json \ --checkpoint_name faster_rcnn_r50_fpn_1x_voc0712 - -Note that for now it's required to install nightly build torchmetrics. -This will be solved in next pr. (MeanAveragePrecision will be moved to AG temporarily.) """ import argparse diff --git a/examples/automm/object_detection/detection_train.py b/examples/automm/object_detection/detection_train.py index ba70a75906b..16c5f505338 100644 --- a/examples/automm/object_detection/detection_train.py +++ b/examples/automm/object_detection/detection_train.py @@ -23,9 +23,6 @@ --lr \ --wd \ --epochs - -Note that for now it's required to install nightly build torchmetrics. -This will be solved in next pr. (MeanAveragePrecision will be moved to AG temporarily.) """ import argparse diff --git a/multimodal/setup.py b/multimodal/setup.py index 6c3c1a1d027..72da7b8eadd 100644 --- a/multimodal/setup.py +++ b/multimodal/setup.py @@ -37,9 +37,9 @@ "transformers[sentencepiece]>=4.31.0,<4.32.0", "timm>=0.9.5,<0.10.0", "torchvision>=0.14.0,<0.16.0", # torch 1.13 requires torchvision 0.14. Increase it to 0.15 when dropping the support of torch 1.13. - "scikit-image>=0.19.1,<0.20.0", + "scikit-image>=0.19.1,<0.21.0", "text-unidecode>=1.3,<1.4", - "torchmetrics>=1.0.0,<1.1.0", + "torchmetrics>=1.0.0,<1.2.0", "nptyping>=1.4.4,<2.5.0", "omegaconf>=2.1.1,<2.3.0", f"autogluon.core[raytune]=={version}", @@ -64,7 +64,7 @@ "onnx>=1.13.0,<1.14.0", "onnxruntime>=1.15.0,<1.16.0;platform_system=='Darwin'", "onnxruntime-gpu>=1.15.0,<1.16.0;platform_system!='Darwin'", - "tensorrt>=8.5.3.1,<8.5.4;platform_system=='Linux'", + "tensorrt>=8.5.3.1,<8.5.4;platform_system=='Linux' and python_version<'3.11'", # tensorrt > 8.5.4 cause segfault ] extras_require = { diff --git a/multimodal/tests/unittests/others/test_deployment_onnx.py b/multimodal/tests/unittests/others/test_deployment_onnx.py index 23c7924c8f8..33f231616f2 100644 --- a/multimodal/tests/unittests/others/test_deployment_onnx.py +++ b/multimodal/tests/unittests/others/test_deployment_onnx.py @@ -6,6 +6,7 @@ import pytest import torch from datasets import load_dataset +from packaging import version from scipy.stats import pearsonr, spearmanr from sklearn.metrics.pairwise import paired_cosine_distances from torch import FloatTensor @@ -23,6 +24,11 @@ "ae": AEDataset(), } +try: + import tensorrt +except ImportError: + tensorrt = None + def evaluate(predictor, df, onnx_session=None): labels = df["score"].to_numpy() @@ -192,6 +198,10 @@ def test_onnx_export_timm_image(checkpoint_name, num_gpus): ), ], ) +@pytest.mark.skipif( + tensorrt is None or version.parse(tensorrt.__version__) >= version.parse("8.5.4"), + reason="tensorrt above 8.5.4 cause segfault, but is required to support py311", +) def test_onnx_optimize_for_inference(dataset_name, model_names, text_backbone, image_backbone): dataset = ALL_DATASETS[dataset_name] hyperparameters = { diff --git a/tabular/setup.py b/tabular/setup.py index a2b2d33b579..ef4fcbb1fa2 100644 --- a/tabular/setup.py +++ b/tabular/setup.py @@ -38,8 +38,9 @@ "catboost": [ # CatBoost wheel build is not working correctly on darwin for CatBoost 1.2, so use old version in this case. # https://github.com/autogluon/autogluon/pull/3190#issuecomment-1540599280 - 'catboost>=1.1,<1.2 ; sys_platform == "darwin"', - "catboost>=1.1,<1.3", + # Catboost 1.2 doesn't have wheel for python 3.11 + "catboost>=1.1,<1.2 ; sys_platform == 'darwin' and python_version < '3.11'", + "catboost>=1.1,<1.3; sys_platform != 'darwin'", ], # FIXME: Debug why xgboost 1.6 has 4x+ slower inference on multiclass datasets compared to 1.4 # It is possibly only present on MacOS, haven't tested linux. @@ -66,7 +67,8 @@ ], "vowpalwabbit": [ # FIXME: 9.5+ causes VW to save an empty model which always predicts 0. Confirmed on MacOS (Intel CPU). Unknown how to fix. - "vowpalwabbit>=9,<9.9", + # No vowpalwabbit wheel for python 3.11 or above yet + "vowpalwabbit>=9,<9.9; python_version < '3.11'", ], "skl2onnx": [ "skl2onnx>=1.15.0,<1.16.0", diff --git a/tabular/tests/unittests/models/test_catboost.py b/tabular/tests/unittests/models/test_catboost.py index 9e5c4ceaa45..23e35f448a9 100644 --- a/tabular/tests/unittests/models/test_catboost.py +++ b/tabular/tests/unittests/models/test_catboost.py @@ -1,6 +1,11 @@ +import sys + +import pytest + from autogluon.tabular.models.catboost.catboost_model import CatBoostModel +@pytest.mark.skipif(sys.version_info >= (3, 11) and sys.platform == "darwin", reason="catboost has no wheel for py311 darwin") def test_catboost_binary(fit_helper): fit_args = dict( hyperparameters={CatBoostModel: {}}, @@ -9,6 +14,7 @@ def test_catboost_binary(fit_helper): fit_helper.fit_and_validate_dataset(dataset_name=dataset_name, fit_args=fit_args) +@pytest.mark.skipif(sys.version_info >= (3, 11) and sys.platform == "darwin", reason="catboost has no wheel for py311 darwin") def test_catboost_multiclass(fit_helper): fit_args = dict( hyperparameters={CatBoostModel: {}}, @@ -17,6 +23,7 @@ def test_catboost_multiclass(fit_helper): fit_helper.fit_and_validate_dataset(dataset_name=dataset_name, fit_args=fit_args) +@pytest.mark.skipif(sys.version_info >= (3, 11) and sys.platform == "darwin", reason="catboost has no wheel for py311 darwin") def test_catboost_regression(fit_helper): fit_args = dict( hyperparameters={CatBoostModel: {}}, @@ -26,6 +33,7 @@ def test_catboost_regression(fit_helper): fit_helper.fit_and_validate_dataset(dataset_name=dataset_name, fit_args=fit_args) +@pytest.mark.skipif(sys.version_info >= (3, 11) and sys.platform == "darwin", reason="catboost has no wheel for py311 darwin") def test_catboost_quantile(fit_helper): fit_args = dict( hyperparameters={"CAT": {}}, diff --git a/tabular/tests/unittests/models/test_vowpalwabbit.py b/tabular/tests/unittests/models/test_vowpalwabbit.py index c41c39d3ee1..072135a89ec 100644 --- a/tabular/tests/unittests/models/test_vowpalwabbit.py +++ b/tabular/tests/unittests/models/test_vowpalwabbit.py @@ -1,6 +1,11 @@ +import sys + +import pytest + from autogluon.tabular.models.vowpalwabbit.vowpalwabbit_model import VowpalWabbitModel +@pytest.mark.skipif(sys.version_info >= (3, 11), reason="vowpalwabbit doesn't support python 3.11 and above yet") def test_vowpalwabbit_binary(fit_helper): fit_args = dict( hyperparameters={VowpalWabbitModel: {}}, @@ -9,6 +14,7 @@ def test_vowpalwabbit_binary(fit_helper): fit_helper.fit_and_validate_dataset(dataset_name=dataset_name, fit_args=fit_args) +@pytest.mark.skipif(sys.version_info >= (3, 11), reason="vowpalwabbit doesn't support python 3.11 and above yet") def test_vowpalwabbit_multiclass(fit_helper): fit_args = dict( hyperparameters={VowpalWabbitModel: {}}, @@ -17,6 +23,7 @@ def test_vowpalwabbit_multiclass(fit_helper): fit_helper.fit_and_validate_dataset(dataset_name=dataset_name, fit_args=fit_args) +@pytest.mark.skipif(sys.version_info >= (3, 11), reason="vowpalwabbit doesn't support python 3.11 and above yet") def test_vowpalwabbit_regression(fit_helper): fit_args = dict( hyperparameters={VowpalWabbitModel: {}}, diff --git a/tabular/tests/unittests/test_tabular.py b/tabular/tests/unittests/test_tabular.py index 48c5ba4e556..387b1325070 100644 --- a/tabular/tests/unittests/test_tabular.py +++ b/tabular/tests/unittests/test_tabular.py @@ -21,6 +21,7 @@ """ import os import shutil +import sys import tempfile import warnings from random import seed @@ -34,6 +35,7 @@ from autogluon.core.constants import BINARY, MULTICLASS, PROBLEM_TYPES_CLASSIFICATION, QUANTILE, REGRESSION from autogluon.core.utils import download, unzip from autogluon.tabular import TabularDataset, TabularPredictor +from autogluon.tabular.configs.hyperparameter_configs import get_hyperparameter_config PARALLEL_LOCAL_BAGGING = "parallel_local" SEQUENTIAL_LOCAL_BAGGING = "sequential_local" @@ -47,7 +49,7 @@ def test_tabular(): subsample_size = None hyperparameter_tune_kwargs = None verbosity = 2 # how much output to print - hyperparameters = None + hyperparameters = get_hyperparameter_config("default") time_limit = None fast_benchmark = True # False # If True, run a faster benchmark (subsample training sets, less epochs, etc), @@ -59,6 +61,10 @@ def test_tabular(): subsample_size = 100 time_limit = 60 + # Catboost > 1.2 is required for python 3.11 but cannot be correctly installed on macos + if sys.version_info >= (3, 11) and sys.platform == "darwin": + hyperparameters.pop("CAT") + fit_args = {"verbosity": verbosity} if hyperparameter_tune_kwargs is not None: fit_args["hyperparameter_tune_kwargs"] = hyperparameter_tune_kwargs