Search code examples
machine-learningtensorflowgcloudgoogle-cloud-ml-engine

Tensorflow with GPU on Google Cloud


I have a model on Google Machine Learning using tensorflow, and it's ok. Now I want to do some predicts using the GPU. I saw this link, but it tells about trainning with GPU not prediction. There's nothing about GPU in prediction session.

Someone Know if its possible to do prediction using google machine learning engine with GPU? Or if I use the trainning with GPU, my Prediction automatically run with GPU?

I'm using the follow commandline:

gcloud ml-engine predict --model ${MODEL_NAME} --json-instances request.json

This command works, but It's using CPU. Additional information: My model is published in us-east1 zone, and my scale is automatically.


Solution

  • We support GPU now. Documentation here!

    Example:

    gcloud beta ai-platform versions create version_name \
      --model model_name \
      --origin gs://model-directory-uri \
      --runtime-version 2.1 \
      --python-version 3.7 \
      --framework tensorflow \
      --machine-type n1-standard-4 \
      --accelerator count=1,type=nvidia-tesla-t4 \
      --config config.yaml
    
    

    If you use one of the Compute Engine (N1) machine types for your model version, you can optionally add GPUs to accelerate each prediction node.

    • NVIDIA Tesla K80
    • NVIDIA Tesla P4
    • NVIDIA Tesla P100
    • NVIDIA Tesla T4
    • NVIDIA Tesla V100