Skip to main content

Triton Server Support for building Model repository

Project description

Triton Server Support for building Model repository

coverage version licence

This package help building model repository of Triton Server with more easy .yaml file.

⚠️ TO USE THIS LIBRARY, UNDERSTAND TRITON INFERENCE SERVER FIRST. TRITON INFERENCE SERVER TUTORIAL HERE.

👋 Installation

Install trsp package in Python.

pip install trsp

⚡ Quick command

  • Build model repository with config file.
trsp-build -f /path/to/config.yaml
  • Launch Triton Server with Docker.
trsp-run

📃 Configuration file with .yaml or .yml

To start, let's create a config.yaml file.

ONNX Model.

Suppose we have an onnx model named mymodel.onnx. Here is folder structure:

config.yaml
mymodel.onnx

Define model config to config.yaml.

model_repository: name_of_repository

models:
  my_model: # Write your own model name
    engine: onnx
    max_batch_size: 0
    versions:
      - version: 1
        path: mymodel.onnx

This config will create a model repository formated as Triton Inference Server requirements. It's look-like:

build/
  name_of_repository/
    my_model/
      1/
        model.onnx
      config.pbtxt

Python Model.

To create a python model, create a python file my_logic.py to define core logic as bellow:

config.yaml
my_logic.py
import numpy

def my_initialize(args: dict):
    # The args here is a dictionary contains config provided by Triton.
    ...
    return {}

def my_logic(args, inputs: list[np.ndarray]):
    # The args here is any that you return from the above function.
    # The inputs here is a list of numpy array that contain your input data.
    ...
    return (processed_data,) # Return a tuple of processed things.

Write a configuration.

model_repository: name_of_repository

models:
  my_python_model:
    engine: python
    max_batch_size: 0
    versions:
      version: 1
      module:
        path: my_logic.py
        initialize: my_initialize
        execute: my_logic
    # You must define input and output shape and data type of the python model.
    tensor:
      input:
        - dims: [1, 2, 3, 4]
          dtype: float32
      output:
        - dims: [1, 2, 3, 4]
          dtype: float32

# List out the library that you use for your logic for trsp install it when run.
requirements:
  - numpy

Ensemble Model.

Create ensemble model in Triton Server. Define in configuration as below:

model_repository: name_of_repository

models:
  my_ensemble_model:
    engine: ensemble
    max_batch_size: 0
    steps:
      - model: my_model
        version: latest
      - model: my_python_model
        version: latest

😊 Contributors

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

trsp-0.0.4.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

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

trsp-0.0.4-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

Details for the file trsp-0.0.4.tar.gz.

File metadata

  • Download URL: trsp-0.0.4.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for trsp-0.0.4.tar.gz
Algorithm Hash digest
SHA256 621edc89d334a28648475e75c9fe0d1078ef519f3224e62e95455e9be5ad109f
MD5 4aa151204b0810417c9d09c3744389a0
BLAKE2b-256 cda07a0f76ec46086b09e166f1841b40616ecb1f8e13eb87b0e3800332e4eeb0

See more details on using hashes here.

File details

Details for the file trsp-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: trsp-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 22.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for trsp-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 704844b57a3d9a5d82b6521487b1e7eec80a8665ffcf8318d5368f014d80f9a4
MD5 04f8e7305d37aa25deaf78a054db95d1
BLAKE2b-256 6c657edea93da6aaba422a376eb85f0b487d55de4771e46ffe8ec590f63f5c1b

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