chrislevn / Deploying-GPT-Example

Deploying GPT Miniature on Flask, Docker, and Kubernetes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deploying Miniature GPT on Flask, Docker, Kubernetes

Screenshot 2023-06-07 at 12 09 40 AM

What it does

Deploy a Machine Learning model (Miniature GPT with movie reviews dataset) with Docker, Kubernetes, Flask API.

How to run:

  1. Create a hub on Docker - https://hub.docker.com/ (As of current version, Kubernetes will take public image. )
  2. Login to docker docker login
  3. Build Docker image (current port is 5002).
    docker build -t tagname
    docker push image:tagname
  4. In deployment.yaml, rename image (line 32) with the image name from your Docker Hub.
    Optional: To have Docker image exits and removes itself, run docker run -rm <IMAGE_NAME>
  5. Run kubernetes kubectl create -f deployment.yaml
    kubectl apply -f deployment.yaml (this will trigger deployment and load balancer)
  6. Run minikube minikube start
    minikube service list (get the list of current service. get the service running your name)
    minikube service <SERVICE_NAME>
  7. Test the API with Postman

Future developments

  • Connect Kubernetes with private Docker image
  • Add CI/CD
  • Add monitoring

About

Deploying GPT Miniature on Flask, Docker, and Kubernetes


Languages

Language:Python 86.3%Language:HTML 8.6%Language:Dockerfile 5.2%