- Project Deploying a ML Model to Cloud Application Platform with FastAPI in ML DevOps Engineer Nanodegree program by Udacity.
Salary prediction model that is trained on Census Bureau data and deployed with FastAPI. A remote DVC pointing to AWS S3 bucket that tracks data changes. In addition, wrote unit tests to monitor the model performance on various slices of the data. Deployed my model using the FastAPI package and created API tests. Both the slice-validation and the API tests are incorporated into a CI/CD framework using GitHub Actions.
The directory structure:
.
├── data
│ └── census.csv.dvc
├── model
│ ├── metrics_by_slice.csv
│ └── model.pkl
├── screenshots
│ └── app.png
├── starter
│ ├── ml
│ │ ├── data.py
│ │ └── model.py
│ ├── config.py
│ └── train_model.py
├── tests
│ ├── test_main.py
│ └── test_model.py
├── README.md
├── main.py
├── model_card.md
└── requirements.txt
census.csv.dvc
: DVC info of the dataset that is located in AWS S3 bucketmetrics_by_slice.csv
: Detailed model metrics on categorical datamodel.pkl
: Random Forest modeldata.py
: Module containing preprocessing functionmodel.py
: Module containing training, metrics and inference functionsconfig.py
: Config file for train_model.pytrain_model.py
: Script to train modeltest_main.py
: Test script for main.pytest_model.py
: Test script for model.pymain.py
: FastAPI appmodel_card.md
: Model Card
Make sure to have conda installed and ready.
> conda create -n [envname] "python=3.8" scikit-learn pandas numpy pytest jupyter jupyterlab fastapi uvicorn -c conda-forge
uvicorn main:app --reload
python -m pytest -vv