In this example we show an end-to-end GPU-accelerated fraud detection example making use of tree-based models like XGBoost. In the first notebook Data Preprocessing using RAPIDS and Training XGBoost for Fraud Detection we demonstrate GPU-accelerated tabular data preprocessing using RAPIDS and training of XGBoost model for fraud detection on the GPU in SageMaker. Then in the second notebook Pre-processing and XGBoost model inference pipeline with NVIDIA Triton Inference Server on Amazon SageMaker we walk through the process of deploying data preprocessing and XGBoost model inference pipeline for high throughput, low-latency inference on Triton in SageMaker.
-
Launch SageMaker notebook instance with
g4dn.xlarge
instance. This example can also be run on a SageMaker studio notebook instace but the steps that follow will focus on the notebook instance.- In Additional Configuration select
Create a new lifecycle configuration
. Specifyrapids-2106
as the name in Configuration Setting and copy paste the on_start.sh script as the lifecycle configuration start notebook script. This will create the RAPIDS kernel for us to use inside SageMaker notebook.- For those using AWS on Windows machine, because of the incompatibility between Windows and Unix formatted text, especially in end of line characters you will run into this error if you copy paste on_start.sh script. To prevent that use Notepad++ (or other text editor) to change end of line characters (CRLF to LF) in the on_start.sh script.
- Click on Search > Replace (or Ctrl + H)
- Find what: \r\n.
- Replace with: \n.
- Search Mode: select Extended.
- Replace All. And then copy paste this into the AWS Lifecycle Configuration Start Notebook UI
- For those using AWS on Windows machine, because of the incompatibility between Windows and Unix formatted text, especially in end of line characters you will run into this error if you copy paste on_start.sh script. To prevent that use Notepad++ (or other text editor) to change end of line characters (CRLF to LF) in the on_start.sh script.
- IMPORTANT: In Additional Configuration for Volume Size in GB specify at least 50 GB.
- For git repositories select the option
Clone a public git repository to this notebook instance only
and specify the Git repository URL https://github.com/aws/amazon-sagemaker-examples/tree/main/sagemaker-triton/fil_ensemble
- In Additional Configuration select
-
Once JupyterLab is ready, launch the 1_prep_rapids_train_xgb.ipynb notebook with
rapids-2106
conda kernel and run through this notebook to do GPU-accelerated data preprocessing and XGBoost training on credit card transactions dataset for fraud detection use-case. Make sure to use therapids-2106
kernel for this notebook. -
Launch the 2_triton_xgb_fil_ensemble.ipynb notebook using
conda_python3
kernel (we don't use RAPIDS in this notebook). Make sure to use theconda_python3
kernel for this notebook. Please note that this notebook requires that the first notebook be run to create the required dependencies. Run through this notebook to learn how to deploy the ensemble data preprocessing + XGBoost model inference pipeline using the Triton's Python and FIL Backends on Triton SageMakerg4dn.xlarge
endpoint.