Skip to content

Commit

Permalink
Lint tabular (#3347)
Browse files Browse the repository at this point in the history
  • Loading branch information
Weisu Yin committed Jun 22, 2023
1 parent 06fedd0 commit 3f48d66
Show file tree
Hide file tree
Showing 116 changed files with 6,562 additions and 6,341 deletions.
1 change: 1 addition & 0 deletions .github/workflow_scripts/lint_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function lint_check_all {
lint_check common 160
lint_check core 160
lint_check features 160
lint_check tabular 160
}

bandit -r multimodal/src -ll
Expand Down
81 changes: 41 additions & 40 deletions tabular/setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env python
###########################
# This code block is a HACK (!), but is necessary to avoid code duplication. Do NOT alter these lines.
import importlib.util
import os

from setuptools import setup
import importlib.util

filepath = os.path.abspath(os.path.dirname(__file__))
filepath_import = os.path.join(filepath, '..', 'core', 'src', 'autogluon', 'core', '_setup_utils.py')
filepath_import = os.path.join(filepath, "..", "core", "src", "autogluon", "core", "_setup_utils.py")
spec = importlib.util.spec_from_file_location("ag_min_dependencies", filepath_import)
ag = importlib.util.module_from_spec(spec)
# Identical to `from autogluon.core import _setup_utils as ag`, but works without `autogluon.core` being installed.
Expand All @@ -17,82 +19,81 @@
version = ag.load_version_file()
version = ag.update_version(version)

submodule = 'tabular'
submodule = "tabular"
install_requires = [
# version ranges added in ag.get_dependency_version_ranges()
'numpy', # version range defined in `core/_setup_utils.py`
'scipy', # version range defined in `core/_setup_utils.py`
'pandas', # version range defined in `core/_setup_utils.py`
'scikit-learn', # version range defined in `core/_setup_utils.py`
'networkx', # version range defined in `core/_setup_utils.py`
f'{ag.PACKAGE_NAME}.core=={version}',
f'{ag.PACKAGE_NAME}.features=={version}',
"numpy", # version range defined in `core/_setup_utils.py`
"scipy", # version range defined in `core/_setup_utils.py`
"pandas", # version range defined in `core/_setup_utils.py`
"scikit-learn", # version range defined in `core/_setup_utils.py`
"networkx", # version range defined in `core/_setup_utils.py`
f"{ag.PACKAGE_NAME}.core=={version}",
f"{ag.PACKAGE_NAME}.features=={version}",
]

extras_require = {
'lightgbm': [
'lightgbm>=3.3,<3.4',
"lightgbm": [
"lightgbm>=3.3,<3.4",
],
'catboost': [
"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.1,<1.3",
],
# 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.
# XGBoost made API breaking changes in 1.6 with custom metric and callback support, so we don't support older versions.
'xgboost': [
'xgboost>=1.6,<1.8',
"xgboost": [
"xgboost>=1.6,<1.8",
],
'fastai': [
'torch>=1.9,<1.14',
'fastai>=2.3.1,<2.8',
"fastai": [
"torch>=1.9,<1.14",
"fastai>=2.3.1,<2.8",
],
'tabpfn': [
'tabpfn>=0.1,<0.2',
"tabpfn": [
"tabpfn>=0.1,<0.2",
],
'ray': [
f'{ag.PACKAGE_NAME}.core[all]=={version}',
"ray": [
f"{ag.PACKAGE_NAME}.core[all]=={version}",
],
'skex': [
"skex": [
# Note: 2021.7 released on Sep 2022, version 2022.x doesn't exist (went directly from 2021.7 to 2023.0)
'scikit-learn-intelex>=2021.7,<2023.2',
"scikit-learn-intelex>=2021.7,<2023.2",
],
'imodels': [
'imodels>=1.3.10,<1.4.0', # 1.3.8/1.3.9 either remove/renamed attribute `complexity_` causing failures. https://github.com/csinva/imodels/issues/147
"imodels": [
"imodels>=1.3.10,<1.4.0", # 1.3.8/1.3.9 either remove/renamed attribute `complexity_` causing failures. https://github.com/csinva/imodels/issues/147
],
'vowpalwabbit': [
"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.5',
"vowpalwabbit>=9,<9.5",
],
'skl2onnx': [
'skl2onnx>=1.13.0,<1.14.0',
"skl2onnx": [
"skl2onnx>=1.13.0,<1.14.0",
# For macOS, there isn't a onnxruntime-gpu package installed with skl2onnx.
# Therefore, we install onnxruntime explicitly here just for macOS.
'onnxruntime>=1.13.0,<1.14.0'
] if sys.platform == 'darwin' else [
'skl2onnx>=1.13.0,<1.14.0',
'onnxruntime-gpu>=1.13.0,<1.14.0'
"onnxruntime>=1.13.0,<1.14.0",
]
if sys.platform == "darwin"
else ["skl2onnx>=1.13.0,<1.14.0", "onnxruntime-gpu>=1.13.0,<1.14.0"],
}

# TODO: v1.0: Rename `all` to `core`, make `all` contain everything.
all_requires = []
# TODO: Consider adding 'skex' to 'all'
for extra_package in ['lightgbm', 'catboost', 'xgboost', 'fastai', 'ray']:
for extra_package in ["lightgbm", "catboost", "xgboost", "fastai", "ray"]:
all_requires += extras_require[extra_package]
all_requires = list(set(all_requires))
extras_require['all'] = all_requires
extras_require["all"] = all_requires


test_requires = []
for test_package in ['tabpfn', 'imodels', 'vowpalwabbit', 'skl2onnx']:
for test_package in ["tabpfn", "imodels", "vowpalwabbit", "skl2onnx"]:
test_requires += extras_require[test_package]
extras_require['tests'] = test_requires
extras_require["tests"] = test_requires
install_requires = ag.get_dependency_version_ranges(install_requires)

if __name__ == '__main__':
if __name__ == "__main__":
ag.create_version_file(version=version, submodule=submodule)
setup_args = ag.default_setup_args(version=version, submodule=submodule)
setup(
Expand Down
2 changes: 1 addition & 1 deletion tabular/src/autogluon/tabular/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from autogluon.common.features.feature_metadata import FeatureMetadata
from autogluon.common.utils.log_utils import _add_stream_handler
from autogluon.common.utils.log_utils import _add_stream_handler
from autogluon.core.dataset import TabularDataset

try:
Expand Down

0 comments on commit 3f48d66

Please sign in to comment.