Giter Club home page Giter Club logo

fastapi-deep-learning-model-micro-batching-serving's Introduction

FastAPI Model Micro Batching Serving Sample using Service Streamer

FastAPI DL Model Serving Sample

micro batch depens on Service Streamer

Project Structur

.
├── app_v1
├── app_v2
│   ├── manager # model micro batch manager
│   │   ├── __init__.py
│   │   └── resnet.py
│   ├── routers
│   │   ├── __init__.py
│   │   └── resnet.py
│   ├── schema.py
│   ├── services
│   │   ├── __init__.py
│   │   └── resnet.py
│   ├── dependencies.py
│   ├── main.py
│   └── settings.py
├── imagenet_classes.txt
├── model_store
│   ├── classifier.zip
│   └── embedding.zip
├── README.md
└── requirements.txt

docker-compose

version: "3.8"

services:
  api:
    build: .
    restart: unless-stopped
    command: uvicorn app_v2.main:app --host 0.0.0.0  --workers 1 --port 8000 --log-config ./log.ini
    ports:
      - "8000:8000"
    expose:
      - 8000
    volumes:
      - ./log:/app/log:rw

    environment:
      DL_EMBEDDING_MODEL_PATH: model_store/embedding.zip
      DL_CLASSIFIER_MODEL_PATH: model_store/classifier.zip
      CLASSES_PATH: imagenet_classes.txt

      MB_BATCH_SIZE: 256
      MB_MAX_LATENCY: 1 # Sec
      MB_WORKER_NUM: 1

      CUDA_DEVICE: cuda
      CUDA_DEVICES: "[0]"

    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              device_ids: [ '0' ]
              capabilities: [ gpu ]

    healthcheck:
      test: curl --fail http://localhost:8000/health || exit 1
      interval: 60s
      retries: 5
      start_period: 30s
      timeout: 5s

Requirements

  • torch==1.10.1
  • torchvision==0.11.2
  • fastapi[all]==0.80.0
  • fastapi-restful==0.4.3
  • fastapi-health==0.4.0
  • service-streamer==0.1.2
  • pydantic==1.9.2

fastapi-deep-learning-model-micro-batching-serving's People

Contributors

rapidrabbit76 avatar

Stargazers

 avatar  avatar  avatar  avatar  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.