Giter Club home page Giter Club logo

ml-nvidia-triton's Introduction

Deploying Face-Emotion and Background Changer with Nvidia Triton Server using Docker Compose and FastAPI on EC2

📚 Learning Objectives

By the end you will be able to:

  • Configure a Scalable Model Serving Framework
  • Deploy using Docker Compose on Scalable Model Serving Framework

Create EC2 Instance

Install Dependencies

  • Get the IP address of the instance
  • Change key permissions to 400
  • SSH into the machine
  • Install git if needed
  • Install Docker
  • Start Docker
  • Add user to docker group
  • Logout and Login again through SSH to take the group changes into account
  • Check if docker installed correctly (docker run hello-world)
  • Install Docker-Compose

Model Repositories

Face-Bokeh

  • Rename frozen_inference_graph.pb to model.graphdef
  • Write the config.pbtxt with:
    • platform: "tensorflow_graphdef"
    • The input tensor is called ImageTensor and should be UINT8 with dims [-1,513,513,3]
    • The output tensor is called ResizeBilinear_3 and should be FP32 with dims [-1,513,513,21]
  • Upload to s3 with the following folder structure
    models/
    └─face-bokeh/
      └─config.pbtxt
      └─1/
        └─model.graphdef

Face-Emotion

  • Load the model.h5 file and convert into the saved model format
  • Write the config.pbtxt with:
    • platform: "tensorflow_savedmodel"
    • The input should be FP32 with dims [-1,48,48,1]
    • The output should be FP32 with dims [-1,7]
  • Upload to s3 with the following strutcture
    models/
    └─face-emotion/
      └─config.pbtxt
      └─1/
        └─model.savedmodel/
          └-keras_metadata.pb
          └-saved_model.pb
          └─assets/
          └─variables/
            └─variables.data-00000-of-00001
            └─variables.index

Deploy

Clone the Repo

  • Clone the repo (git clone ...)
  • If there's permission issues with GitHub, generate ssh keys (ssh-keygen) and add them to GitHub account
  • CD into the folder (cd cloned-repo)
  • Create the .aws.env file in the root of the repo with the following:
AWS_ACCESS_KEY_ID=SOME_ACCESS_KEY
AWS_SECRET_ACCESS_KEY=SOME_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION=us-east-1

Triton Server

  • Running the triton server alone
docker run --env-file .aws.env -p8000:8000 -p8001:8001 -p8002:8002 --rm --net=host nvcr.io/nvidia/tritonserver:22.06-py3 tritonserver --model-repository=s3://triton-repository/models/

Docker Compose

  • Add triton to the docker-compose.yaml with image, env file, ports, and command.
  • Run all the endpoints and triton server (docker-compose -f docker-compose.yaml up --build)
  • Create a request with docs (http://ec2.ip.address:8000/docs)

ml-nvidia-triton's People

Contributors

narenb7 avatar

Watchers

 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.