Pytorch 有没有办法在谷歌云AI平台上同时使用GPU加速器和Torch进行模型部署?

Pytorch 有没有办法在谷歌云AI平台上同时使用GPU加速器和Torch进行模型部署?,pytorch,gcloud,google-cloud-ml,Pytorch,Gcloud,Google Cloud Ml,我已经有了一个火炬模型(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}/packag

我已经有了一个火炬模型(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加速器的机器都不支持自定义类(使用Torch需要AFAIK),任何支持自定义类的机器都不支持GPU加速器

有什么办法让它工作吗

关于如何将ai平台与Torch结合使用,有很多教程,但我看不出使用gcloud来训练和预测您是否必须在CPU上完成所有工作的意义,因此我觉得这很奇怪。

至于现在,使用是在测试阶段。此外,使用比mls1-c1-m2还差的产品也在测试阶段

然而,正如您在前面引用的中所看到的,GPU不适用于类似mls1的机器。同时,这些是唯一允许TensorFlow之外的模型的机器类型


总之,现在在Torch中部署预测模型并使用GPU可能不是一个可行的选择

Pytorch+GPU在AI平台预测中不可用,但您可以使用GPU使用并创建自定义Pytorch服务

更新:您现在可以使用AI平台预测