Git Product home page Git Product logo

slash_docker's Introduction

Model to Docker

A unified way to package pre-trained models into docker files

Model to Docker in action, or how it works

https://youtu.be/rc6ylq01D0c

Installation guide

git clone [email protected]:slashml/slash_docker.git
cd slash_docker
pip install -e .

Quickstart

from sklearn.linear_model import LinearRegression

lm = LinearRegression()
lm.fit([[2], [3], [4]], [4,6,8])

#test the model locally
lm.predict([[1024]])
# serialize and save the model
from model_to_docker import save_model
save_model(lm, 'sklearn_linear_regression')
# start a docker container with the previously saved model
# this will create a docker image, and start a docker container
from model_to_docker import run_model_server

# this will take a few seconds if its the first time
container = run_model_server('sklearn_linear_regression', port=5000)
# perform inference on the locally running docker container
import requests

resp = requests.post('http://127.0.0.1:8080/v1/models/model:predict', '[[1024]]')

print(resp.json())
# you can also use the curl command in terminal to perform inference
curl http://127.0.0.1:8080/v1/models/model:predict -d '[[1025]]'
# stop the docker container
from model_to_docker import stop_model_server
stop_model_server(container.id)

For other examples look inside the examples folder

Supported frameworks

  • Scikit-learn
  • XGBoost
  • PyTorch
  • Mlflow
  • TensorFlow
  • MLFLow
  • FastAI
  • HuggingFace Transformers
  • Keras
  • LightGBM
  • ONNX
  • PyCaret
  • SegmentAnything

Contact

If you run into any issues, or need a new feature, or any custom help, please feel free to reach out to us at [email protected], [email protected]

Contributing

We are actively looking for contributors. Please look at the CONTRIBUTING.md guide for more details. We have a growing list of good_first_issues, you can reach us at [email protected], to get started.

slash_docker's People

Contributors

eff-kay avatar

Stargazers

almoehi avatar angel zambrano avatar Rajeev Mishra avatar David Howell avatar

Watchers

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