Fiddler offers seamless integration with Amazon SageMaker. This guide will walk you through how you can easily upload a model trained with SageMaker into Fiddler.
📘 Before proceeding with this walkthrough, make sure you have already
In order to download your model, navigate to the AWS console and go to SageMaker. On the left, click "Inference" and go to "Models". Then select the model you want to upload to Fiddler.
Copy the Model data location to your clipboard.
Downloading your model with Python
Now, from a Python environment (Jupyter notebook or standard Python script), paste the Model data location you copied into a new variable.
%%writefile model/package.pyimport numpy as npimport pandas as pdfrom pathlib import Pathimport xgboost as xgbimport fiddler as fdlPACKAGE_PATH =Path(__file__).parentclassModelPackage:def__init__(self): self.model_path = str(PACKAGE_PATH / 'xgboost-model') # This is the name of your model file within the model directory
self.model = xgb.Booster() self.model.load_model(self.model_path) self.output_columns = ['output_column']deftransform_input(self,input_df):return xgb.DMatrix(input_df)defpredict(self,input_df): transformed_input = self.transform_input(input_df) pred = self.model.predict(transformed_input)return pd.DataFrame(pred, columns=self.output_columns)defget_model():returnModelPackage()