name: bentoml-model-packager description: 用于模型打包、服务和容器化的BentoML技能 allowed-tools:
- Read
- Write
- Bash
- Glob
- Grep
bentoml-model-packager
概述
支持多种机器学习框架的BentoML技能,用于模型打包、服务和容器化。
功能
- Bento创建与版本管理
- 多框架模型支持(sklearn、PyTorch、TensorFlow等)
- 带验证的API端点定义
- Docker容器化
- Kubernetes部署YAML生成
- 自适应批处理配置
- 模型签名与运行器
- 服务组合
目标流程
- 带金丝雀发布的模型部署流水线
- 模型训练流水线
- 机器学习系统集成测试
工具与库
- BentoML
- Docker
- Kubernetes
输入模式
{
"type": "object",
"required": ["action"],
"properties": {
"action": {
"type": "string",
"enum": ["save", "build", "serve", "containerize", "push", "list"],
"description": "要执行的BentoML操作"
},
"modelConfig": {
"type": "object",
"properties": {
"name": { "type": "string" },
"framework": { "type": "string" },
"modelPath": { "type": "string" },
"signatures": { "type": "object" }
}
},
"serviceConfig": {
"type": "object",
"properties": {
"servicePath": { "type": "string" },
"port": { "type": "integer" },
"workers": { "type": "integer" },
"batchConfig": {
"type": "object",
"properties": {
"maxBatchSize": { "type": "integer" },
"maxLatencyMs": { "type": "integer" }
}
}
}
},
"buildConfig": {
"type": "object",
"properties": {
"bentoName": { "type": "string" },
"version": { "type": "string" },
"includeFiles": { "type": "array", "items": { "type": "string" } },
"pythonRequirements": { "type": "string" }
}
},
"containerConfig": {
"type": "object",
"properties": {
"imageName": { "type": "string" },
"registry": { "type": "string" },
"dockerOptions": { "type": "object" }
}
}
}
}
输出模式
{
"type": "object",
"required": ["status", "action"],
"properties": {
"status": {
"type": "string",
"enum": ["success", "error"]
},
"action": {
"type": "string"
},
"modelTag": {
"type": "string"
},
"bentoTag": {
"type": "string"
},
"imageTag": {
"type": "string"
},
"endpoint": {
"type": "string"
},
"kubernetesYaml": {
"type": "string"
}
}
}
使用示例
{
kind: 'skill',
title: '打包并容器化模型',
skill: {
name: 'bentoml-model-packager',
context: {
action: 'containerize',
modelConfig: {
name: 'fraud_classifier',
framework: 'sklearn',
modelPath: 'models/fraud_model.pkl'
},
buildConfig: {
bentoName: 'fraud-service',
version: '1.0.0',
pythonRequirements: 'requirements.txt'
},
containerConfig: {
imageName: 'fraud-service',
registry: 'gcr.io/my-project'
}
}
}
}