首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >有没有办法同时使用GPU加速器和谷歌云AI平台中的Torch进行模型部署?

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

Stack Overflow用户
提问于 2020-03-09 18:14:31
回答 2查看 215关注 0票数 1

我已经有了一个torch模型(BERT),我想使用ai-platform服务通过GPU获得在线预测,但我不知道如何做到这一点。

以下命令在不使用加速器的情况下有效:

代码语言:javascript
运行
复制
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参数:

代码语言:javascript
运行
复制
--accelerator=^:^count=1:type=nvidia-tesla-k80

我得到以下错误消息:

代码语言:javascript
运行
复制
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

但是如果我使用不同的机器类型,我知道我可以与加速器一起使用,我会得到以下错误:

代码语言:javascript
运行
复制
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加速器。

有什么办法能让它工作吗?

有一堆关于如何在Torch中使用ai-platform的教程,但是我看不出使用gcloud来训练和预测你是否必须在CPU上做所有事情的意义,所以对我来说这感觉非常奇怪。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2020-03-10 17:44:06

到目前为止,使用Custom Prediction Routines还处于测试阶段。此外,使用other machine types而不是mls1-c1-m2也在测试版中。

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

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

票数 1
EN

Stack Overflow用户

发布于 2020-04-02 08:50:50

Pytorch + GPU在AI平台预测中不可用,但您可以使用Deep Learning VM images并创建与GPU一起使用的自定义Pytorch

更新:您现在可以通过containers使用AI平台预测。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60598419

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档