服务¶
这些组件旨在更轻松地与推理和服务进行交互 Torchserve 等工具。
- torchx.components.serve 中。torchserve(model_path: str, management_api: str, image: str = 'ghcr.io/pytorch/torchx:0.4.0dev0', params: 可选[Dict[str, object]] = None, dryrun: bool = False) AppDef [来源]¶
将提供的模型部署到给定的 torchserve 管理 API 端点。
>>> from torchx.components.serve import torchserve >>> torchserve( ... model_path="s3://your-bucket/your-model.pt", ... management_api="http://torchserve:8081", ... ) AppDef(name='torchx-torchserve', ...)
- 参数
model_path – 模型存档文件的 fsspec 路径。
management_api — torchserve 管理 API 根目录的 URL。
image – 要使用的容器。
params — torchserve 参数。 请参阅 https://pytorch.org/serve/management_api.html#register-a-model
dryrun – 启动应用程序,但不执行实际工作
- 结果
TorchX 应用程序定义
- 返回类型: