Skip to content

Commit

Permalink
Bump Treelite to 4.1.2 (#5814)
Browse files Browse the repository at this point in the history
Treelite 4.1.2 contains important bug fixes such as:
* dmlc/treelite#547
* dmlc/treelite#552
* dmlc/treelite#553

Authors:
  - Philip Hyunsu Cho (https://github.com/hcho3)

Approvers:
  - Dante Gama Dessavre (https://github.com/dantegd)
  - Ray Douglass (https://github.com/raydouglass)

URL: #5814
  • Loading branch information
hcho3 authored Apr 1, 2024
1 parent 84989a5 commit 743123c
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 34 deletions.
2 changes: 1 addition & 1 deletion conda/environments/all_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ dependencies:
- sphinx<6
- statsmodels
- sysroot_linux-64==2.17
- treelite==4.0.0
- treelite==4.1.2
- umap-learn==0.5.3
- pip:
- dask-glm==0.3.0
Expand Down
2 changes: 1 addition & 1 deletion conda/environments/all_cuda-122_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ dependencies:
- sphinx<6
- statsmodels
- sysroot_linux-64==2.17
- treelite==4.0.0
- treelite==4.1.2
- umap-learn==0.5.3
- pip:
- dask-glm==0.3.0
Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/cuml/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ sysroot_version:
- "=2.17"

treelite_version:
- "=4.0.0"
- "=4.1.2"
2 changes: 1 addition & 1 deletion conda/recipes/libcuml/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cmake_version:
- ">=3.26.4"

treelite_version:
- "=4.0.0"
- "=4.1.2"

gtest_version:
- ">=1.13.0"
Expand Down
4 changes: 2 additions & 2 deletions cpp/cmake/thirdparty/get_treelite.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function(find_and_configure_treelite)
rapids_export_find_package_root(BUILD Treelite [=[${CMAKE_CURRENT_LIST_DIR}]=] EXPORT_SET cuml-exports)
endfunction()

find_and_configure_treelite(VERSION 4.0.0
PINNED_TAG e878556d29336d2242fd926beb659b9dec41be3a
find_and_configure_treelite(VERSION 4.1.2
PINNED_TAG 454abc4bfe03e6e9d45155c15f74ae36d8c73111
EXCLUDE_FROM_ALL ${CUML_EXCLUDE_TREELITE_FROM_ALL}
BUILD_STATIC_LIBS ${CUML_USE_TREELITE_STATIC})
2 changes: 1 addition & 1 deletion dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ dependencies:
- output_types: [conda, requirements, pyproject]
packages:
- cython>=3.0.0
- &treelite treelite==4.0.0
- &treelite treelite==4.1.2
- output_types: conda
packages:
- &pylibraft_conda pylibraft==24.4.*
Expand Down
11 changes: 0 additions & 11 deletions python/cuml/experimental/fil/fil.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import warnings
from libcpp cimport bool
from libc.stdint cimport uint32_t, uintptr_t

from cuml.internals.import_utils import has_sklearn
from cuml.common.device_selection import using_device_type
from cuml.internals.input_utils import input_to_cuml_array
from cuml.internals.safe_imports import (
Expand Down Expand Up @@ -967,16 +966,6 @@ class ForestInference(UniversalBase, CMajorInputTagMixin):
For GPU execution, the RAFT handle containing the stream or stream
pool to use during loading and inference.
"""
# TODO(hcho3): Remove this check when https://github.com/dmlc/treelite/issues/544 is fixed
if has_sklearn():
from sklearn.ensemble import (
HistGradientBoostingClassifier as HistGradientBoostingC,
)
from sklearn.ensemble import (
HistGradientBoostingRegressor as HistGradientBoostingR,
)
if isinstance(skl_model, (HistGradientBoostingR, HistGradientBoostingC)):
raise NotImplementedError("HistGradientBoosting estimators are not yet supported")
tl_model = treelite.sklearn.import_model(skl_model)
if default_chunk_size is None:
default_chunk_size = threads_per_tree
Expand Down
11 changes: 0 additions & 11 deletions python/cuml/fil/fil.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ from libc.stdint cimport uintptr_t
from libc.stdlib cimport free

import cuml.internals
from cuml.internals.import_utils import has_sklearn
from cuml.internals.array import CumlArray
from cuml.internals.base import Base
from pylibraft.common.handle cimport handle_t
Expand Down Expand Up @@ -882,16 +881,6 @@ class ForestInference(Base,
logger.warn("Treelite currently does not support float64 model"
" parameters. Accuracy may degrade slightly relative to"
" native sklearn invocation.")
# TODO(hcho3): Remove this check when https://github.com/dmlc/treelite/issues/544 is fixed
if has_sklearn():
from sklearn.ensemble import (
HistGradientBoostingClassifier as HistGradientBoostingC,
)
from sklearn.ensemble import (
HistGradientBoostingRegressor as HistGradientBoostingR,
)
if isinstance(skl_model, (HistGradientBoostingR, HistGradientBoostingC)):
raise NotImplementedError("HistGradientBoosting estimators are not yet supported")
tl_model = tl_skl.import_model(skl_model)
cuml_fm.load_from_treelite_model(
model=tl_model,
Expand Down
6 changes: 3 additions & 3 deletions python/cuml/tests/test_random_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ def test_rf_regressor_gtil_integration(tmpdir):
X, y = X.astype(np.float32), y.astype(np.float32)
clf = curfr(max_depth=3, random_state=0, n_estimators=10)
clf.fit(X, y)
expected_pred = clf.predict(X).reshape((-1, 1))
expected_pred = clf.predict(X).reshape((-1, 1, 1))

checkpoint_path = os.path.join(tmpdir, "checkpoint.tl")
clf.convert_to_treelite_model().to_treelite_checkpoint(checkpoint_path)
Expand All @@ -1342,7 +1342,7 @@ def test_rf_binary_classifier_gtil_integration(tmpdir):
X, y = X.astype(np.float32), y.astype(np.int32)
clf = curfc(max_depth=3, random_state=0, n_estimators=10)
clf.fit(X, y)
expected_pred = clf.predict_proba(X)
expected_pred = clf.predict_proba(X).reshape((-1, 1, 2))

checkpoint_path = os.path.join(tmpdir, "checkpoint.tl")
clf.convert_to_treelite_model().to_treelite_checkpoint(checkpoint_path)
Expand All @@ -1357,7 +1357,7 @@ def test_rf_multiclass_classifier_gtil_integration(tmpdir):
X, y = X.astype(np.float32), y.astype(np.int32)
clf = curfc(max_depth=3, random_state=0, n_estimators=10)
clf.fit(X, y)
expected_prob = clf.predict_proba(X)
expected_prob = clf.predict_proba(X).reshape((X.shape[0], 1, -1))

checkpoint_path = os.path.join(tmpdir, "checkpoint.tl")
clf.convert_to_treelite_model().to_treelite_checkpoint(checkpoint_path)
Expand Down
4 changes: 2 additions & 2 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ requires = [
"pylibraft==24.4.*",
"rmm==24.4.*",
"scikit-build-core[pyproject]>=0.7.0",
"treelite==4.0.0",
"treelite==4.1.2",
] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../dependencies.yaml and run `rapids-dependency-file-generator`.
build-backend = "scikit_build_core.build"

Expand Down Expand Up @@ -66,7 +66,7 @@ dependencies = [
"rapids-dask-dependency==24.4.*",
"rmm==24.4.*",
"scipy>=1.8.0",
"treelite==4.0.0",
"treelite==4.1.2",
] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../dependencies.yaml and run `rapids-dependency-file-generator`.
classifiers = [
"Intended Audience :: Developers",
Expand Down

0 comments on commit 743123c

Please sign in to comment.