NVIDIA Triton Inference Server搭建

  • https://docs.nvidia.com/deeplearning/triton-inference-server/user-guide/docs/index.html
  • https://github.com/triton-inference-server/server
  • API:https://docs.nvidia.com/deeplearning/triton-inference-server/user-guide/docs/protocol/README.html
  • 执行模型包装: https://github.com/triton-inference-server/backend
    • pytorch https://github.com/triton-inference-server/pytorch_backend
  • 容器:
  • https://catalog.ngc.nvidia.com/orgs/nvidia/containers/pytorch

安装

按照安装文档要求安装CPU或GPU平台

GPU命令:
docker run --gpus=1 --rm -p8000:8000 -p8001:8001 -p8002:8002 -v/full/path/to/docs/examples/model_repository:/models nvcr.io/nvidia/tritonserver:<xx.yy>-py3 tritonserver --model-repository=/models

CPU命令:
docker run --rm -p8000:8000 -p8001:8001 -p8002:8002 -v/full/path/to/docs/examples/model_repository:/models nvcr.io/nvidia/tritonserver:<xx.yy>-py3 tritonserver --model-repository=/models

QuickStart

cpu-only

# Step 1: Create the example model repository 
git clone -b r22.12 https://ghproxy.com/https://github.com/triton-inference-server/server.git  #添加代理方便下载
cd server/docs/examples
./fetch_models.sh

# Step 2: Launch triton from the NGC Triton container
docker run -name triton -d -p8000:8000 -p8001:8001 -p8002:8002 -v ${PWD}/model_repository:/models nvcr.io/nvidia/tritonserver:22.12-py3 tritonserver --model-repository=/models

# Step 3: Sending an Inference Request 
# In a separate console, launch the image_client example from the NGC Triton SDK container
docker run -it --name triton-client --rm --net=host nvcr.io/nvidia/tritonserver:22.12-py3-sdk

# Step 4: Inference
/workspace/install/bin/image_client -m densenet_onnx -c 3 -s INCEPTION /workspace/images/mug.jpg

# Inference should return the following
Image '/workspace/images/mug.jpg':
    15.346230 (504) = COFFEE MUG
    13.224326 (968) = CUP
    10.422965 (505) = COFFEEPOT
  • Step2:
    ![[Pasted image 20230203171629.png]]
    Step 3:
    ![[Pasted image 20230203171643.png]]
    ![[Pasted image 20230203171702.png]]
    Inference:
    ![[Pasted image 20230203171807.png]]

说明

  • ![[Pasted image 20230209202207.png]]
    • k8s异构集群上的单节点的推理服务
    • 支持多个框架的模型
  • ![[Pasted image 20230209202255.png]]
    • 支持并行推理
    • 单一模型多个线程的推理
      • ![[Pasted image 20230209203611.png]]
    • 多模型多线程推理
      • ![[Pasted image 20230209203624.png]]
  • ![[Pasted image 20230209215358.png]]
  • ![[Pasted image 20230210092031.png]]
  • torchserve
  • rayserve

  • https://zhuanlan.zhihu.com/p/598468847

  • https://github.com/triton-inference-server/client/tree/main/src/python/examples

  • kserver :https://kserve.github.io/website/modelserving/inference_api/

  • 端口分布

    • grpc 8001
    • http 8000
    • metrics 8002
      ![[Pasted image 20230221151448.png]]

![[Pasted image 20230221152230.png]]
https://pypi.org/project/tritonclient/

img-client

![[Pasted image 20230221145251.png]]

### 安装适用于Python 3.12的Triton #### 支持的操作系统环境配置 对于希望在Windows操作系统上安装支持Python 3.12版本的Triton服务器或客户端而言,需确认当前系统的最低要求被满足。这通常意味着拥有一个稳定版的Windows 10及以上版本,并确保已启用WSL2 (Windows Subsystem for Linux version 2),因为官方更倾向于通过Linux子系统来运行服务端应用[^1]。 #### Python环境准备 考虑到目标是针对Python 3.12的支持,在开始之前要先验证本地是否存在该版本解释器;如果尚未安装,则可以从官方网站获取最新发行包并完成部署。值得注意的是,尽管某些库可能暂时不完全兼容最新的Python大版本更新,但对于主流框架来说一般不会有太大阻碍[^2]。 #### Triton依赖项管理 为了使Triton能够顺利运作,除了基本的语言解析器外还需要额外安装一些必要的软件组件。这些主要包括但不限于NVIDIA驱动程序、CUDA Toolkit以及cuDNN SDK等GPU加速工具链。具体到不同硬件平台上的适配情况可能会有所差异,请参照官方文档中的指导建议进行操作[^3]。 #### 使用pip安装Triton Client SDK 当上述准备工作完成后,可以通过PyPI仓库利用`pip install nvidia-triton-inference-server-client==<version>`命令轻松获得对应于所选Python版本号下的客户端SDK。这里需要注意选择合适的标签页以匹配特定需求场景下的API接口特性[^4]。 ```bash pip install nvidia-triton-inference-server-client==2.27.0 ``` 由于目前并没有直接提供给Windows原生环境下使用的二进制文件形式发布的Triton Server实例,所以推荐采用基于容器化技术如Docker的方式来进行快速搭建测试环境。当然也可以考虑借助WSL2配合Ubuntu或其他GNU/Linux发行版一起工作从而间接实现目的[^5]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值