Err deploying GCF to interact with Vertex AI Model

108 views
Skip to first unread message

parth jangid

unread,
Aug 20, 2023, 11:07:00 AM8/20/23
to Firebase Google Group
Greetings Guys,
I am facing an issue trying to deploy a cloud function which is supposed to get prediction from the Model imported inside the Vertex AI.

I am deploying my functions using the following command:
gcloud functions deploy predict_image \
    --runtime python310 \
    --trigger-http \
    --allow-unauthenticated


Error Arises when:
-> main.py
import tensorflow as tf

-> requirements.txt
tensorflow

ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Function failed on loading user code.
This is likely due to a bug in the user code. Error message: 2023-08-20 03:45:51.828966: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.
2023-08-20 03:45:53.768849: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.
2023-08-20 03:45:53.771200: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX512F FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.


Failed attempts used to solve error:
  1. In requirements.txt changed the tensorflow to tensorflow-cpu but it didnt work
  2. Added the below flag to main.py yet it didnt work.
    os.environ['CUDA_VISIBLE_DEVICES'] = ''

When I set tensorflow to tensorflow-cpu in requirements.txt and add the above flag then I get a new error:
ERROR:
(gcloud.functions.deploy) OperationError: code=3, message=Function failed on loading user code.
This is likely due to a bug in the user code.
Error message: 2023-08-20 04:00:51.604711: I tensorflow/core/platform/cpu_feature_guard.cc:182]
This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX512F FMA, in other
operations, rebuild TensorFlow with the appropriate compiler flags..
in-depth troubleshooting documentation.


What I want is simply that the model is deployed using Vertex AI and the cloud function will help
the user pass a GCP bucket file path to image. The function will then download the image and create
a tensor and then pass it to the Model to find the prediction on it.

Can someone please help to solve this error.
Reply all
Reply to author
Forward
0 new messages