Tiny configuration for Triton Inference Server
Project description
tritony - Tiny configuration for Triton Inference Server
What is this?
If you see the official example, it is really confusing to use where to start.
Use tritony! You will get really short lines of code like example below.
import argparse
import os
from glob import glob
import numpy as np
from PIL import Image
from tritony import InferenceClient
def preprocess(img, dtype=np.float32, h=224, w=224, scaling="INCEPTION"):
sample_img = img.convert("RGB")
resized_img = sample_img.resize((w, h), Image.Resampling.BILINEAR)
resized = np.array(resized_img)
if resized.ndim == 2:
resized = resized[:, :, np.newaxis]
scaled = (resized / 127.5) - 1
ordered = np.transpose(scaled, (2, 0, 1))
return ordered.astype(dtype)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--image_folder", type=str, help="Input folder.")
FLAGS = parser.parse_args()
client = InferenceClient.create_with("densenet_onnx", "0.0.0.0:8001", input_dims=3, protocol="grpc")
client.output_kwargs = {"class_count": 1}
image_data = []
for filename in glob(os.path.join(FLAGS.image_folder, "*")):
image_data.append(preprocess(Image.open(filename)))
result = client(np.asarray(image_data))
for output in result:
max_value, arg_max, class_name = output[0].decode("utf-8").split(":")
print(f"{max_value} ({arg_max}) = {class_name}")
Release Notes
- 24.07.11 Upgrade minimum tritonclient version to 2.34.0
- 23.08.30 Support
optionalwith model input,parameterson config.pbtxt - 23.06.16 Support tritonclient>=2.34.0
- Loosely modified the requirements related to tritonclient
Key Features
- Simple configuration. Only
$host:$portand$model_nameare required. - Generating asynchronous requests with
asyncio.Queue - Simple Model switching
- Support async tritonclient
Requirements
$ pip install tritonclient[all]
Install
$ pip install tritony
Test
With Triton
./bin/run_triton_tritony_sample.sh
pytest -s --cov-report term-missing --cov=tritony tests/
Example with image_client.py
- Follow steps in the official triton server documentation
# Download Images from https://github.com/triton-inference-server/server.git
python ./example/image_client.py --image_folder "./server/qa/images"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tritony-0.0.20.tar.gz.
File metadata
- Download URL: tritony-0.0.20.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b82a6347040e8ba2e1a3261ab7ea1f2f240fe45f98bcd01c9ce346f92fedd5e
|
|
| MD5 |
3dc408482f419a33857ef2c3588febd3
|
|
| BLAKE2b-256 |
d2c1ac4c8b3ac6cc64aa7a45780764153e8fa7f8cb50293519743354053e278f
|
Provenance
The following attestation bundles were made for tritony-0.0.20.tar.gz:
Publisher:
wheels.yml on rtzr/tritony
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tritony-0.0.20.tar.gz -
Subject digest:
7b82a6347040e8ba2e1a3261ab7ea1f2f240fe45f98bcd01c9ce346f92fedd5e - Sigstore transparency entry: 161335326
- Sigstore integration time:
-
Permalink:
rtzr/tritony@73a3933ec38517f63002c6bef5abb7e8afbfb32e -
Branch / Tag:
refs/tags/v0.0.20 - Owner: https://github.com/rtzr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@73a3933ec38517f63002c6bef5abb7e8afbfb32e -
Trigger Event:
push
-
Statement type:
File details
Details for the file tritony-0.0.20-py3-none-any.whl.
File metadata
- Download URL: tritony-0.0.20-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
277da516d0fffe2cc65ac0b16d9999e199fa158a3667225141372c562c8dd2c3
|
|
| MD5 |
639c56c78f5fc4173d183024e2ca6b64
|
|
| BLAKE2b-256 |
78eba65c7892b49d43997d23ec4bde2a2447c25b8e277fc4e21d8e42cf2429fb
|
Provenance
The following attestation bundles were made for tritony-0.0.20-py3-none-any.whl:
Publisher:
wheels.yml on rtzr/tritony
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tritony-0.0.20-py3-none-any.whl -
Subject digest:
277da516d0fffe2cc65ac0b16d9999e199fa158a3667225141372c562c8dd2c3 - Sigstore transparency entry: 161335327
- Sigstore integration time:
-
Permalink:
rtzr/tritony@73a3933ec38517f63002c6bef5abb7e8afbfb32e -
Branch / Tag:
refs/tags/v0.0.20 - Owner: https://github.com/rtzr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@73a3933ec38517f63002c6bef5abb7e8afbfb32e -
Trigger Event:
push
-
Statement type: