用途:在 model_server_agent 中部署与配置 PyTorch 推理服务器,用于服务人脸验证流水线的机器学习模型,支持批处理、多版本并行与指标端点。
主要能力:动态批处理、模型版本化、内置性能指标,并可通过 Management API 热注册新版本模型。
必要用法:安装依赖 pip install torchserve torch-model-archiver torch-workflow-archiver;用 torch-model-archiver 将每个模型打包为 MAR;在 config.properties 中配置批处理、worker 数与端口;为每类模型编写实现 initialize()、preprocess()、inference()、postprocess() 的 handler;启动命令 torchserve --start --model-store model_store/ --ts-config config.properties --models arcface=arcface.mar liveness=minifasnet.mar;用 curl 向 Management API 注册新版本;通过 metrics_mode=prometheus 与 metrics_format=prometheus 配置指标;用 /ping 做健康检查。
限制:资料未提供具体性能基准、计费方式或平台要求;需注意多模型同时加载可能超出 GPU 显存,并应按预期负载调整 batch_size 与 max_batch_delay。