Giter VIP home page Giter VIP logo

alpha-131 / mlops-pipeline Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 57 KB

This project deploys a pre-trained GPT-2 language model on Amazon SageMaker using Hugging Face Transformers. It encompasses model download, S3 upload, SageMaker deployment, Lambda function integration, and API Gateway setup. Dedicated scripts manage these tasks, supported by a CI/CD pipeline for efficient deployment.

Jupyter Notebook 60.28% Python 39.72%
aws s3-bucket sagemaker-deployment

mlops-pipeline's Introduction

GPT-2 SageMaker Deployment

Overview

This project orchestrates the seamless deployment of a pre-trained GPT-2 model from the Hugging Face model hub onto Amazon SageMaker, enabling real-time inference. By leveraging AWS S3 for model storage and integrating the endpoint with AWS Lambda function and API Gateway, this deployment ensures efficient and scalable model serving.

Architecture for MLOps Pipeline

The MLOps pipeline architecture illustrates the flow of activities involved in deploying and managing machine learning models. This comprehensive workflow encompasses various stages, including data preparation, model training, deployment, monitoring, and maintenance. Each stage plays a crucial role in ensuring the successful and efficient operation of machine learning systems.

Project Structure

  • data/: Houses all project-related data.
  • model/: Stores the GPT-2 model weights.
  • notebooks/: Contains comprehensive experimentation notebooks.
  • scripts/: Hosts Python scripts for seamless local and remote execution.
  • src/: Organizes the model as a package along with associated modules.
  • tests/: Comprises a suite of tests to ensure model robustness.
  • requirements.txt: Lists all project dependencies for reproducibility.

Usage (MLOps Pipeline)

  1. Clone Repository:

    git clone https://github.com/Alpha-131/MYM-assessment-task.git
  2. Configure AWS Settings:

    • Modify AWS configurations in relevant scripts to match project requirements.
  3. Upload Model to S3:

    python upload_to_s3.py
  4. Deploy SageMaker Model:

    python deploy_to_sagemaker.py
  5. Setup Lambda Function:

    • Integrate the endpoint with a Lambda function for streamlined processing.
  6. API Gateway Configuration:

    • Utilize API Gateway to create a production or testing stage, linking it with the Lambda function for seamless API access.
  7. Access API URL:

    • Access the API URL for making model inference requests:
      https://<some_random_code>.execute-api.<region>.amazonaws.com/<stage_name>/<resource_name>
      

Remaining Tasks

  • Download GPT-2 model weights.
  • Create model.tar.gz file for artifacts.
  • Upload model.tar.gz to Amazon S3.
  • Write deployment script for sagemaker endpoint.
  • Establish CI/CD pipeline for automated deployment.
  • Define YAML configuration file for CI/CD pipeline.
  • Implement monitoring using AWS Cloudwatch for sagemaker endpoint.
  • Implement logging using Cloudtrail and store it in S3 bucket for SageMaker endpoints.
  • Configure autoscaling for dynamic traffic-based scaling.

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.