Pular para o conteúdo principal

Capítulo 2: Frameworks de Servimento de Modelos

Comparação de Frameworks​

FrameworkMelhor ParaSuporte a GPUMulti-Modelo
TorchServeModelos PyTorch✅✅
TF ServingModelos TensorFlow✅✅
TritonMulti-framework, alta perf.✅✅
BentoMLPrototipagem rápida✅✅

Exemplo de TorchServe​

# Create model archive
torch-model-archiver \
--model-name churn_model \
--version 1.0 \
--model-file model.py \
--serialized-file model.pth \
--handler handler.py \
--export-path model_store

# Start server
torchserve --start --model-store model_store \
--models churn_model=churn_model.mar

Triton Inference Server​

model_repository/
├── churn_model/
│ ├── config.pbtxt
│ └── 1/
│ └── model.onnx
# config.pbtxt
name: "churn_model"
platform: "onnxruntime_onnx"
max_batch_size: 64
input [
{ name: "features", data_type: TYPE_FP32, dims: [10] }
]
output [
{ name: "predictions", data_type: TYPE_INT64, dims: [1] }
]

Próximo: Capítulo 3: Containerização com Docker