Skip to main content

A Pyodide python http client library and utilities for communicating with Triton Inference Server (based on tritonclient from NVIDIA)

Project description

Triton HTTP Client for Pyodide

A Pyodide python http client library and utilities for communicating with Triton Inference Server (based on tritonclient from NVIDIA).

This is a simplified implemetation of the triton client from NVIDIA, it is mainly made for running in the web browser with pyodide. It only implement the http client, and most of the API remains the same but changed into async.

Usage

You can used it in Pyodide based environment, for example: Pyodide console or JupyterLite.

For example in a JupyterLite notebook, you can install the client by running:

import micropip
micropip.install("pyotritonclient")

If you want to use outside pyodide, run pip install pyotritonclient. However, please note that you will need to provide your own http_client class.

To execute the model, we provide utility functions to make it much easier:

import numpy as np
from pyotritonclient import get_config, execute_model

# obtain the model config
config = await get_config('https://triton.imjoy.io', 'cellpose-cyto')

# create fake input tensors
input0 = np.zeros([2, 349, 467], dtype='float32')
input1 = np.array([30], dtype='float32')
# run inference
results = await execute_model([input0, input1], config=config)

You can access the lower level api, see the test example.

You can also find the official client examples demonstrate how to use the package to issue request to triton inference server. However, please notice that you will need to change the http client code into async style. For example, instead of doing client.infer(...), you need to do await client.infer(...).

The http client code is forked from triton client git repo since commit b3005f9db154247a4c792633e54f25f35ccadff0.

Server setup

Since we access the server from the browser environment which typically has more security restrictions, it is important that the server is configured to enable browser access.

Please make sure you configured following aspects:

  • The server must provide HTTPS endpoints instead of HTTP
  • The server should send the following headers:
    • Access-Control-Allow-Headers: Inference-Header-Content-Length,Accept-Encoding,Content-Encoding,Access-Control-Allow-Headers
    • Access-Control-Expose-Headers: Inference-Header-Content-Length,Range,Origin,Content-Type
    • Access-Control-Allow-Methods: GET,HEAD,OPTIONS,PUT,POST
    • Access-Control-Allow-Origin: * (This is optional depending on whether you want to support CORS)

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

pyotritonclient-0.1.5.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

pyotritonclient-0.1.5-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

Details for the file pyotritonclient-0.1.5.tar.gz.

File metadata

  • Download URL: pyotritonclient-0.1.5.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for pyotritonclient-0.1.5.tar.gz
Algorithm Hash digest
SHA256 664fdff7083048e5cdcd4dcba6a4b73a12f62d4b7d2842537b7321d42e883cd2
MD5 ea53a112302672b6f9874f49ee127c75
BLAKE2b-256 bdacb4755a6ce2e4cf18ee0a7f1f343d24900bb68451704f3d47cf8ca5f63ae9

See more details on using hashes here.

File details

Details for the file pyotritonclient-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: pyotritonclient-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 19.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for pyotritonclient-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9f8ba08ffbd5cf3d899d7d2fc01fa8672cca96506775c045df8e6db6d27a066c
MD5 d1d120131bb354ff3bee9646b90db3f4
BLAKE2b-256 97d9b98cdc2ec5ec5b78a283d2ab16ec81e92e0d7e9236628c08ad17427fdb72

See more details on using hashes here.

Supported by

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