服务¶
这些组件旨在使与推理和服务工具的交互更加容易,例如torchserve。
- torchx.components.serve.torchserve(model_path: str, management_api: str, image: str = 'ghcr.io/pytorch/torchx:0.7.0', params: Optional[Dict[str, object]] = None, dryrun: bool = False) AppDef[source]¶
将提供的模型部署到给定的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', ...)
- Parameters:
model_path – 模型存档文件的fsspec路径。
management_api – torchserve管理API的根URL。
image – 要使用的容器。
params – torchserve 参数。 参见 https://pytorch.org/serve/management_api.html#register-a-model
dryrun – 启动应用程序,但不执行实际工作
- Returns:
TorchX 应用程序定义
- Return type: