Coder Social home page Coder Social logo

patrickcmd / mlops-project Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 7.0 1.71 MB

An end-to-end machine learning (mlops) project

Jupyter Notebook 97.84% Python 2.04% Dockerfile 0.03% Makefile 0.08%
docker machine-learning machine-learning-algorithms makefile mlflow-tracking mlflow-tracking-server mlops orchestration-framework prefect

mlops-project's Introduction

MLOPS PROJECT (End to End)

This is project for the MLOps ZoomCamp course here sponsored by DataTalks.Club

Problem

This is a simple end-to-end mlops project which takes data from capital bikeshare and transforms it with machine learning pipelines from training, model tracking and experimenting with mlflow, ochestration with prefect as workflow tool to deploying the model as a web service.

The project runs locally and uses AWS S3 buckets to store model artifacts during model tracking and experimenting with mlflow.

Dataset

The chosen dataset for this project is the Capital Bikeshare Data

Improvements

In the future I hope to improve the project by having the entire infrastructure moved to cloud using AWS cloud(managing the infrastructure with iac tools such as terraform), have model deployment as either batch or streaming with AWS lambda and kinesis streams, a comprehesive model monitoring.

Project Setup

Clone the project from the repository

git clone https://github.com/PatrickCmd/mlops-project.git

Change to mlops-project directory

cd mlops-project

Setup and install project dependencies

make setup

Add your current directory to python path

export PYTHONPATH="${PYTHONPATH}:${PWD}"

Start Local Prefect Server

In a new terminal window or tab run the command below to start prefect orion server

prefect orion start

Start Local Mlflow Server

The mlflow points to S3 bucket for storing model artifacts and uses sqlite database as the backend end store

Create an S3 bucket and export the bucket name as an environment variable as shown below

In a new terminal window or tab run the following commands below

export S3_BUCKET_NAME=bucket_name

Start the mlflow server

mlflow server --backend-store-uri sqlite:///mlflow.db --default-artifact-root s3://${S3_BUCKET_NAME} --artifacts-destination s3://${S3_BUCKET_NAME}

Running model training and model registery staging pipelines locally

Model training

python main.py --train_file 202204-capitalbikeshare-tripdata.zip --valid_file 202205-capitalbikeshare-tripdata.zip

model-tracking

Flow runs

Register and Stage model

python stage.py --tracking_uri http://127.0.0.1:5000 --experiment_name valid_experiment_name

Register model

Create scheduled deployments and agent workers to start the deployments

prefect deployment create deployments.py

deployments

Create work queues

prefect work-queue create -t "ml-training" ml-training-queue
prefect work-queue create -t "ml-staging" ml-staging-queue

work queue

training queue

staging queue

Run deployments locally to schedule pipeline flows

prefect deployment run mlflow-training/deploy-mlflow-training
prefect deployment run mlflow-staging/deploy-mlflow-staging

scheduled_flow_runs

Deploy model as a web service locally

Change to webservice directory and follow the instructions here

mlops-project's People

Contributors

patrickcmd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.