Skip to main content

nvForest

Project description

nvForest - Highly Optimized Decision Tree Inference

nvForest is a highly-optimized and lightweight RAPIDS library that enables fast inference for decision tree models on NVIDIA GPUs and CPUs. It does not train models; it runs inference on models trained elsewhere (e.g., XGBoost, LightGBM, scikit-learn, or cuML).

nvForest uses Treelite as the common format for importing tree models. You can load a model from a file or from an in-memory scikit-learn or Treelite object, then run predictions with a scikit-learn-like API. Setting device="auto" lets you deploy the same script on machines with or without GPUs.

As an example, the following Python snippet loads an XGBoost model and runs inference on GPU:

import nvforest

# Load XGBoost model for GPU inference
fm = nvforest.load_model("/path/to/xgboost_model.ubj", device="gpu",
                         model_type="xgboost_ubj")

# Run inference (X can be a NumPy array or CuPy array)
pred = fm.predict(X)

Load a scikit-learn random forest model and get class probabilities:

import nvforest
from sklearn.ensemble import RandomForestClassifier

# Train with scikit-learn (or load a saved model)
skl_model = RandomForestClassifier(...)
skl_model.fit(X_train, y_train)

# Load into nvForest for fast GPU inference
fm = nvforest.load_from_sklearn(skl_model, device="gpu")
class_probs = fm.predict_proba(X)

For more examples and the full API, see the Getting started guide and the Python API documentation.

Supported Models

Source Formats
XGBoost UBJSON, JSON, legacy binary
LightGBM Text (.txt)
scikit-learn In-memory (RandomForest, ExtraTrees, GradientBoosting)
cuML Via Treelite export
Treelite Checkpoint / in-memory treelite.Model

Inference Modes

Method Description
predict(X) Standard predictions (class labels or regression values)
predict_proba(X) Class probabilities (classification only)
apply(X) Leaf indices per tree
predict_per_tree(X) Prediction from each tree in the ensemble

You can tune performance with layout (e.g., depth_first, breadth_first) and chunk_size; use fm.optimize() to auto-tune.


Installation

See the RAPIDS Release Selector for the command line to install either nightly or official release nvForest packages via conda, pip, or Docker.

Build/Install from Source

See the build guide.

Contributing

We welcome contributions. For guidelines and how to get started, see the RAPIDS contributing guide.

Contact

Find out more on the RAPIDS site.

Open GPU Data Science

The RAPIDS suite of open source software libraries aims to enable execution of end-to-end data science and analytics pipelines entirely on GPUs. It relies on NVIDIA® CUDA® primitives for low-level compute optimization, exposing GPU parallelism and high-bandwidth memory through user-friendly Python interfaces.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

libnvforest_cu13-26.4.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (23.1 MB view details)

Uploaded Python 3manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

libnvforest_cu13-26.4.0-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (23.1 MB view details)

Uploaded Python 3manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

File details

Details for the file libnvforest_cu13-26.4.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for libnvforest_cu13-26.4.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4c8e1669332c1080b66542c1b83013a46cc001aa38951ec3f5278dac35d779b8
MD5 93323b50378c7021abfb7e46bebce290
BLAKE2b-256 5a9ee8b9856332ba1255bc93515ab3542679349175244122147b96be5233aedb

See more details on using hashes here.

File details

Details for the file libnvforest_cu13-26.4.0-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for libnvforest_cu13-26.4.0-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c80e13da9058953dd71786ccef2b21d178020d3d9727772c1ede53fdf4427651
MD5 0527ba06ece581c6de0e03f05ef31f68
BLAKE2b-256 5c5b44c97b146d0b1ed2b087fe6eab13657578411baa55014a48c9d1858999ac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page