【问题标题】:Is there any way to use both a GPU accelerator and Torch in google cloud AI platform for model deployment?有没有办法在谷歌云 AI 平台中同时使用 GPU 加速器和 Torch 进行模型部署?
【发布时间】: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


    【解决方案1】:

    目前,使用Custom Prediction Routines 处于测试阶段。另外,使用other machine types而不是mls1-c1-m2也是Beta。

    不过,正如您在前面提到的link 中看到的那样,GPU 不适用于类似 mls1 的机器。同时,这些是唯一允许在 TensorFlow 之外建立模型的机器类型。

    总而言之,目前可能在 Torch 中部署您的预测模型并使用 GPU 可能不是一个可行的选择。

    【讨论】:

      【解决方案2】:

      Pytorch + GPU 在 AI Platform Prediction 中不可用,但您可以使用 Deep Learning VM images 并使用 GPU 创建自定义 Pytorch 服务

      更新:您现在可以通过 containers 使用 AI Platform Prediction。

      【讨论】:

        猜你喜欢
        • 2022-01-12
        • 2014-11-21
        • 1970-01-01
        • 1970-01-01
        • 2017-07-21
        • 1970-01-01
        • 2020-03-09
        • 1970-01-01
        • 2019-10-26
        相关资源
        最近更新 更多