Skip to main content

ML Model Serving Package

Project description

build docs lint codecov GitHub License commit

[Some Info]

  • currently supported request type: request_content_type=application/json

[Instructions]

  1. save your model in .joblib format. Example:
from joblib import dump

your_model_artifact = {
    "model": your_model,
    # other metadata
    "tokenizer": ...,
    "quantization": ...,
    ...
}

dump(your_model_artifact, "MODEL_ARTIFACT_PATH.joblib")
  1. Create inference script inference.py with two functions input_fn and predict_fn (similar to how sagemaker inference does). Usually you'll create an inference file for each model you register. Example:
def input_fn(data):
    processed_data_for_model_input = ...  # some transformation logic
    return processed_data_for_model_input

def predict_fn(input, model):
    result = model(input)
    return result
  1. Register model: run deployaible register --name=MODLE_NAME --model_path=MODEL_ARTIFACT_PATH_JOBLIB --inference_path=INFERENCE_SCRIPT_PATH
  2. Serve your model: run deployaible serve --port=your_port You will get a backend running on your_port (default is 9000). A sample endpoint will be localhost:9000/your_model_name/predict.
  3. Test endpoint: run
curl -X POST -H "Content-Type: application/json" -d '{"data": ["val"]}' http://localhost:9100/GPT4/predict
  1. You can also the APIs via swagger UI on http://localhost:your_port/docs

sample_notebook_placeholder

sample_architecture_placeholder

Highlights

  • Supports multiple types of model serving
  • Sample UI
  • Works on Linux/MacOS/Windows

Install

[TODO] git instruction or pip install instruction

Basic Usage

Advanced Usage

Misc

Performance

Documentation

[TODO] set up using this link

Bugs/Requests

License

TODO's

  1. models.py - init method needs to use model loader and allows torch/pickle/sklearn types

  2. model_manager.py - enforce Singleton pattern with right locking mechanisms (also need to change the test case)

  3. bugs: AssertionError: write() before start_response when go to predict page then go back

  4. Celery component: add try/except KeyboardInterrupt as a potential fix to continuing celery worker

  5. Kafka component: add APIs for submitting data to and listening result from kafka

  • python setup.py sdist
  • twine upload dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dpai-0.1.0.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dpai-0.1.0-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file dpai-0.1.0.tar.gz.

File metadata

  • Download URL: dpai-0.1.0.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for dpai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 66235ca79b1c45fe53abbabc773ee550fca88f150815735ef30148f20f5a52a2
MD5 34e7f5ea28004cc412af65255425faf4
BLAKE2b-256 33696f15cbc31d43f08009017bbffa643f00d61410c7dc6265e0a525869e28ea

See more details on using hashes here.

File details

Details for the file dpai-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dpai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for dpai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f382655fccc56aa8ad1c049929f3d93a02bd134a32d4bffe3c9e24c03e4025da
MD5 48a06bcee143e829134e29bf6f0c8c4c
BLAKE2b-256 cfd82bce79f7b88c4a46bf48dc944a0ccb30d76b0c8ed0c238981b7b9085e8fc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page