Building a fully custom container for scikit-learn
In this example, we're going to build a fully custom container without any AWS code. We'll use it to train a scikit-learn model on the Boston Housing dataset, using a generic Estimator
. With the same container, we'll deploy the model thanks to a Flask
web application.
We'll proceed in a logical way, first taking care of the training, then updating the code to handle deployment.
Training with a fully custom container
Since we can't rely on Script Mode anymore, the training code needs to be modified. This is what it looks like, and you'll easily figure out what's happening here:
#!/usr/bin/env python import pandas as pd import joblib, os, json if __name__ == '__main__':Â Â Â Â config_dir = '/opt/ml/input/config'Â Â Â Â training_dir = '/opt/ml/input/data/training'Â Â Â Â model_dir = '/opt/ml/model' Â ...