Giter Club home page Giter Club logo

hf-model-deployment's Introduction

HF Model deployment comparison

This repo aims to compare different deployment methods for a ML from the HuggingFace Hub. We are using bart-large-mnli for our experiments but we expect our results valid for most of the ML models (at least Transformers ones).

Setup

Each compared method is in the methods folder. For each of the methods, follow those steps:

You only need to have conda and git lfs installed

Go in the method folder

export METHOD_NAME=<name-of-the-method>
cd methods/$METHOD_NAME

Create Conda env

conda create --name ml-deploy-$METHOD_NAME python=3.10
conda activate ml-deploy-$METHOD_NAME

Install dependencies

pip install -r requirements.txt

Download the model

chmod +x setup.sh
./setup.sh

Run locally

Again from each method folder, you can run:

chmod +x run.sh
./run.sh

This will start the server and you can test the API.

Create Docker image

Go back to the root folder of the project:

cd ../..

And you can build the Docker image:

docker build -t $METHOD_NAME -f methods/$METHOD_NAME/Dockerfile .

This will create the docker image.

To run it, simply use:

export PORT_TO_USE=8000
docker run -p $PORT_TO_USE:80 --name $METHOD_NAME $METHOD_NAME

Access it on http://localhost:$PORT_TO_USE/docs.

hf-model-deployment's People

Contributors

airklizz avatar

Stargazers

Jarrian Gojar 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.