【发布时间】:2020-06-21 05:12:25
【问题描述】:
我已经有一个 Torch 模型 (BERT),我想使用 AI 平台服务通过 GPU 获得在线预测,但我不知道该怎么做。
以下命令,没有加速器,有效:
gcloud alpha ai-platform versions create {VERSION} --model {MODEL_NAME} --origin=gs://{BUCKET}/models/ --python-version=3.5 --runtime-version=1.14 --package-uris=gs://{BUCKET}/packages/my-torch-package-0.1.tar.gz,gs://cloud-ai-pytorch/torch-1.0.0-cp35-cp35m-linux_x86_64.whl --machine-type=mls1-c4-m4 --prediction-class=predictor.CustomModelPrediction
但是,如果我尝试添加加速器参数:
--accelerator=^:^count=1:type=nvidia-tesla-k80
我收到以下错误消息:
ERROR: (gcloud.alpha.ai-platform.versions.create) INVALID_ARGUMENT: Field: version.machine_type Error: GPU accelerators are not supported on the requested machine type: mls1-c4-m4
- '@type': type.googleapis.com/google.rpc.BadRequest
fieldViolations:
- description: 'GPU accelerators are not supported on the requested machine type:
mls1-c4-m4'
field: version.machine_type
但如果我使用不同的机器类型,我知道我可以与加速器一起使用,我会收到以下错误:
ERROR: (gcloud.alpha.ai-platform.versions.create) FAILED_PRECONDITION: Field: framework Error: Machine type n1-highcpu-4 does not support CUSTOM_CLASS.
- '@type': type.googleapis.com/google.rpc.BadRequest
fieldViolations:
- description: Machine type n1-highcpu-4 does not support CUSTOM_CLASS.
field: framework
就像任何支持 GPU 加速器的机器不支持自定义类(需要 AFAIK 才能使用 Torch),任何支持自定义类的机器都不支持 GPU 加速器。
有什么办法让它工作?
有很多关于如何将 ai-platform 与 Torch 一起使用的教程,但我看不出使用 gcloud 来训练和预测是否必须在 CPU 上完成所有事情的意义,所以我觉得这很奇怪.
【问题讨论】:
标签: pytorch gcloud google-cloud-ml