Unable to deploy a CNN model on GCP AI platform

Viewed 143

I'm trying to deploy a model to GCP AI Platform but not getting anywhere, I know similar question has been asked before, but I can't make out what I'm doing wrong, any help would be appreciated. I'm using jupyter notebook for development.

MODEL_NAME='CLASSIFIER' 
VERSION_NAME='v1' 
RUNTIME_VERSION='1.13' 
REGION='europe-west1'

!gcloud ai-platform models create {MODEL_NAME} --regions {REGION}

The model is created in the global end point

!gcloud beta ai-platform versions create {VERSION_NAME} \
--model {MODEL_NAME} \
--origin gs://{BUCKET}/{MODEL_DIR} \
--python-version 3.7 \
--runtime-version {RUNTIME_VERSION} \
--package-uris gs://{BUCKET}/{PACKAGES_DIR}/sentiment_classifier-0.1.tar.gz \
--prediction-class=model_prediction.CustomPrediction \
--machine-type mls1-c4-m4

but when I try to create the version, it tries to create it in the regional end point and fails, or so I think

Using endpoint [https://us-central1-ml.googleapis.com/] ERROR: (gcloud.beta.ai-platform.versions.create) INVALID_ARGUMENT: Machine type is not available on this endpoint.

enter image description here

1 Answers

I was able to run the command without issues. For it I use an existing sample to replicate the execution of the commands .

As a remark, both models point to https://ml.googleapis.com as this region accepts the execution of beta commands as the one used for this case. You can see details of it on this link under --region. As a note, you can choose different main regions but keep in mind that it should support the execution of beta commands and that both (the model and the version) points to the same endpoint.

model

MODEL_NAME = 'CensusPredictor'
VERSION_NAME = 'v1'
REGION = "global"  

! gcloud ai-platform models create $MODEL_NAME \
  --regions $REGION

output

WARNING: To specify a region where the model will deployed on the global endpoint, please use `--regions` and do not specify `--region`. Using [us-central1] by default on https://ml.googleapis.com. Please note that your model will be inaccessible from https://us-central1-ml.googelapis.com
Learn more about regional endpoints and see a list of available regions: https://cloud.google.com/ai-platform/prediction/docs/regional-endpoints

Using endpoint [https://ml.googleapis.com/]
Created ai platform model [projects/<my-project-id>/models/CensusPredictor].

beta ai-platform versions create

! gcloud beta ai-platform versions create $VERSION_NAME --model $MODEL_NAME \
  --origin gs://$BUCKET_NAME/custom_pipeline_tutorial/model/ \
  --runtime-version 1.13 \
  --python-version 3.5 \
  --framework SCIKIT_LEARN \
  --package-uris gs://$BUCKET_NAME/custom_pipeline_tutorial/code/census_package-1.0.tar.gz \
  --region $REGION \
  --machine-type mls1-c1-m2

output

Using endpoint [https://ml.googleapis.com/]
Creating version (this might take a few minutes)......done. 
Related