Error : Machine Learning with TensorFlow in Vertex AI : Task 6. Model explainability

Hello ,
Getting the below error while try create and deploy model flights_xai to Vertex AI
(Create the model endpoint flights_xai, upload the model, and deploy it at the model endpoint) using the following code:

# note TF_VERSION set in 1st cell, but ENDPOINT_NAME is being changed
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
EXPORT_PATH=$(gsutil ls ${OUTDIR}/export | tail -1)
# create the model endpoint for deploying the model
if [[ $(gcloud beta ai endpoints list --region=$REGION \
        --format='value(DISPLAY_NAME)' --filter=display_name=${ENDPOINT_NAME}) ]]; then
    echo "Endpoint for $MODEL_NAME already exists"
    # create model endpoint
    echo "Creating Endpoint for $MODEL_NAME"
    gcloud beta ai endpoints create --region=${REGION} --display-name=${ENDPOINT_NAME}
ENDPOINT_ID=$(gcloud beta ai endpoints list --region=$REGION \
              --format='value(ENDPOINT_ID)' --filter=display_name=${ENDPOINT_NAME})
# delete any existing models with this name
for MODEL_ID in $(gcloud beta ai models list --region=$REGION --format='value(MODEL_ID)' --filter=display_name=${MODEL_NAME}); do
    echo "Deleting existing $MODEL_NAME ... $MODEL_ID "
    gcloud ai models delete --region=$REGION $MODEL_ID
# upload the model using the parameters docker conatiner image, artifact URI, explanation method, 
# explanation path count and explanation metadata JSON file `explanation-metadata.json`. 
# Here, you keep number of feature permutations to `10` when approximating the Shapley values for explanation.
gcloud beta ai models upload --region=$REGION --display-name=$MODEL_NAME \${TF_VERSION}:latest \
     --artifact-uri=$EXPORT_PATH \
     --explanation-method=sampled-shapley --explanation-path-count=10 --explanation-metadata-file=explanation-metadata.json
MODEL_ID=$(gcloud beta ai models list --region=$REGION --format='value(MODEL_ID)' --filter=display_name=${MODEL_NAME})
# deploy the model to the endpoint
gcloud beta ai endpoints deploy-model $ENDPOINT_ID \
  --region=$REGION \
  --model=$MODEL_ID \
  --display-name=$MODEL_NAME \
  --machine-type=n1-standard-2 \
  --min-replica-count=1 \
  --max-replica-count=1 \

Any fix please?

Thanks in advance,

I just tested the lab and things work as expected. Please do the following:

  1. Save your notebook on vertex ai and then download it in ipynb format from the jupyter interface.
  2. Click my name and message your notebook as an attachment.

Thanks Balaji! As you asked hereis the notebook:
[snippet removed by mentor]

Moving forward, please click my name and message your notebook as an attachment.
Posting code in a public topic is discouraged and can get your account suspended. It’s okay to share stacktrace on a public post and send code to a mentor via direct message. Here’s the community user guide to get started.

One thing with your notebook is that output is missing for a few cells towards end of the notebook. Do remember to save the notebook before downloading.

There’s no difference in content between our notebooks.
Did you create a user-managed notebook on Vertex AI with tensorflow LTS? There are 3 tabs on Vertex AI landing page. If you’re unsure, do try the lab again.

I’m having a problem as well with this part of the assignment.

Following your instructions, I downloaded the notebook and I’ll send it to you via PM

Thanks for bringing this up.
The instruction is incorrect and the staff have been notified about this.

You should not use tensorflow version 2.15 since vertex ai doesn’t support it. Here’s the list of supported tensorflow versions:

Please pick the highlighted notebook kernel for your assignment:

I just tried the assignment with the above change and everything works as expected.

Yes thank you, I had actually tried that and worked fine, the problem as you also said is that I had chosen the default “Python-3” kernel instead of the Tensorflow one, since it was not specified correctly in the instructions.

Thanks anyway for your availability!