Skip to content

Aiden-Jeon/ml-service

Repository files navigation

ml-service

Requirements

  1. Poetry osx / linux / bashonwindows install instructions:
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -

Check more details in Poetry Docs.

  1. RClone

To install rclone on Linux/macOS/BSD systems, run:

curl https://rclone.org/install.sh | sudo bash

Check more details in RClone Download.

Tutorial

Install

  1. Install project with poetry
poetry install

Train model

  1. Run MlFlow Server
make run-mlflow
  1. Train a model with given script.
poetry run python tutorial/train.py

Download model from model registry

  1. Go to mlflow ui page and check its run id

http://localhost:5000

  1. Download model to local with ml-service sync.
poetry run ml-service sync --run-id=...
  1. Check download is complete.
ls mnt/artifacts/model/

If completed you'll get result as below

MLmodel          conda.yaml       model.pkl        python_env.yaml  requirements.txt

Run FastAPI Server

  1. Run fastapi server with ml-service server.
poetry run ml-service server --model-name "model" --artifact-path "mnt/artifacts"
  1. Check fastapi docs site:

http://127.0.0.1:8000/docs

After deployment

  1. Go to FastAPI docs site:

fastapi_docs

  1. Check engine post

engine_post

  1. Write predict_method to use, in this tutorial we use predict. And click excute.

engine_post_param

  1. After excute, you can get result as below:

excute_result

Tutorial with buffer

Buffer domain save input data to postgres server.

Requirements

  1. postgresql

Install postgresql with instruction [LINK].

Setup

  1. init db folder to start:
make initdb
  1. run postgresql server:
make run-postgres
  1. add user to postgresql server:
make init-user

Run FastAPI Server

  1. Run fastapi server with ml-service server with --use-buffer argument.
poetry run ml-service server --model-name "model" --artifact-path "mnt/artifacts" --use-buffer

After deployment

  1. Use buffer domain and execute.

buffer

Check DB

  1. Connect to DB with below information:

    • db: postgres
    • user: postgres
    • password: password
  2. Check input table:

input

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published