Reference for ultralytics/utils/triton.py
Note
This file is available at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/utils/triton.py. If you spot a problem please help fix it by contributing a Pull Request 🛠️. Thank you 🙏!
ultralytics.utils.triton.TritonRemoteModel
Client for interacting with a remote Triton Inference Server model.
This class provides a convenient interface for sending inference requests to a Triton Inference Server and processing the responses.
Attributes:
Name | Type | Description |
---|---|---|
endpoint |
str
|
The name of the model on the Triton server. |
url |
str
|
The URL of the Triton server. |
triton_client |
The Triton client (either HTTP or gRPC). |
|
InferInput |
The input class for the Triton client. |
|
InferRequestedOutput |
The output request class for the Triton client. |
|
input_formats |
List[str]
|
The data types of the model inputs. |
np_input_formats |
List[type]
|
The numpy data types of the model inputs. |
input_names |
List[str]
|
The names of the model inputs. |
output_names |
List[str]
|
The names of the model outputs. |
metadata |
The metadata associated with the model. |
Examples:
Initialize a Triton client with HTTP
>>> model = TritonRemoteModel(url="localhost:8000", endpoint="yolov8", scheme="http")
Make inference with numpy arrays
>>> outputs = model(np.random.rand(1, 3, 640, 640).astype(np.float32))
Arguments may be provided individually or parsed from a collective 'url' argument of the form
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
The URL of the Triton server. |
required |
endpoint
|
str
|
The name of the model on the Triton server. |
''
|
scheme
|
str
|
The communication scheme ('http' or 'grpc'). |
''
|
Source code in ultralytics/utils/triton.py
__call__
Call the model with the given inputs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*inputs
|
ndarray
|
Input data to the model. |
()
|
Returns:
Type | Description |
---|---|
List[ndarray]
|
Model outputs with the same dtype as the input. |