
    /j                    Z    d dl mZ d dlmZ d dlZd dlmZ ddlmZ  G d de          Z	dS )	    )annotations)PathN)check_requirements   )BaseBackendc                  "    e Zd ZdZddZdd
ZdS )TritonBackendzNVIDIA Triton Inference Server backend for remote model serving.

    Connects to and runs inference with models hosted on an NVIDIA Triton Inference Server instance via HTTP or gRPC
    protocols. The model is specified using a triton:// URL scheme.
    weight
str | PathreturnNonec                    t          d           ddlm}  ||          | _        t	          | j        d          r!|                     | j        j                   dS dS )zConnect to a remote model on an NVIDIA Triton Inference Server.

        Args:
            weight (str | Path): Triton model URL (e.g., 'http://localhost:8000/model_name').
        ztritonclient[all]r   )TritonRemoteModelmetadataN)r   ultralytics.utils.tritonr   modelhasattrapply_metadatar   )selfr
   r   s      c/home/longshao/multi-rider-rag/.venv/lib/python3.11/site-packages/ultralytics/nn/backends/triton.py
load_modelzTritonBackend.load_model   sv     	.///>>>>>>&&v..
 4:z** 	5
 344444	5 	5    imtorch.Tensorlistc                t    |                      |                                                                          S )a  Run inference via the NVIDIA Triton Inference Server.

        Args:
            im (torch.Tensor): Input image tensor in BCHW format, normalized to [0, 1].

        Returns:
            (list): Model predictions as a list of numpy arrays from the Triton server.
        )r   cpunumpy)r   r   s     r   forwardzTritonBackend.forward$   s(     zz"&&((..**+++r   N)r
   r   r   r   )r   r   r   r   )__name__
__module____qualname____doc__r   r    r   r   r	   r	      sF         5 5 5 5	, 	, 	, 	, 	, 	,r   r	   )

__future__r   pathlibr   torchultralytics.utils.checksr   baser   r	   r$   r   r   <module>r*      s    # " " " " "        7 7 7 7 7 7      , , , , ,K , , , , ,r   