服務¶
這些元件旨在讓與推論和服務工具(例如 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 [來源]¶
將提供的模型部署到給定的 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.dev.org.tw/serve/management_api.html#register-a-model
dryrun – 啟動應用程式,但不執行實際工作
- 傳回:
TorchX 應用程式定義
- 傳回型別: