Open YunchaoYang opened 5 months ago
the minimal necessary parameters configure served model
For tensorRT, onnx file, tensorflow saved-model, do not require config.pbtxt when --strict-model-config=False. platform/backend: 用于指定后端,大部分情况二选一,特殊情况需要特殊对待,见后面。
max_batch_size: 指定最大batch。
input、output: 输入输出Tensor的名字和信息。
注意,对于Tensorrt,TensorFlow save-model,onnx模型,config.pbtxt不是必须的,只要启动指定 --strict-model-config=false
对于Tensorrt、onnxrt、pytorch,这两种参数二选一即可。
对于TensorFlow必须指定platform,backend可选。
对于openvino,python,dali,只能使用backend。
对于Custom,21.05版本之前,可以通过platform参数设置为custom表示;之后必须通过backend字段进行指定,值为你的custom backend library的名字。
情况1: max_batch_size为一个大于0的常数,Input和output指定名字,数据类型,数据形状。 注意:dims在指定的时候忽略batch_size的维度。
情况2: max_batch_size等于0。表示模型的输入和输出是不包括batch_size那个维度的。 这个时候维度信息就是真实的维度信息。
情况3: pytorch特殊情况,torchscript模型不保存输入输出的名字,因此对输入输出名称有特殊规定,"字符串__数字"。 支持可变shape,设置为-1。
情况4: reshape参数:对输入输出进行reshape。
对应triton的并行计算能力特性,这个参数主要用来配置在指定设备上运行多个实例,提高模型服务能力,增加吞吐。
可配置多组。
Scheduling:指定调度策略来应对请求。
不做batching; 输入进来是多少就按照多少去推理;
在服务端将多少个batch_size比较小的input_tensor合并为一个batch_size比较大的input_tensor; 提高吞吐率的关键手段; 只适合无状态模型;
子参数:
高级子参数:
专门用于stateful model的一种调度器; 确保同一序列的推理请求能够路由到同样的模型实例上推理;
组合不同的模块,形成pipeline;
Onnx模型优化——TRT backend for ONNX; TensorFlow模型优化——TF-TRT;
指定模型热身的参数;
tritonserver --model-repository=<MODEL_REPO>
--log-verbose
--strict-model-config
--strict-readiness
--exit-on-error <boolean>
--http-port <integer>
--grpc-port <integer>
--metrics-port <integer>
--model-control-mode <string>
curl -v <IP>:8000/v2/health/ready
--log-verbose
--repository-poll-secs
curl -X POST http://localhost:8000/v2/repository/models/resnet50_pytorch/load
curl -X POST http://localhost:8000/v2/repository/models/resnet50_pytorch/unload
通过share memory去推理:适合client和server在同一部机器上的情况。
A few options to explore
Run this Generative AI example to build Lora with Gemma 2b and 7b
Run this example with Mistral 7B for PEFT
TensorRT/TensorRT_LLM
Triton Inference Server